Skip to content

Commit

Permalink
EQE parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Ternes committed Oct 29, 2024
1 parent 0780880 commit 4a8345f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/nomad_unitov_plugin/schema_packages/file_parser/eqe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ def arrange_eqe_columns(df):
photon_energy_raw: array of photon energy values in eV
eqe_raw: array of eqe values
"""
if 'Calculated' in list(df.columns): # for files from the hzb
x = df.iloc[:, 0].values
y = df['Calculated'].values
else:
x = df.iloc[:, 0].values
y = df.iloc[:, 1].values

x = np.array(df['Wavelength (nm)']) # for files from the unitov
y = np.array(df['IPCE (%)'])


if any(x > 10): # check if energy (eV) or wavelength (nm)
x = hc_eVnm / x
Expand Down Expand Up @@ -114,6 +112,8 @@ def read_file(file_path, header_lines=None):
df = pd.read_csv(file_path, header=int(header_lines))
if len(df.columns) < 2:
raise IndexError
#print(df)

df = df.apply(pd.to_numeric, errors='coerce')
df = df.dropna()
photon_energy_raw, eqe_raw = arrange_eqe_columns(df)
Expand All @@ -122,6 +122,8 @@ def read_file(file_path, header_lines=None):


def read_file_multiple(filedata):

raise NotImplementedError;
df = pd.read_csv(StringIO(filedata), sep="\t")
result = []
for i in range(0, len(df.columns), 6):
Expand Down Expand Up @@ -151,3 +153,9 @@ def read_file_multiple(filedata):
except:
continue
return result


import os;
abs_path = os.path.dirname(os.path.abspath(__file__))+'\\';
print(read_file(abs_path+r"..\..\..\..\tests\data\example_measurement\EQE.txt", header_lines=24)[3]);
#print(get_jv_data_unitov(file.read()))
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ def get_jv_data_unitov(filedata):


def get_jv_data(filedata):
if filedata.startswith("Keithley"):
return get_jv_data_hysprint(filedata), "HySprint HyVap"
else:
return get_jv_data_iris(filedata), 'IRIS HZBGloveBoxes Pero4SOSIMStorage'
return get_jv_data_unitov(filedata), "Untiov"

#import os;
#abs_path = os.path.dirname(os.path.abspath(__file__))+'\\';
Expand Down

0 comments on commit 4a8345f

Please sign in to comment.