Author Topic: data extraction from pylab  (Read 3337 times)

0 Members and 1 Guest are viewing this topic.

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
data extraction from pylab
« on: January 17, 2013, 12:36 »
Dear Sir,
       Is it possible to extract data from pylab and print to a .dat (or .txt) file having two columns (like x and y)?

Regards
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: data extraction from pylab
« Reply #1 on: January 17, 2013, 12:52 »
The question is a bit undefined. There is no data in pylab... Can you be a bit more specific?

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: data extraction from pylab
« Reply #2 on: January 17, 2013, 13:25 »
Dear Sir,
http://quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.densityofstates.html in this reference manual, I have got a script "si_dos_plot.py". Using this script, I want to plot the PDOS (by using the projection_list command), both in Gaussian and tetrahedron spectrum but when I run this program then the results are shown in pylab plot. Now, it is very difficult for me to modify this figure, so I want to save the data in two columns (for both Gaussian and tetrahedron spectrum in different file)  so that I can plot these in other plotting tools for better resolution.

Regards
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: data extraction from pylab
« Reply #3 on: January 17, 2013, 13:47 »
Sure, this is very simple. If we base it on the reference manual example, you would add to the script
Code: python
for e,d in zip(energies.inUnitsOf(eV), dos_t.inUnitsOf(eV**-1), dos_g.inUnitsOf(eV**-1)):
    print e,d_t,d_g
Pipe the output to a file and you have a data file with 3 columns, energy, dos (tetrahedron) and dos (Gaussian).

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: data extraction from pylab
« Reply #4 on: January 17, 2013, 18:34 »
Dear Sir,
        Thank you. It is working.

Regards
Ramkrishna