| @@ 532-573 (lines=42) @@ | ||
| 529 | return ratio |
|
| 530 | ||
| 531 | ||
| 532 | def data_analysis(data): |
|
| 533 | """This function returns a dictionary consisting of |
|
| 534 | the relevant values. This can be seen in the user |
|
| 535 | interface (Dash) as well.""" |
|
| 536 | results_dict = {} |
|
| 537 | ||
| 538 | # df = main.data_frame(dict_1,1) |
|
| 539 | x_val = data['Potential'] |
|
| 540 | y_val = data['Current'] |
|
| 541 | # Peaks are here [list] |
|
| 542 | peak_index = peak_detection_fxn(y_val) |
|
| 543 | # Split x,y to get baselines |
|
| 544 | col_x1, col_x2 = split(x_val) |
|
| 545 | col_y1, col_y2 = split(y_val) |
|
| 546 | y_base1 = linear_background(col_x1, col_y1) |
|
| 547 | y_base2 = linear_background(col_x2, col_y2) |
|
| 548 | # Calculations based on baseline and peak |
|
| 549 | values = peak_values(x_val, y_val) |
|
| 550 | esub_t = values[0] |
|
| 551 | esub_b = values[2] |
|
| 552 | dof_e = del_potential(x_val, y_val) |
|
| 553 | half_e = min(esub_t, esub_b) + half_wave_potential(x_val, y_val) |
|
| 554 | ipa = peak_heights(x_val, y_val)[0] |
|
| 555 | ipc = peak_heights(x_val, y_val)[1] |
|
| 556 | ratio_i = peak_ratio(x_val, y_val) |
|
| 557 | results_dict['Peak Current Ratio'] = ratio_i |
|
| 558 | results_dict['Ipc (A)'] = ipc |
|
| 559 | results_dict['Ipa (A)'] = ipa |
|
| 560 | results_dict['Epc (V)'] = esub_b |
|
| 561 | results_dict['Epa (V)'] = esub_t |
|
| 562 | results_dict['∆E (V)'] = dof_e |
|
| 563 | results_dict['Redox Potential (V)'] = half_e |
|
| 564 | if dof_e > 0.3: |
|
| 565 | results_dict['Reversible'] = 'No' |
|
| 566 | else: |
|
| 567 | results_dict['Reversible'] = 'Yes' |
|
| 568 | ||
| 569 | if half_e > 0 and 'Yes' in results_dict.values(): |
|
| 570 | results_dict['Type'] = 'Catholyte' |
|
| 571 | elif 'Yes' in results_dict.values(): |
|
| 572 | results_dict['Type'] = 'Anolyte' |
|
| 573 | return results_dict, col_x1, col_x2, col_y1, col_y2, y_base1, y_base2, peak_index |
|
| 574 | #return results_dict |
|
| 575 | ||
| @@ 151-192 (lines=42) @@ | ||
| 148 | return df |
|
| 149 | ||
| 150 | ||
| 151 | def data_analysis(data): |
|
| 152 | """This function returns a dictionary consisting of |
|
| 153 | the relevant values. This can be seen in the user |
|
| 154 | interface (Dash) as well.""" |
|
| 155 | results_dict = {} |
|
| 156 | ||
| 157 | # df = main.data_frame(dict_1,1) |
|
| 158 | x_val = data['Potential'] |
|
| 159 | y_val = data['Current'] |
|
| 160 | # Peaks are here [list] |
|
| 161 | peak_index = peak_detection_fxn(y_val) |
|
| 162 | # Split x,y to get baselines |
|
| 163 | col_x1, col_x2 = split(x_val) |
|
| 164 | col_y1, col_y2 = split(y_val) |
|
| 165 | y_base1 = linear_background(col_x1, col_y1) |
|
| 166 | y_base2 = linear_background(col_x2, col_y2) |
|
| 167 | # Calculations based on baseline and peak |
|
| 168 | values = peak_values(x_val, y_val) |
|
| 169 | esub_t = values[0] |
|
| 170 | esub_b = values[2] |
|
| 171 | dof_e = del_potential(x_val, y_val) |
|
| 172 | half_e = min(esub_t, esub_b) + half_wave_potential(x_val, y_val) |
|
| 173 | ipa = peak_heights(x_val, y_val)[0] |
|
| 174 | ipc = peak_heights(x_val, y_val)[1] |
|
| 175 | ratio_i = peak_ratio(x_val, y_val) |
|
| 176 | results_dict['Peak Current Ratio'] = ratio_i |
|
| 177 | results_dict['Ipc (A)'] = ipc |
|
| 178 | results_dict['Ipa (A)'] = ipa |
|
| 179 | results_dict['Epc (V)'] = esub_b |
|
| 180 | results_dict['Epa (V)'] = esub_t |
|
| 181 | results_dict['∆E (V)'] = dof_e |
|
| 182 | results_dict['Redox Potential (V)'] = half_e |
|
| 183 | if dof_e > 0.3: |
|
| 184 | results_dict['Reversible'] = 'No' |
|
| 185 | else: |
|
| 186 | results_dict['Reversible'] = 'Yes' |
|
| 187 | ||
| 188 | if half_e > 0 and 'Yes' in results_dict.values(): |
|
| 189 | results_dict['Type'] = 'Catholyte' |
|
| 190 | elif 'Yes' in results_dict.values(): |
|
| 191 | results_dict['Type'] = 'Anolyte' |
|
| 192 | return results_dict, col_x1, col_x2, col_y1, col_y2, y_base1, y_base2, peak_index |
|
| 193 | #return results_dict |
|
| 194 | ||
| 195 | ||