| @@ 148-186 (lines=39) @@ | ||
| 145 | return df |
|
| 146 | ||
| 147 | ||
| 148 | def data_analysis(df): |
|
| 149 | results_dict = {} |
|
| 150 | ||
| 151 | # df = main.data_frame(dict_1,1) |
|
| 152 | x = df['Potential'] |
|
| 153 | y = df['Current'] |
|
| 154 | # Peaks are here [list] |
|
| 155 | peak_index = core.peak_detection_fxn(y) |
|
| 156 | # Split x,y to get baselines |
|
| 157 | x1,x2 = core.split(x) |
|
| 158 | y1,y2 = core.split(y) |
|
| 159 | y_base1 = core.linear_background(x1,y1) |
|
| 160 | y_base2 = core.linear_background(x2,y2) |
|
| 161 | # Calculations based on baseline and peak |
|
| 162 | values = core.peak_values(x,y) |
|
| 163 | Et = values[0] |
|
| 164 | Eb = values[2] |
|
| 165 | dE = core.del_potential(x,y) |
|
| 166 | half_E = min(Et,Eb) + core.half_wave_potential(x,y) |
|
| 167 | ia = core.peak_heights(x,y)[0] |
|
| 168 | ic = core.peak_heights(x,y)[1] |
|
| 169 | ratio_i = core.peak_ratio(x,y) |
|
| 170 | results_dict['Peak Current Ratio'] = ratio_i |
|
| 171 | results_dict['Ipc (A)'] = ic |
|
| 172 | results_dict['Ipa (A)'] = ia |
|
| 173 | results_dict['Epc (V)'] = Eb |
|
| 174 | results_dict['Epa (V)'] = Et |
|
| 175 | results_dict['∆E (V)'] = dE |
|
| 176 | results_dict['Redox Potential (V)'] = half_E |
|
| 177 | if dE>0.3: |
|
| 178 | results_dict['Reversible'] = 'No' |
|
| 179 | else: |
|
| 180 | results_dict['Reversible'] = 'Yes' |
|
| 181 | ||
| 182 | if half_E>0 and 'Yes' in results_dict.values(): |
|
| 183 | results_dict['Type'] = 'Catholyte' |
|
| 184 | elif 'Yes' in results_dict.values(): |
|
| 185 | results_dict['Type'] = 'Anolyte' |
|
| 186 | return results_dict, x1, x2, y1, y2, y_base1, y_base2, peak_index |
|
| 187 | #return results_dict |
|
| 188 | ||
| 189 | ||
| @@ 147-185 (lines=39) @@ | ||
| 144 | return df |
|
| 145 | ||
| 146 | ||
| 147 | def data_analysis(df): |
|
| 148 | results_dict = {} |
|
| 149 | ||
| 150 | # df = main.data_frame(dict_1,1) |
|
| 151 | x = df['Potential'] |
|
| 152 | y = df['Current'] |
|
| 153 | # Peaks are here [list] |
|
| 154 | peak_index = core.peak_detection_fxn(y) |
|
| 155 | # Split x,y to get baselines |
|
| 156 | x1,x2 = core.split(x) |
|
| 157 | y1,y2 = core.split(y) |
|
| 158 | y_base1 = core.linear_background(x1,y1) |
|
| 159 | y_base2 = core.linear_background(x2,y2) |
|
| 160 | # Calculations based on baseline and peak |
|
| 161 | values = core.peak_values(x,y) |
|
| 162 | Et = values[0] |
|
| 163 | Eb = values[2] |
|
| 164 | dE = core.del_potential(x,y) |
|
| 165 | half_E = min(Et,Eb) + core.half_wave_potential(x,y) |
|
| 166 | ia = core.peak_heights(x,y)[0] |
|
| 167 | ic = core.peak_heights(x,y)[1] |
|
| 168 | ratio_i = core.peak_ratio(x,y) |
|
| 169 | results_dict['Peak Current Ratio'] = ratio_i |
|
| 170 | results_dict['Ipc'] = ic |
|
| 171 | results_dict['Ipa'] = ia |
|
| 172 | results_dict['Epc'] = Eb |
|
| 173 | results_dict['Epa'] = Et |
|
| 174 | results_dict['∆E'] = dE |
|
| 175 | results_dict['Redox Potential'] = half_E |
|
| 176 | if dE>0.3: |
|
| 177 | results_dict['Reversible'] = 'No' |
|
| 178 | else: |
|
| 179 | results_dict['Reversible'] = 'Yes' |
|
| 180 | ||
| 181 | if half_E>0 and 'Yes' in results_dict.values(): |
|
| 182 | results_dict['Type'] = 'Catholyte' |
|
| 183 | elif 'Yes' in results_dict.values(): |
|
| 184 | results_dict['Type'] = 'Anolyte' |
|
| 185 | return results_dict |
|
| 186 | ||
| 187 | ||
| 188 | @app.callback(Output('output_uploaded_file', 'children'), |
|