diff --git a/chem_spectra/lib/composer/ni.py b/chem_spectra/lib/composer/ni.py index 45a9fd91..86eb48b0 100644 --- a/chem_spectra/lib/composer/ni.py +++ b/chem_spectra/lib/composer/ni.py @@ -486,26 +486,26 @@ def tf_img(self): def __prepare_metadata_info_for_csv(self, csv_writer: csv.DictWriter): csv_writer.writerow({ - 'Max x': 'Measurement type', - 'Max y': 'Cyclic Voltammetry', + 'Ox E(V)': 'Measurement type', + 'Red E(V)': 'Cyclic Voltammetry', }) csv_writer.writerow({ - 'Max x': 'Measurement type ID', + 'Ox E(V)': 'Measurement type ID', }) csv_writer.writerow({ - 'Max x': 'Sample ID', + 'Ox E(V)': 'Sample ID', }) csv_writer.writerow({ - 'Max x': 'Analysis ID', + 'Ox E(V)': 'Analysis ID', }) csv_writer.writerow({ - 'Max x': 'Dataset ID', + 'Ox E(V)': 'Dataset ID', }) csv_writer.writerow({ - 'Max x': 'Dataset name', + 'Ox E(V)': 'Dataset name', }) csv_writer.writerow({ - 'Max x': 'Link to sample', + 'Ox E(V)': 'Link to sample', }) csv_writer.writerow({ }) @@ -523,8 +523,7 @@ def tf_csv(self): listMaxMinPeaks = self.core.params['list_max_min_peaks'] with open(tf_csv.name, 'w', newline='', encoding='utf-8') as csvfile: - # fieldnames = ['Max', 'Min', 'I λ0', 'I ratio', 'Pecker'] - fieldnames = ['Max x', 'Max y', 'Min x', 'Min y', 'Delta Ep', 'I lambda0', 'I ratio'] + fieldnames = ['Ox E(V)', 'Ox I(mA)', 'Red E(V)', 'Red I(mA)', 'I lambda0(mA)', 'I ratio', 'E1/2(V)', 'Delta Ep(mV)'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) self.__prepare_metadata_info_for_csv(writer) @@ -539,11 +538,13 @@ def tf_csv(self): y_pecker = self.core.ys[idx] for peak in listMaxMinPeaks: - max_peak, min_peak = None, None + max_peak, min_peak, e12 = None, None, None if 'max' in peak: max_peak = peak['max'] if 'min' in peak: min_peak = peak['min'] + if 'e12' in peak: + e12 = peak['e12'] x_max_peak, y_max_peak = self.__get_xy_of_peak(max_peak) x_min_peak, y_min_peak = self.__get_xy_of_peak(min_peak) @@ -554,7 +555,7 @@ def tf_csv(self): if (x_max_peak == '' or x_min_peak == ''): delta = '' else: - delta = abs(x_max_peak - x_min_peak) + delta = abs(x_max_peak - x_min_peak) * 1000 x_pecker = '' # calculate ratio @@ -572,13 +573,14 @@ def tf_csv(self): y_pecker = '' writer.writerow({ - 'Max x': '{x_max}'.format(x_max=x_max_peak), - 'Max y': '{y_max}'.format(y_max=y_max_peak), - 'Min x': '{x_min}'.format(x_min=x_min_peak), - 'Min y': '{y_min}'.format(y_min=y_min_peak), - 'Delta Ep': '{y_pecker}'.format(y_pecker=y_pecker), - 'I lambda0': '{ratio}'.format(ratio=ratio), - 'I ratio': '{delta}'.format(delta=delta) + 'Ox E(V)': '{x_max}'.format(x_max=x_max_peak), + 'Ox I(mA)': '{y_max}'.format(y_max=y_max_peak), + 'Red E(V)': '{x_min}'.format(x_min=x_min_peak), + 'Red I(mA)': '{y_min}'.format(y_min=y_min_peak), + 'I lambda0(mA)': '{y_pecker}'.format(y_pecker=y_pecker), + 'I ratio': '{ratio}'.format(ratio=ratio), + 'E1/2(V)': '{e12}'.format(e12=e12), + 'Delta Ep(mV)': '{delta}'.format(delta=delta) }) return tf_csv