Allow user to skip read-in of error columns
This commit is contained in:
parent
c2477bfd99
commit
33012c6035
1 changed files with 25 additions and 5 deletions
|
|
@ -926,10 +926,18 @@ def refine(data: dict, options={}):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def read_results(path):
|
def read_results(path, options={}):
|
||||||
|
|
||||||
|
|
||||||
|
default_options = {
|
||||||
|
'errors': True
|
||||||
|
}
|
||||||
|
|
||||||
|
options = aux.update_options(options=options, default_options=default_options)
|
||||||
|
|
||||||
results = pd.read_csv(path, delim_whitespace=True, index_col=0, header=None)
|
results = pd.read_csv(path, delim_whitespace=True, index_col=0, header=None)
|
||||||
|
|
||||||
|
if options['errors']:
|
||||||
atoms = int((results.shape[1] - 24) / 10)
|
atoms = int((results.shape[1] - 24) / 10)
|
||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
|
|
@ -938,13 +946,25 @@ def read_results(path):
|
||||||
'a', 'a_err', 'b', 'b_err', 'c', 'c_err', 'alpha', 'alpha_err', 'beta', 'beta_err', 'gamma', 'gamma_err',
|
'a', 'a_err', 'b', 'b_err', 'c', 'c_err', 'alpha', 'alpha_err', 'beta', 'beta_err', 'gamma', 'gamma_err',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
else:
|
||||||
|
atoms = int((results.shape[1] - 15) / 5)
|
||||||
|
|
||||||
|
headers = [
|
||||||
|
'r_wp', 'r_exp', 'r_p', 'r_p_dash', 'r_exp_dash', 'gof',
|
||||||
|
'vol', 'mass', 'wp',
|
||||||
|
'a', 'b', 'c', 'alpha', 'beta', 'gamma',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
labels = ['x', 'y', 'z', 'occ', 'beq']
|
labels = ['x', 'y', 'z', 'occ', 'beq']
|
||||||
for i in range(atoms):
|
for i in range(atoms):
|
||||||
for label in labels:
|
for label in labels:
|
||||||
headers.append(f'atom_{i+1}_{label}')
|
headers.append(f'atom_{i+1}_{label}')
|
||||||
|
|
||||||
|
if options['errors']:
|
||||||
headers.append(f'atom_{i+1}_{label}_err')
|
headers.append(f'atom_{i+1}_{label}_err')
|
||||||
|
|
||||||
|
|
||||||
results.columns = headers
|
results.columns = headers
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue