This page was generated from
docs/Examples/Fitting_Fermi_Diads/Example1b_CO2_Fluid_Inclusions_nostandards/Step3_FitAll_Together.ipynb.
Interactive online version:
.
3. Fitting diads once you have groups
Once you have divided your diads into groups based on strengths, you need to tweak the fit parameters for each group
Then you can loop through all files in a given group and automatically fit the spectra
[32]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import joblib
import DiadFit as pf
pf.__version__
[32]:
'1.0.11'
Specifying filetype, and folder as before
[33]:
# This specifies what file type your Raman exported in.
meta_path, spectra_path, spectra_filetype, prefix, str_prefix, spectra_file_ext, meta_file_ext, TruPower=pf.get_settings()
Load in data and fit parameters
This loads in the dataframes of the fit parameters you saved in the other file, by group
At this point you select what group you want to fit (batch = ‘Weak’, ‘Medium’ or ‘Strong’). After running through the entire notebook for one group, come back up here to fit a second group.
[34]:
## load dataframes and numpy arrays
np_x = joblib.load('np_x.sav')
# Select the group you want to fit ('Weak', 'Medium', 'Strong'). After selecting one, go through and select another one and run again from here.
batch='Medium'
if batch=='Weak':
GroupN_df=joblib.load('Weak_df.sav')
if batch=='Medium':
GroupN_df=joblib.load('Medium_df.sav')
if batch=='Strong':
GroupN_df=joblib.load('Strong_df.sav')
Now load one file from this group to tweak parameters for
[35]:
Diad_Files =GroupN_df['filename']
i=0
Lets plot the diad to have a look at it
[36]:
plot1=pf.plot_diad(path=spectra_path, filename=Diad_Files[i], filetype=spectra_filetype)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File c:\Users\penny\anaconda3\Lib\site-packages\pandas\core\indexes\range.py:414, in RangeIndex.get_loc(self, key)
413 try:
--> 414 return self._range.index(new_key)
415 except ValueError as err:
ValueError: 0 is not in range
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
Cell In[36], line 1
----> 1 plot1=pf.plot_diad(path=spectra_path, filename=Diad_Files[i], filetype=spectra_filetype)
File c:\Users\penny\anaconda3\Lib\site-packages\pandas\core\series.py:1040, in Series.__getitem__(self, key)
1037 return self._values[key]
1039 elif key_is_scalar:
-> 1040 return self._get_value(key)
1042 # Convert generator to list before going through hashable part
1043 # (We will iterate through the generator there to check for slices)
1044 if is_iterator(key):
File c:\Users\penny\anaconda3\Lib\site-packages\pandas\core\series.py:1156, in Series._get_value(self, label, takeable)
1153 return self._values[label]
1155 # Similar to Index.get_value, but we do not fall back to positional
-> 1156 loc = self.index.get_loc(label)
1158 if is_integer(loc):
1159 return self._values[loc]
File c:\Users\penny\anaconda3\Lib\site-packages\pandas\core\indexes\range.py:416, in RangeIndex.get_loc(self, key)
414 return self._range.index(new_key)
415 except ValueError as err:
--> 416 raise KeyError(key) from err
417 if isinstance(key, Hashable):
418 raise KeyError(key)
KeyError: 0
Now lets inspect the diads and get their approximate positions
As with generic peak, you can exclude 2 segments (e.g. around cosmic rays)
You then specify how many peaks you want to fit on each diad. 1 means just the strong peak, 2 hotbands, and 3 for Diad2 would also fit the C13 peak if present.
The identify_diad_peaks then uses scipy findpeaks to identify the positions of the 2 diads, and any other peaks the user asks for. These are saved, and fed into the later functions for peak fitting.
Choose a model for fitting all peaks
Option of Voigt or PseudoVoigt. We recomend PsuedoVoigt
[ ]:
model_name='PseudoVoigtModel'
Fit Diad 1
Tweak the parameters in the config files for each group. E.g. how many peaks (fit_peaks), the background positions, the sigma of the diad, and whether or not you want a gaussian background
[ ]:
diad_id_config=pf.diad_id_config(height=50, exclude_range1=[1308, 1309])
diad_id_config
if batch=='Weak':
diad1_fit_config_init=pf.diad1_fit_config(
model_name=model_name, fit_peaks=2,
N_poly_bck_diad1=1, lower_bck_diad1=(1180, 1250),
upper_bck_diad1=(1300, 1350),
diad_sigma=0.6,
x_range_residual=10, x_range_baseline=30,
y_range_baseline=100,
HB_prom=GroupN_df['HB1_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad1_abs_prom'].iloc[i])
diad1_fit_config_init
if batch=='Medium':
diad1_fit_config_init=pf.diad1_fit_config(
model_name=model_name, fit_peaks=2,
N_poly_bck_diad1=2, lower_bck_diad1=(1180, 1240),
upper_bck_diad1=(1315, 1350),
diad_sigma=0.6,
x_range_residual=10, x_range_baseline=30,
y_range_baseline=100,
HB_prom=GroupN_df['HB1_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad1_abs_prom'].iloc[i])
diad1_fit_config_init
if batch=='Strong':
diad1_fit_config_init=pf.diad1_fit_config(
fit_gauss=True, gauss_amp= 2*GroupN_df['HB1_abs_prom'].iloc[i],
model_name=model_name, fit_peaks=2,
N_poly_bck_diad1=1, lower_bck_diad1=(1180, 1220),
upper_bck_diad1=(1330, 1350),
diad_sigma=0.6,
x_range_residual=10, x_range_baseline=30,
y_range_baseline=1000,
HB_prom=GroupN_df['HB1_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad1_abs_prom'].iloc[i])
diad1_fit_config_init
diad1_fit_config(model_name='PseudoVoigtModel', fit_peaks=2, N_poly_bck_diad1=1, lower_bck_diad1=(1180, 1250), upper_bck_diad1=(1300, 1350), fit_gauss=False, gauss_amp=109.00067140175202, diad_sigma=0.6, diad_sigma_min_allowance=0.2, diad_sigma_max_allowance=5, diad_prom=474.5148505798213, HB_prom=54.50033570087601, x_range_baseline=30, y_range_baseline=100, dpi=200, x_range_residual=10, return_other_params=False)
See what these fit parameters look like for diad1
[ ]:
Diad1_fit=pf.fit_diad_1_w_bck(config1=diad1_fit_config_init,
config2=diad_id_config,
path=spectra_path, filename=Diad_Files.iloc[0],
filetype=spectra_filetype, plot_figure=True, close_figure=False,
Diad_pos=GroupN_df['Diad1_pos'].iloc[i],
HB_pos=GroupN_df['HB1_pos'].iloc[i])
Diad1_fit
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
| Diad1_Combofit_Cent | Diad1_Voigt_Cent | Diad1_cent_err | Diad1_Voigt_Area | Diad1_Voigt_Sigma | Diad1_Voigt_Gamma | HB1_Cent | HB1_Area | HB1_Sigma | Diad1_Combofit_Height | Diad1_Residual | Diad1_Prop_Lor | Diad1_fwhm | Diad1_refit | Diad1_Asym50 | Diad1_Asym70 | Diad1_Yuan2017_sym_factor | Diad1_Remigi2021_BSF | Diad1_PDF_Model | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1285.529855 | 1285.529905 | 0.003216 | 2180.496297 | 0.585753 | 0 | 1265.382416 | 267.962962 | 0.908504 | 1366.808811 | 6.004039 | 0.677638 | 1.171505 | Flagged Warnings: | 1.164134 | 1.152174 | 0.192284 | 0.000857 | PseudoVoigtModel |
Update the sigma
The sigma parameter varies quite a lot based on the splitting. Best to update your first guess with what you found for the example file above
[ ]:
diad1_fit_config2=diad1_fit_config_init
Fit diad2
[ ]:
if batch=='Weak':
diad2_fit_config_init=pf.diad2_fit_config(model_name=model_name,
fit_peaks=2, upper_bck_diad2=(1430, 1480),
lower_bck_diad2=(1310, 1360), diad_sigma=0.4, N_poly_bck_diad2=2,
x_range_residual=30, y_range_baseline=100,
x_range_baseline=30,
HB_prom=GroupN_df['HB2_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad2_abs_prom'].iloc[i])
diad2_fit_config_init
if batch=='Medium':
diad2_fit_config_init=pf.diad2_fit_config(model_name=model_name,
fit_peaks=3, fit_gauss=True, gauss_amp= 2*GroupN_df['HB2_abs_prom'].iloc[i],
lower_bck_diad2=(1310, 1350), diad_sigma=1, N_poly_bck_diad2=2,
x_range_residual=30, y_range_baseline=100,
x_range_baseline=30,
HB_prom=GroupN_df['HB2_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad2_abs_prom'].iloc[i],
C13_prom=GroupN_df['C13_abs_prom'].iloc[i])
diad2_fit_config_init
if batch=='Strong':
diad2_fit_config_init=pf.diad2_fit_config(model_name=model_name,
fit_peaks=3, fit_gauss=True, gauss_amp= 2*GroupN_df['HB2_abs_prom'].iloc[i],
lower_bck_diad2=(1310, 1340), diad_sigma=1, N_poly_bck_diad2=2,
x_range_residual=30, y_range_baseline=1000,
x_range_baseline=30,
HB_prom=GroupN_df['HB2_abs_prom'].iloc[i],
diad_prom=GroupN_df['Diad2_abs_prom'].iloc[i],
C13_prom=GroupN_df['C13_abs_prom'].iloc[i])
diad2_fit_config_init
diad2_fit_config_init
diad2_fit_config(model_name='PseudoVoigtModel', fit_peaks=2, N_poly_bck_diad2=2, lower_bck_diad2=(1310, 1360), upper_bck_diad2=(1430, 1480), fit_gauss=False, gauss_amp=179.50251817275284, diad_sigma=0.4, diad_sigma_min_allowance=0.2, diad_sigma_max_allowance=5, diad_prom=850.4549213109165, HB_prom=89.75125908637642, C13_prom=nan, x_range_baseline=30, y_range_baseline=100, plot_figure=True, dpi=200, x_range_residual=30, return_other_params=False)
See what these fit parameters look like for diad2
[ ]:
Diad2_fit=pf.fit_diad_2_w_bck(config1=diad2_fit_config_init,
config2=diad_id_config,
path=spectra_path, filename=Diad_Files[i], filetype=spectra_filetype,
plot_figure=True, close_figure=False,
Diad_pos=GroupN_df['Diad2_pos'].iloc[i],
HB_pos=GroupN_df['HB2_pos'].iloc[i],
C13_pos=GroupN_df['C13_pos'].iloc[i])
Diad2_fit.to_clipboard(excel=True)
Diad2_fit
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
| Diad2_Combofit_Cent | Diad2_Voigt_Cent | Diad2_cent_err | Diad2_Voigt_Area | Diad2_Voigt_Sigma | Diad2_Voigt_Gamma | HB2_Cent | HB2_Area | HB2_Sigma | Diad2_Combofit_Height | Diad2_Residual | Diad2_Prop_Lor | Diad2_fwhm | Diad2_refit | Diad2_Asym50 | Diad2_Asym70 | Diad2_Yuan2017_sym_factor | Diad2_Remigi2021_BSF | Diad2_PDF_Model | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1388.851553 | 1388.851503 | 0.001378 | 3187.505319 | 0.508942 | 0 | 1410.162754 | 310.06587 | 0.660574 | 2432.162955 | 5.184157 | 0.53758 | 1.017884 | Flagged Warnings: | 1.100917 | 1.1 | 0.102722 | 0.000419 | PseudoVoigtModel |
Loop over all the files in the group
This will loop over all the
[ ]:
from tqdm import tqdm
plot_figure=True# If False, Means doesnt have to make figures, lot faster.
close_figure=False # If True, wont show figures in notebook, but will still save them in a folder
Diad_Files_i=Diad_Files
df_Merge = pd.DataFrame([])
for i in tqdm(range(0, len(Diad_Files))): #
tqdm.write(f"Processing file: {Diad_Files[i]}")
# For diad1, config file like you had in the previous.
# Only really used to exclude a range (say your spectra has a known spec)
diad_id_config=pf.diad_id_config(exclude_range1=[1308, 1309])
# Here, the prominence are taken from the fitting in the last notebook
diad1_fit_config2.HB_prom=GroupN_df['HB1_abs_prom'].iloc[i]
diad1_fit_config2.diad_prom=GroupN_df['Diad1_abs_prom'].iloc[i]
diad1_fit_config2.gauss_amp=2*GroupN_df['HB1_abs_prom'].iloc[i]
Diad1_fit=pf.fit_diad_1_w_bck(config1=diad1_fit_config2,
config2=diad_id_config, path=spectra_path, filename=GroupN_df['filename'].iloc[i],
filetype=spectra_filetype, plot_figure=plot_figure, close_figure=close_figure,
Diad_pos=GroupN_df['Diad1_pos'].iloc[i],
HB_pos=GroupN_df['HB1_pos'].iloc[i])
## Same for diad2, just also has a C13 peak
diad2_fit_config_init.HB_prom=GroupN_df['HB2_abs_prom'].iloc[i]
diad2_fit_config_init.diad_prom=GroupN_df['Diad2_abs_prom'].iloc[i]
diad2_fit_config_init.gauss_amp= 2*GroupN_df['HB2_abs_prom'].iloc[i]
diad2_fit_config_init.C13_prom=GroupN_df['C13_abs_prom'].iloc[i]
Diad2_fit=pf.fit_diad_2_w_bck(config1=diad2_fit_config_init,
config2=diad_id_config,
path=spectra_path, filename=GroupN_df['filename'].iloc[i],
filetype=spectra_filetype,
plot_figure=plot_figure, close_figure=close_figure,
Diad_pos=GroupN_df['Diad2_pos'].iloc[i],
HB_pos=GroupN_df['HB2_pos'].iloc[i],
C13_pos=GroupN_df['C13_pos'].iloc[i])
# This combines the outputs into a single dataframe
data=pf.combine_diad_outputs(filename=GroupN_df['filename'].iloc[i], prefix=prefix,
Diad1_fit=Diad1_fit, path=spectra_path,
Diad2_fit=Diad2_fit)
df_Merge = pd.concat([df_Merge, data], axis=0).reset_index(drop=True)
0%| | 0/16 [00:00<?, ?it/s]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 02 K23_10_FIA_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
6%|▋ | 1/16 [00:02<00:31, 2.11s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 05 K23_1_FIA_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
12%|█▎ | 2/16 [00:04<00:31, 2.22s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 06 K23_1_FIA_50X_r2_longeraq.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
19%|█▉ | 3/16 [00:06<00:28, 2.19s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 08 K23_2_FIA_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
25%|██▌ | 4/16 [00:08<00:24, 2.05s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 09 K23_2_FIB_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
31%|███▏ | 5/16 [00:10<00:23, 2.12s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 11 K23_2_FIC_50X_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
38%|███▊ | 6/16 [00:12<00:21, 2.20s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 13 K23_4_FIA_50X_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
44%|████▍ | 7/16 [00:15<00:20, 2.29s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 14 K23_4_FIB_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
50%|█████ | 8/16 [00:17<00:17, 2.18s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 16 K23_6_FIA_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
56%|█████▋ | 9/16 [00:19<00:14, 2.13s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 17 K23_7_FIA_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
62%|██████▎ | 10/16 [00:21<00:12, 2.15s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
c:\users\penny\box\berkeley_new\diadfit_outer\src\DiadFit\diads.py:3173: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
fig,axes=plt.subplot_mosaic(mosaic=figure_mosaic, figsize=(12, 16))
Processing file: 19 K23_7_FIB_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
69%|██████▉ | 11/16 [00:23<00:10, 2.15s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 20 K23_7_FIC_50X_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
75%|███████▌ | 12/16 [00:25<00:08, 2.16s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 21 K23_9_FIA_50X_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
81%|████████▏ | 13/16 [00:28<00:06, 2.21s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 23 K23_101_FID_50X.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
88%|████████▊ | 14/16 [00:30<00:04, 2.17s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 24 K23_101_FIC_50X_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
94%|█████████▍| 15/16 [00:32<00:02, 2.18s/it]c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
Processing file: 26 K23_102_FIA_CRR_DiadFit.txt
c:\Users\penny\anaconda3\Lib\site-packages\uncertainties\core.py:1024: UserWarning: Using UFloat objects with std_dev==0 may give unexpected results.
warn("Using UFloat objects with std_dev==0 may give unexpected results.")
100%|██████████| 16/16 [00:34<00:00, 2.16s/it]
[ ]:
# Save parameters to excel
combo=df_Merge
if batch=='Weak':
combo.to_excel('Weak_Diads.xlsx', index=False)
if batch=='Medium':
combo.to_excel('Medium_Diads.xlsx', index=False)
if batch=='Strong':
combo.to_excel('Strong_Diads.xlsx', index=False)
[ ]:
combo
| filename | Splitting | Split_σ | Diad1_Combofit_Cent | Diad1_cent_err | Diad1_Combofit_Height | Diad1_Voigt_Cent | Diad1_Voigt_Area | Diad1_Voigt_Sigma | Diad1_Residual | ... | Diad1_Asym50 | Diad1_Asym70 | Diad1_Yuan2017_sym_factor | Diad1_Remigi2021_BSF | Diad2_Asym50 | Diad2_Asym70 | Diad2_Yuan2017_sym_factor | Diad2_Remigi2021_BSF | Diad1_PDF_Model | Diad2_PDF_Model | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | K23_10_FIA_50X | 103.321597 | 0.003499 | 1285.529855 | 0.003217 | 1366.809244 | 1285.529905 | 2180.498743 | 0.585752 | 6.004058 | ... | 1.164134 | 1.152174 | 0.192283 | 0.000857 | 1.100917 | 1.100000 | 0.102722 | 0.000419 | PseudoVoigtModel | PseudoVoigtModel |
| 1 | K23_1_FIA_50X | 103.356973 | 0.002187 | 1285.483474 | 0.001945 | 1293.306052 | 1285.483524 | 2058.897395 | 0.590886 | 3.925973 | ... | 1.181009 | 1.146552 | 0.213911 | 0.000914 | 1.081081 | 1.081776 | 0.082790 | 0.000456 | PseudoVoigtModel | PseudoVoigtModel |
| 2 | K23_1_FIA_50X_r2_longeraq | 103.348095 | 0.001765 | 1285.494438 | 0.001549 | 1856.198327 | 1285.494488 | 2970.509854 | 0.593064 | 4.691197 | ... | 1.198198 | 1.185185 | 0.235088 | 0.000639 | 1.065476 | 1.067130 | 0.067219 | 0.000313 | PseudoVoigtModel | PseudoVoigtModel |
| 3 | K23_2_FIA_50X | 103.002895 | 0.032729 | 1286.359276 | 0.029280 | 46.398468 | 1286.359276 | 46.479846 | 0.470542 | 1.839154 | ... | 1.195035 | 1.201117 | 0.183545 | 0.020283 | 1.034483 | 1.038889 | 0.024799 | 0.009029 | PseudoVoigtModel | PseudoVoigtModel |
| 4 | K23_2_FIB_50X | 103.155017 | 0.003336 | 1285.990417 | 0.002897 | 631.307044 | 1285.990467 | 772.581801 | 0.482237 | 2.542673 | ... | 1.252632 | 1.266846 | 0.243657 | 0.001528 | 1.095057 | 1.122507 | 0.086871 | 0.000889 | PseudoVoigtModel | PseudoVoigtModel |
| 5 | K23_2_FIC_50X_CRR_DiadFit | 103.173879 | 0.004489 | 1285.955244 | 0.003842 | 415.352280 | 1285.955294 | 534.626712 | 0.500169 | 2.188067 | ... | 1.201954 | 1.201511 | 0.202023 | 0.002408 | 1.067164 | 1.088643 | 0.062340 | 0.001366 | PseudoVoigtModel | PseudoVoigtModel |
| 6 | K23_4_FIA_50X_CRR_DiadFit | 103.088333 | 0.007128 | 1286.164408 | 0.006422 | 235.281363 | 1286.164408 | 270.139927 | 0.470993 | 2.064432 | ... | 1.003597 | 1.002646 | 0.003388 | 0.004004 | 1.251938 | 1.283988 | 0.216219 | 0.002122 | PseudoVoigtModel | PseudoVoigtModel |
| 7 | K23_4_FIB_50X | 103.317142 | 0.006796 | 1285.613554 | 0.006367 | 323.939932 | 1285.613554 | 493.501140 | 0.583201 | 2.592087 | ... | 1.017595 | 1.027311 | 0.020523 | 0.003601 | 1.221477 | 1.221374 | 0.227294 | 0.001836 | PseudoVoigtModel | PseudoVoigtModel |
| 8 | K23_6_FIA_50X | 103.330394 | 0.001511 | 1285.568831 | 0.001256 | 1945.508075 | 1285.568881 | 3042.258120 | 0.593421 | 3.704510 | ... | 1.094675 | 1.095541 | 0.112364 | 0.000610 | 1.197411 | 1.190123 | 0.202929 | 0.000301 | PseudoVoigtModel | PseudoVoigtModel |
| 9 | K23_7_FIA_50X | 103.295747 | 0.001836 | 1285.608748 | 0.001590 | 1678.154313 | 1285.608798 | 2690.727819 | 0.601835 | 3.798008 | ... | 1.025568 | 1.053388 | 0.030776 | 0.000717 | 1.203226 | 1.193627 | 0.212047 | 0.000354 | PseudoVoigtModel | PseudoVoigtModel |
| 10 | K23_7_FIB_50X | 103.290061 | 0.003012 | 1285.637988 | 0.002670 | 620.692594 | 1285.638038 | 964.546548 | 0.592075 | 2.421211 | ... | 1.026087 | 1.008197 | 0.030891 | 0.001908 | 1.223333 | 1.218593 | 0.231008 | 0.000951 | PseudoVoigtModel | PseudoVoigtModel |
| 11 | K23_7_FIC_50X_CRR_DiadFit | 103.283458 | 0.003529 | 1285.637301 | 0.003122 | 468.969784 | 1285.637351 | 724.451250 | 0.599128 | 1.889209 | ... | 1.022923 | 1.010183 | 0.027467 | 0.002555 | 1.217822 | 1.212500 | 0.224489 | 0.001258 | PseudoVoigtModel | PseudoVoigtModel |
| 12 | K23_9_FIA_50X_CRR_DiadFit | 103.209512 | 0.007090 | 1285.903623 | 0.006109 | 331.771359 | 1285.903673 | 447.489952 | 0.542970 | 2.547700 | ... | 1.025714 | 1.033482 | 0.027924 | 0.003273 | 1.038732 | 1.035990 | 0.037855 | 0.001748 | PseudoVoigtModel | PseudoVoigtModel |
| 13 | K23_101_FID_50X | 103.252086 | 0.008551 | 1285.820393 | 0.007370 | 667.990801 | 1285.820443 | 936.640321 | 0.568180 | 6.244209 | ... | 1.101744 | 1.068132 | 0.115618 | 0.001701 | 1.030928 | 1.047619 | 0.030919 | 0.000919 | PseudoVoigtModel | PseudoVoigtModel |
| 14 | K23_101_FIC_50X_CRR_DiadFit | 103.216762 | 0.017266 | 1285.894349 | 0.014398 | 406.317976 | 1285.894399 | 568.099861 | 0.560155 | 8.591087 | ... | 1.016575 | 1.008529 | 0.018569 | 0.002757 | 1.034965 | 1.043702 | 0.034058 | 0.001524 | PseudoVoigtModel | PseudoVoigtModel |
| 15 | K23_102_FIA_CRR_DiadFit | 103.284520 | 0.006011 | 1285.692317 | 0.005445 | 477.395157 | 1285.692367 | 795.862299 | 0.670134 | 3.378070 | ... | 1.007463 | 1.070611 | 0.010002 | 0.002807 | 1.195286 | 1.207500 | 0.205012 | 0.001203 | PseudoVoigtModel | PseudoVoigtModel |
16 rows × 49 columns
This plays a sound when the notebook is done if you have a tendency to procrastinate
[ ]:
# !pip install winotify
from winotify import Notification, audio
toast= Notification(app_id="VSCode",title="Notebook completed",
msg="Step3b_Secondary_Peaks is done!",
duration="short")
toast.set_audio(audio.Mail,loop=False)
toast.show()