DiadFit 1.0.8__py3-none-any.whl → 1.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- DiadFit/_version.py +1 -1
- DiadFit/densimeter_fitting.py +1 -0
- DiadFit/densimeters.py +1 -1
- DiadFit/diads.py +0 -47
- DiadFit/molar_gas_proportions.py +127 -79
- {DiadFit-1.0.8.dist-info → DiadFit-1.0.9.dist-info}/METADATA +1 -1
- {DiadFit-1.0.8.dist-info → DiadFit-1.0.9.dist-info}/RECORD +9 -9
- {DiadFit-1.0.8.dist-info → DiadFit-1.0.9.dist-info}/WHEEL +0 -0
- {DiadFit-1.0.8.dist-info → DiadFit-1.0.9.dist-info}/top_level.txt +0 -0
DiadFit/_version.py
CHANGED
DiadFit/densimeter_fitting.py
CHANGED
DiadFit/densimeters.py
CHANGED
DiadFit/diads.py
CHANGED
@@ -33,54 +33,7 @@ allowed_models = ["VoigtModel", "PseudoVoigtModel", "Pearson4Model", "SkewedVoig
|
|
33
33
|
#warnings.simplefilter('error')
|
34
34
|
|
35
35
|
encode="ISO-8859-1"
|
36
|
-
## Ratio of different peaks
|
37
36
|
|
38
|
-
|
39
|
-
def calculate_SO2_CO2_ratio(SO2_area, diad1_area, diad2_area, SO2_cross_sec=5.3, diad1_cross_sec=0.89, diad2_cross_sec=1.4):
|
40
|
-
""" Calculates SO2:CO2 ratio using the parameters from Marie-Camille Caumons lab"""
|
41
|
-
|
42
|
-
|
43
|
-
A_CO2_star=( diad1_area + diad2_area)/(diad2_cross_sec+diad1_cross_sec)
|
44
|
-
A_SO2_star=(SO2_area)/(SO2_cross_sec)
|
45
|
-
Ratio=A_SO2_star/(A_SO2_star+A_CO2_star)
|
46
|
-
|
47
|
-
return Ratio
|
48
|
-
|
49
|
-
def calculate_mole_fraction_2comp(peak_area_a, peak_area_b, cross_section_a, cross_section_b, instrument_eff_a, instrument_eff_b):
|
50
|
-
""" This function calculates the molar ration of 2 components a and b based on peak areas,
|
51
|
-
cross section and instrument efficiency
|
52
|
-
|
53
|
-
Parameters
|
54
|
-
------------
|
55
|
-
|
56
|
-
peak_area_a: int, float, pd.Series, np.array
|
57
|
-
Peak area of component a
|
58
|
-
|
59
|
-
peak_area_b: int, float, pd.Series, np.array
|
60
|
-
Peak area of component b
|
61
|
-
|
62
|
-
cross_section_a, cross_section_a: int, float
|
63
|
-
Raman cross section for component a and b
|
64
|
-
|
65
|
-
instrument_eff_a, instrument_eff_b: int, float
|
66
|
-
Instrument effeciency of a and b.
|
67
|
-
|
68
|
-
Returns
|
69
|
-
------------
|
70
|
-
pd.DataFrame
|
71
|
-
Molar ratio of a/b
|
72
|
-
|
73
|
-
|
74
|
-
"""
|
75
|
-
|
76
|
-
Sum_phase_a=peak_area_a/(cross_section_a*instrument_eff_a)
|
77
|
-
Sum_phase_b=peak_area_b/(cross_section_b*instrument_eff_b)
|
78
|
-
|
79
|
-
df=pd.DataFrame(data={'% A': 100*Sum_phase_a/(Sum_phase_b+Sum_phase_a),
|
80
|
-
'% B': 100-100*Sum_phase_a/(Sum_phase_b+Sum_phase_a)}
|
81
|
-
)
|
82
|
-
|
83
|
-
return df
|
84
37
|
def plot_diad(*,path=None, filename=None, filetype='Witec_ASCII', Spectra_x=None, Spectra_y=None):
|
85
38
|
"""This function makes a plot of the spectra for a specific file to allow visual inspectoin
|
86
39
|
|
DiadFit/molar_gas_proportions.py
CHANGED
@@ -2,90 +2,95 @@ import math
|
|
2
2
|
import pandas as pd
|
3
3
|
import numpy as np
|
4
4
|
|
5
|
-
def calculate_sigma(wavelength, vi_dict, T_K):
|
6
|
-
"""
|
7
|
-
This function calculates the σ cross section according to wavelength based on Burke (2001) EQ(1), you must provide:
|
8
|
-
### 1) the peak shift of the species, 2) temp (doesn't really matter) and 3) Σ (wavelength-independent relative Raman scattering cross-sections).
|
9
|
-
"""
|
10
|
-
c = 2.998 * 10**10 # cm/s light speed
|
11
|
-
h = 6.626 * 10**-27 # erg.s Planck constant
|
12
|
-
k = 1.381 * 10**-16 # erg/K Boltzmann's constant
|
13
|
-
|
14
|
-
v0 = 1 / (wavelength * 10**-7)
|
15
|
-
|
16
|
-
sigma_results = {}
|
17
|
-
for name, vi_info in vi_dict.items():
|
18
|
-
vi = vi_info["Peak_shift_cm-1"]
|
19
|
-
BigSigma = vi_info["Σ"]
|
20
|
-
|
21
|
-
result = BigSigma / (((v0 - vi)**-4 / (v0 - 2331)**-4) * (1 - math.exp(-h * c * vi / (k * T_K))))
|
22
|
-
sigma_results[name] = round(result, 2)
|
23
|
-
|
24
|
-
return sigma_results
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
def calculate_mole_percent(components):
|
30
|
-
""" This function calculates the mole percents of the components entered, based on Burke (2001) EQ(2)
|
31
|
-
"""
|
32
|
-
def partial_molec_contribution_single(A, sigma, squiggle):
|
33
|
-
return A / (sigma * squiggle)
|
34
|
-
|
35
|
-
def partial_molec_contribution_double(A1, sigma1, A2, sigma2, squiggle):
|
36
|
-
return (A1 + A2) / ((sigma1 + sigma2) * squiggle)
|
37
|
-
|
38
|
-
total_partials = 0
|
39
|
-
partials = []
|
40
|
-
|
41
|
-
for component in components:
|
42
|
-
if component['name'] == 'CO2':
|
43
|
-
partial = partial_molec_contribution_double(component['peak_area_1'], component['cross_section_1'],
|
44
|
-
component['peak_area_2'], component['cross_section_2'],
|
45
|
-
component['efficiency'])
|
46
|
-
else:
|
47
|
-
partial = partial_molec_contribution_single(component['peak_area'], component['cross_section'],
|
48
|
-
component['efficiency'])
|
49
|
-
|
50
|
-
partials.append(partial)
|
51
|
-
total_partials += partial
|
52
|
-
|
53
|
-
mole_percentages = [round((partial / total_partials) * 100, 1) for partial in partials]
|
54
|
-
|
55
|
-
mole_percent_dict = {component['name']: mole_percent for component, mole_percent in zip(components, mole_percentages)}
|
56
|
-
mole_percent_dict['Mole_Percent_Sum'] = sum(mole_percentages)
|
57
|
-
|
58
|
-
return mole_percent_dict
|
59
|
-
|
60
|
-
|
61
|
-
|
62
5
|
|
63
|
-
def calculate_CO2_SO2_ratio(*, peak_area_SO2, peak_area_diad1, peak_area_diad2,wavelength=532.067, T_K=37+273.15,efficiency_SO2=1, efficiency_CO2=0.5, sigma_SO2=4.03, sigma_CO2_v1=0.8, sigma_CO2_v2=1.23):
|
64
6
|
|
65
|
-
# First we need to calculate the oarameters
|
66
7
|
|
67
|
-
component_dict = {
|
68
|
-
"SO2": {"Peak_shift_cm-1": 1151, "Σ": sigma_SO2},
|
69
|
-
"CO2_v1": {"Peak_shift_cm-1": 1285, "Σ": sigma_CO2_v1},
|
70
|
-
"CO2_2v2": {"Peak_shift_cm-1": 1388, "Σ": sigma_CO2_v2}}
|
71
|
-
### "Σ" is the wavelength independent relative cross-section
|
72
8
|
|
73
|
-
sigma_results = calculate_sigma(wavelength=wavelength, vi_dict=component_dict, T_K=T_K)
|
74
9
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
10
|
+
# def calculate_sigma(wavelength, vi_dict, T_K):
|
11
|
+
# """
|
12
|
+
# This function calculates the σ cross section according to wavelength based on Burke (2001) EQ(1), you must provide:
|
13
|
+
# ### 1) the peak shift of the species, 2) temp (doesn't really matter) and 3) Σ (wavelength-independent relative Raman scattering cross-sections).
|
14
|
+
# """
|
15
|
+
# c = 2.998 * 10**10 # cm/s light speed
|
16
|
+
# h = 6.626 * 10**-27 # erg.s Planck constant
|
17
|
+
# k = 1.381 * 10**-16 # erg/K Boltzmann's constant
|
18
|
+
#
|
19
|
+
# v0 = 1 / (wavelength * 10**-7)
|
20
|
+
#
|
21
|
+
# sigma_results = {}
|
22
|
+
# for name, vi_info in vi_dict.items():
|
23
|
+
# vi = vi_info["Peak_shift_cm-1"]
|
24
|
+
# BigSigma = vi_info["Σ"]
|
25
|
+
#
|
26
|
+
# result = BigSigma / (((v0 - vi)**-4 / (v0 - 2331)**-4) * (1 - math.exp(-h * c * vi / (k * T_K))))
|
27
|
+
# sigma_results[name] = round(result, 2)
|
28
|
+
#
|
29
|
+
# return sigma_results
|
30
|
+
#
|
31
|
+
#
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# def calculate_mole_percent(components):
|
35
|
+
# """ This function calculates the mole percents of the components entered, based on Burke (2001) EQ(2)
|
36
|
+
# """
|
37
|
+
# def partial_molec_contribution_single(A, sigma, squiggle):
|
38
|
+
# return A / (sigma * squiggle)
|
39
|
+
#
|
40
|
+
# def partial_molec_contribution_double(A1, sigma1, A2, sigma2, squiggle):
|
41
|
+
# return (A1 + A2) / ((sigma1 + sigma2) * squiggle)
|
42
|
+
#
|
43
|
+
# total_partials = 0
|
44
|
+
# partials = []
|
45
|
+
#
|
46
|
+
# for component in components:
|
47
|
+
# if component['name'] == 'CO2':
|
48
|
+
# partial = partial_molec_contribution_double(component['peak_area_1'], component['cross_section_1'],
|
49
|
+
# component['peak_area_2'], component['cross_section_2'],
|
50
|
+
# component['efficiency'])
|
51
|
+
# else:
|
52
|
+
# partial = partial_molec_contribution_single(component['peak_area'], component['cross_section'],
|
53
|
+
# component['efficiency'])
|
54
|
+
#
|
55
|
+
# partials.append(partial)
|
56
|
+
# total_partials += partial
|
57
|
+
#
|
58
|
+
# mole_percentages = [round((partial / total_partials) * 100, 1) for partial in partials]
|
59
|
+
#
|
60
|
+
# mole_percent_dict = {component['name']: mole_percent for component, mole_percent in zip(components, mole_percentages)}
|
61
|
+
# mole_percent_dict['Mole_Percent_Sum'] = sum(mole_percentages)
|
62
|
+
#
|
63
|
+
# return mole_percent_dict
|
64
|
+
|
65
|
+
|
66
|
+
#
|
67
|
+
#
|
68
|
+
# def calculate_CO2_SO2_ratio(*, peak_area_SO2, peak_area_diad1, peak_area_diad2,wavelength=532.067, T_K=37+273.15,efficiency_SO2=1, efficiency_CO2=0.5, sigma_SO2=4.03, sigma_CO2_v1=0.8, sigma_CO2_v2=1.23):
|
69
|
+
#
|
70
|
+
# # First we need to calculate the oarameters
|
71
|
+
#
|
72
|
+
# component_dict = {
|
73
|
+
# "SO2": {"Peak_shift_cm-1": 1151, "Σ": sigma_SO2},
|
74
|
+
# "CO2_v1": {"Peak_shift_cm-1": 1285, "Σ": sigma_CO2_v1},
|
75
|
+
# "CO2_2v2": {"Peak_shift_cm-1": 1388, "Σ": sigma_CO2_v2}}
|
76
|
+
# ### "Σ" is the wavelength independent relative cross-section
|
77
|
+
#
|
78
|
+
# sigma_results = calculate_sigma(wavelength=wavelength, vi_dict=component_dict, T_K=T_K)
|
79
|
+
#
|
80
|
+
# # Now lets allocate these calculations
|
81
|
+
# components = [
|
82
|
+
# {'name': 'SO2',
|
83
|
+
# 'peak_area': peak_area_SO2,
|
84
|
+
# 'cross_section': sigma_results['SO2'],
|
85
|
+
# 'efficiency': efficiency_SO2},
|
86
|
+
# {'name': 'CO2',
|
87
|
+
# 'peak_area_1':peak_area_diad2, 'cross_section_1': sigma_results['CO2_2v2'],
|
88
|
+
# 'peak_area_2': peak_area_diad1, 'cross_section_2': sigma_results['CO2_v1'], 'efficiency': efficiency_CO2}
|
89
|
+
# ]
|
90
|
+
# mol_perc=calculate_mole_percent(components)
|
91
|
+
#
|
92
|
+
#
|
93
|
+
# return pd.DataFrame(mol_perc)
|
89
94
|
|
90
95
|
|
91
96
|
|
@@ -180,4 +185,47 @@ def convert_cross_section_wavelength1_wavelength2(wavelength_nm_1,wavelength_nm_
|
|
180
185
|
|
181
186
|
return dep_cross_sec
|
182
187
|
|
188
|
+
def calculate_SO2_CO2_mol_prop_wave_indep(SO2_wavelength_ind, CO2_diad1_wavelength_ind, CO2_diad2_wavelength_ind, wavelength_nm, T_C,
|
189
|
+
A_SO2, A_CO2_Tot):
|
190
|
+
""" Takes wavelength independnet cross sections and CO2 and SO2 peak areas and converts them into SO2 mol proportions
|
191
|
+
Parameters
|
192
|
+
------------------
|
193
|
+
|
194
|
+
SO2_wavelength_ind: Wavelength independent cross section for SO2
|
195
|
+
|
196
|
+
CO2_diad1_wavelength_ind: Wavelength independent cross section for diad 1 (at 1285)
|
197
|
+
|
198
|
+
CO2_diad2_wavelength_ind: Wavelength independent cross section for diad 2 (at 1388)
|
199
|
+
|
200
|
+
wavelength_nm: Laser wavelenth of system in nm
|
201
|
+
|
202
|
+
T_C: Temperature of analysis in C.
|
203
|
+
|
204
|
+
Returns
|
205
|
+
---------------
|
206
|
+
|
207
|
+
SO2 mol proportion
|
208
|
+
|
209
|
+
|
210
|
+
"""
|
211
|
+
|
212
|
+
SO2_cross_sec=calculate_wavelength_dependent_cross_section(wavelength_nm=wavelength_nm, T_C=T_C, Raman_shift_cm=1151, wavelength_independent_cross_section=SO2_wavelength_ind)
|
213
|
+
CO2_diad1_xsec=calculate_wavelength_dependent_cross_section(wavelength_nm=wavelength_nm, T_C=T_C, Raman_shift_cm=1285, wavelength_independent_cross_section=CO2_diad1_wavelength_ind)
|
214
|
+
CO2_diad2_xsec=calculate_wavelength_dependent_cross_section(wavelength_nm=wavelength_nm, T_C=T_C, Raman_shift_cm=1388, wavelength_independent_cross_section=CO2_diad2_wavelength_ind)
|
215
|
+
|
216
|
+
|
217
|
+
SO2_prop=(A_SO2/SO2_cross_sec)/(A_CO2_Tot /(CO2_diad1_xsec + CO2_diad2_xsec) + (A_SO2/SO2_cross_sec) )
|
218
|
+
|
219
|
+
return SO2_prop
|
220
|
+
|
221
|
+
|
222
|
+
def calculate_SO2_CO2_ratio(SO2_area, diad1_area, diad2_area, SO2_cross_sec=5.3, diad1_cross_sec=0.89, diad2_cross_sec=1.4):
|
223
|
+
""" Calculates SO2:CO2 ratio using the parameters from Marie-Camille Caumons lab"""
|
224
|
+
|
225
|
+
|
226
|
+
A_CO2_star=( diad1_area + diad2_area)/(diad2_cross_sec+diad1_cross_sec)
|
227
|
+
A_SO2_star=(SO2_area)/(SO2_cross_sec)
|
228
|
+
Ratio=A_SO2_star/(A_SO2_star+A_CO2_star)
|
229
|
+
|
230
|
+
return Ratio
|
183
231
|
|
@@ -29,22 +29,22 @@ DiadFit/Mediumrho_polyfit_data_CCMR.pkl,sha256=U6ODSdurqS0-lynm1MG1zktg8NuhYRbrY
|
|
29
29
|
DiadFit/Mediumrho_polyfit_data_CMASS.pkl,sha256=SBy1pIdqCAF9UtB9FLNTuD0-tFyD7swwJppdE2U_FsY,1557
|
30
30
|
DiadFit/Psensor.py,sha256=C2xSlgxhUJIKIBDvUp02QaYRs5QsIqjGGRMP25ZLRZ0,10435
|
31
31
|
DiadFit/__init__.py,sha256=F-HjhCYKL_U8PfiH8tZ9DUCkxPvo6lAslJS4fyvxkbY,1148
|
32
|
-
DiadFit/_version.py,sha256=
|
32
|
+
DiadFit/_version.py,sha256=8wkWdIefAjvOQecKda3-TYv9_XiCz7EIQMvxj1kOrJA,295
|
33
33
|
DiadFit/argon_lines.py,sha256=vtzsuDdEgrAmEF9xwpejpFqKV9hKPS1JUYhIl4AfXZ0,7675
|
34
34
|
DiadFit/cosmicray_filter.py,sha256=a45x2_nmpi9Qcjc_L39UA9JOd1NMorIjtTRGnCdG3MU,23634
|
35
|
-
DiadFit/densimeter_fitting.py,sha256=
|
36
|
-
DiadFit/densimeters.py,sha256=
|
35
|
+
DiadFit/densimeter_fitting.py,sha256=AV5jWHSuIuN-e61chwMiTETa26pQo5drEGorYTkceHo,8308
|
36
|
+
DiadFit/densimeters.py,sha256=J4DnQgavhkDKOaBTQqqShepZVeH5jxJiT1FmebmLY88,55282
|
37
37
|
DiadFit/density_depth_crustal_profiles.py,sha256=Vvtw3-_xuWIYEuhuDzXstkprluXyBkUcdm9iP7qBwyQ,19754
|
38
|
-
DiadFit/diads.py,sha256=
|
38
|
+
DiadFit/diads.py,sha256=gwHWTquJeoJaBYEYjJcJct38j6Bi-GUUsFCPsFgCFzU,179483
|
39
39
|
DiadFit/error_propagation.py,sha256=ZN9EspONh_vUGxBHxxWNkYskKqFMRvJMNr2h2RXv-54,50624
|
40
40
|
DiadFit/importing_data_files.py,sha256=j7cSEPZ6iKmYnSqYEIcCl7YNdqqkCD56W-4V9T2oWOE,52010
|
41
41
|
DiadFit/lookup_table.csv,sha256=Hs1tmSQ9ArTUDv3ymEXbvnLlPBxYUP0P51dz7xAKk-Q,2946857
|
42
42
|
DiadFit/lookup_table_noneg.csv,sha256=HelvewKbBy4cqT2GAqsMo-1ps1lBYqZ-8hCJZWPGfhI,3330249
|
43
|
-
DiadFit/molar_gas_proportions.py,sha256=
|
43
|
+
DiadFit/molar_gas_proportions.py,sha256=3zc5t037L11w_hCYJqV4Xp4NwVCmGb3gMp1McAhV0TM,9315
|
44
44
|
DiadFit/ne_lines.py,sha256=KR1s33pZB_O8e3irtDLdBpepGwUjxWudjJNyHyXqfbg,63980
|
45
45
|
DiadFit/relaxfi_PW.py,sha256=vXXW9JjEBRf0UR9p-DJLx8j4Z2ePpUDweoAok-2nMJ0,32119
|
46
46
|
DiadFit/relaxifi.py,sha256=DSHAUP0tnkiMrHQgQPBK-9P3cWYmegURKzYOUgdAlos,38569
|
47
|
-
DiadFit-1.0.
|
48
|
-
DiadFit-1.0.
|
49
|
-
DiadFit-1.0.
|
50
|
-
DiadFit-1.0.
|
47
|
+
DiadFit-1.0.9.dist-info/METADATA,sha256=8cAHxsD398JkFantbqsbVF1BMvHOes3KgsTkvCBjRWE,1171
|
48
|
+
DiadFit-1.0.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
49
|
+
DiadFit-1.0.9.dist-info/top_level.txt,sha256=yZC6OFLVznaFA5kcPlFPkvhKotcVd-YO4bKxZZw3LQE,8
|
50
|
+
DiadFit-1.0.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|