Exemplo 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")
Exemplo n.º 2
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")
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(
        description='''Convenient DOS Plotter for Feff runs.
    Author: Alan Dozier
    Version: 1.0
    Last updated: April, 2013''')

    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']
    plt.plot(x, y, color_order[2 % 7], label=tle)

    plt.legend()
    leg = plt.gca().get_legend()
    ltext = leg.get_texts()  # all the text.Text instance in the legend
    plt.setp(ltext, fontsize=15)
    plt.tight_layout()
    plt.show()
parser = argparse.ArgumentParser(description='''Convenient DOS Plotter for Feff runs.
Author: Alan Dozier
Version: 1.0
Last updated: April, 2013''')

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']
Exemplo n.º 5
0
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']
Exemplo n.º 6
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")
Exemplo n.º 7
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")