def test_as_dict_and_from_dict(self): file_name = os.path.join(test_dir, 'HEADER') header = Header.from_file(file_name) d = header.as_dict() header2 = Header.from_dict(d) self.assertEqual(str(header), str(header2), "Header failed to and from dict test")
def test_as_dict_and_from_dict(self): file_name = os.path.join(test_dir, 'HEADER') header = Header.from_file(file_name) struct = header.struct atoms = FeffAtoms(struct, 'O') d = atoms.as_dict() atoms2 = FeffAtoms.from_dict(d) self.assertEqual(str(atoms), str(atoms2), "FeffAtoms failed to and from dict test")
def test_as_dict_and_from_dict(self): file_name = os.path.join(test_dir, 'HEADER') header = Header.from_file(file_name) struct = header.struct pot = FeffPot(struct, 'O') d=pot.as_dict() pot2 = FeffPot.from_dict(d) self.assertEqual(str(pot), str(pot2), "FeffPot to and from dict does not match")
def test_as_dict_and_from_dict(self): file_name = os.path.join(test_dir, 'HEADER') header = Header.from_file(file_name) struct = header.struct pot = FeffPot(struct, 'O') d = pot.as_dict() pot2 = FeffPot.from_dict(d) self.assertEqual(str(pot), str(pot2), "FeffPot to and from dict does not match")
def from_file(xmu_dat_file="xmu.dat", feff_inp_file="feff.inp"): """ Get Xmu from file. Args: xmu_dat_file (str): filename and path for xmu.dat feff_inp_file (str): filename and path of feff.inp input file Returns: Xmu object """ data = np.loadtxt(xmu_dat_file) header = Header.from_file(feff_inp_file) parameters = Tags.from_file(feff_inp_file) pots = Potential.pot_string_from_file(feff_inp_file) absorbing_atom = pots.splitlines()[1].split()[2] return Xmu(header, parameters, absorbing_atom, data)
def from_file(filename="xmu.dat", input_filename="feff.inp"): """ Get Xmu from file. Args: filename: filename and path for xmu.dat input_filename: filename and path of feff.inp input file Returns: Xmu object """ data = np.loadtxt(filename) header = Header.from_file(input_filename) parameters = Tags.from_file(input_filename) pots = Potential.pot_string_from_file(input_filename) central_atom = pots.splitlines()[1].split()[2] return Xmu(header, parameters, central_atom, data)
def from_file(xmu_dat_file="xmu.dat", feff_inp_file="feff.inp"): """ Get Xmu from file. Args: xmu_dat_file (str): filename and path for xmu.dat feff_inp_file (str): filename and path of feff.inp input file Returns: Xmu object """ data = np.loadtxt(xmu_dat_file) header = Header.from_file(feff_inp_file) parameters = Tags.from_file(feff_inp_file) pots = Potential.pot_string_from_file(feff_inp_file) # site index (Note: in feff it starts from 1) if "RECIPROCAL" in parameters: absorbing_atom = parameters["TARGET"] # species symbol else: absorbing_atom = pots.splitlines()[1].split()[2] return Xmu(header, parameters, absorbing_atom, data)
def from_file(xmu_dat_file="xmu.dat", feff_inp_file="feff.inp"): """ Get Xmu from file. Args: xmu_dat_file (str): filename and path for xmu.dat feff_inp_file (str): filename and path of feff.inp input file Returns: Xmu object """ data = np.loadtxt(xmu_dat_file) header = Header.from_file(feff_inp_file) parameters = Tags.from_file(feff_inp_file) pots = Potential.pot_string_from_file(feff_inp_file) # site index (Note: in feff it starts from 1) if "RECIPROCAL" in parameters: absorbing_atom = parameters["TARGET"] # species symbol else: absorbing_atom = pots.splitlines()[3].split()[2] return Xmu(header, parameters, absorbing_atom, data)