Esempio n. 1
0
 def test_as_dict_and_from_dict(self):
     filepath1 = os.path.join(test_dir, 'xmu.dat')
     filepath2 = os.path.join(test_dir, 'feff.inp')
     x = Xmu.from_file(filepath1, filepath2)
     data = x.data.tolist()
     d = x.as_dict()
     x2 = Xmu.from_dict(d)
     data2 = x2.data.tolist()
     self.assertEqual(data, data2, "Xmu to and from dict does not match")
 def test_to_dict_and_from_dict(self):
     filepath1 = os.path.join(test_dir, 'xmu.dat')
     filepath2 = os.path.join(test_dir, 'feff.inp')
     x = Xmu.from_file(filepath1, filepath2)
     data=x.data.tolist()
     d=x.to_dict
     x2 = Xmu.from_dict(d)
     data2= x2.data.tolist()
     self.assertEqual(data, data2,
                      "Xmu to and from dict does not match")
parser = argparse.ArgumentParser(description='''Convenient DOS Plotter for Feff runs.
Author: Alan Dozier
Version: 1.0
Last updated: August, 2012''')

parser.add_argument('filename', metavar='filename', type=str, nargs=1,
                    help='xmu file to plot')
parser.add_argument('filename1', metavar='filename1', type=str, nargs=1,
                    help='feff.inp filename to import')

plt = get_publication_quality_plot(12, 8)
color_order = ['r', 'b', 'g', 'c', 'k', 'm', 'y']

args = parser.parse_args()
xmu = Xmu.from_file(args.filename[0], args.filename1[0])

data = xmu.to_dict

plt.title(data['calc'] + ' Feff9.6 Calculation for ' + data['atom'] + ' in ' +
          data['formula'] + ' unit cell')
plt.xlabel('Energies (eV)')
plt.ylabel('Absorption Cross-section')

x = data['energies']
y = data['scross']
tle = 'Single ' + data['atom'] + ' ' + data['edge'] + ' edge'
plt.plot(x, y, color_order[1 % 7], label=tle)

y = data['across']
tle = data['atom'] + ' ' + data['edge'] + ' edge in ' + data['formula']
Esempio n. 4
0
 def test_init(self):
     filepath1 = os.path.join(test_dir, 'xmu.dat')
     filepath2 = os.path.join(test_dir, 'feff.inp')
     x = Xmu.from_file(filepath1, filepath2)
     self.assertEqual(x.absorbing_atom, 'O',
                      "failed to read xmu.dat file properly")
parser.add_argument('filename',
                    metavar='filename',
                    type=str,
                    nargs=1,
                    help='xmu file to plot')
parser.add_argument('filename1',
                    metavar='filename1',
                    type=str,
                    nargs=1,
                    help='feff.inp filename to import')

plt = get_publication_quality_plot(12, 8)
color_order = ['r', 'b', 'g', 'c', 'k', 'm', 'y']

args = parser.parse_args()
xmu = Xmu.from_file(args.filename[0], args.filename1[0])

data = xmu.to_dict

plt.title(data['calc'] + ' Feff9.6 Calculation for ' + data['atom'] + ' in ' +
          data['formula'] + ' unit cell')
plt.xlabel('Energies (eV)')
plt.ylabel('Absorption Cross-section')

x = data['energies']
y = data['scross']
tle = 'Single ' + data['atom'] + ' ' + data['edge'] + ' edge'
plt.plot(x, y, color_order[1 % 7], label=tle)

y = data['across']
tle = data['atom'] + ' ' + data['edge'] + ' edge in ' + data['formula']
 def test_init(self):
     filepath1 = os.path.join(test_dir, 'xmu.dat')
     filepath2 = os.path.join(test_dir, 'feff.inp')
     x = Xmu.from_file(filepath1, filepath2)
     self.assertEqual(x.absorbing_atom, 'O',
                      "failed to read xmu.dat file properly")