DiadFit 0.0.81__tar.gz → 0.0.83__tar.gz
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-0.0.81 → DiadFit-0.0.83}/PKG-INFO +1 -1
- {DiadFit-0.0.81 → DiadFit-0.0.83}/setup.py +2 -2
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/CO2_EOS.py +17 -10
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/CO2_H2O_EOS.py +110 -26
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/_version.py +1 -1
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/cosmicray_filter.py +2 -1
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/densimeters.py +36 -7
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/diads.py +228 -160
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/error_propagation.py +243 -107
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/importing_data_files.py +17 -11
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/ne_lines.py +471 -440
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit.egg-info/PKG-INFO +1 -1
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit.egg-info/requires.txt +2 -2
- {DiadFit-0.0.81 → DiadFit-0.0.83}/README.md +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/setup.cfg +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/CO2_in_bubble_error.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/H2O_fitting.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_data.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_dataUCB_1117_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_dataUCB_1220_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_dataUCB_1220_1447.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_data_CCMR.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Highrho_polyfit_data_CMASS.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_data.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_dataUCB_1117_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_dataUCB_1220_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_dataUCB_1220_1447.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_data_CCMR.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Lowrho_polyfit_data_CMASS.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_data.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_dataUCB_1117_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_dataUCB_1220_1400.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_dataUCB_1220_1447.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_data_CCMR.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Mediumrho_polyfit_data_CMASS.pkl +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/Psensor.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/__init__.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/argon_lines.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/densimeter_fitting.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/density_depth_crustal_profiles.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/molar_gas_proportions.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit/relaxifi.py +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit.egg-info/SOURCES.txt +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit.egg-info/dependency_links.txt +0 -0
- {DiadFit-0.0.81 → DiadFit-0.0.83}/src/DiadFit.egg-info/top_level.txt +0 -0
@@ -19,7 +19,7 @@ DiadFit_dir=Path(__file__).parent
|
|
19
19
|
|
20
20
|
def calculate_CO2_density_homog_T(T_h_C, EOS='SW96', Sample_ID=None, homog_to=None, set_to_critical=False):
|
21
21
|
""" Calculates CO2 density for a specified homogenization temperature in Celcius
|
22
|
-
using the Span and Wanger (1996) equation of state.
|
22
|
+
using eq 3.14 and 3.15 from the Span and Wanger (1996) equation of state.
|
23
23
|
|
24
24
|
Parameters
|
25
25
|
--------------
|
@@ -52,18 +52,28 @@ def calculate_CO2_density_homog_T(T_h_C, EOS='SW96', Sample_ID=None, homog_to=No
|
|
52
52
|
else:
|
53
53
|
raise TypeError('unsupported input for homog_to, has to be L or V')
|
54
54
|
|
55
|
+
|
56
|
+
# IF its a float or integer, just tell people outright
|
55
57
|
if isinstance(T_h_C, float) or isinstance(T_h_C, int):
|
56
58
|
if T_h_C>=30.9782: # 29.878:
|
57
59
|
#print('Sorry, algorithm cant converge for Ts above 29.878')
|
58
|
-
raise TypeError('Sorry, algorithm cant converge for
|
60
|
+
raise TypeError('Sorry, algorithm cant converge for T_h_C above 30.9782')
|
61
|
+
|
62
|
+
# If its a panda series, set critical is false, raise a type error
|
59
63
|
if isinstance(T_h_C, pd.Series) or isinstance(T_h_C, np.ndarray):
|
60
|
-
|
64
|
+
|
65
|
+
if any(T_h_C>=30.9782) and set_to_critical is False:
|
61
66
|
raise TypeError('Sorry, algorithm cant converge for Ts above 30.9782. You can put set_to_critical=True and this T_ will be replacd with 30.9782')
|
62
|
-
elif any(T_h_C
|
67
|
+
elif any(T_h_C>=30.9782) and set_to_critical is True:
|
68
|
+
print('found some with too high temps, are setting to 30.9782C - the max homog T ')
|
63
69
|
if isinstance(T_h_C, pd.Series):
|
64
70
|
T_h_C = np.where(T_h_C > 30.9782, 30.9782, T_h_C)
|
65
71
|
elif isinstance(T_h_C, np.ndarray):
|
72
|
+
|
66
73
|
T_h_C[T_h_C > 30.9782] = 30.9782
|
74
|
+
print('got into this loop')
|
75
|
+
|
76
|
+
|
67
77
|
|
68
78
|
|
69
79
|
if EOS!='SW96':
|
@@ -72,7 +82,10 @@ def calculate_CO2_density_homog_T(T_h_C, EOS='SW96', Sample_ID=None, homog_to=No
|
|
72
82
|
T_K_hom=T_h_C+273.15
|
73
83
|
TempTerm=1-T_K_hom/304.1282
|
74
84
|
# This is equation 3.14 from Span and Wanger (1996)
|
85
|
+
|
86
|
+
|
75
87
|
Liq_density=(np.exp(1.9245108*TempTerm**0.34-0.62385555*TempTerm**0.5-0.32731127*TempTerm**1.6666667+0.39245142*TempTerm**1.8333333)*0.4676)
|
88
|
+
|
76
89
|
# This is equation 3.15 from Span and Wanger (1996)
|
77
90
|
gas_density=(np.exp(-1.7074879*TempTerm**0.34-0.8227467*TempTerm**0.5-4.6008549*TempTerm**1-10.111178*TempTerm**2.333333-29.742252*TempTerm**4.6666667)*0.4676)
|
78
91
|
|
@@ -473,12 +486,6 @@ def calculate_P_for_rho_T_SW96(CO2_dens_gcm3, T_K):
|
|
473
486
|
except ImportError:
|
474
487
|
raise RuntimeError('You havent installed CoolProp, which is required to convert FI densities to pressures. If you have python through conda, run conda install -c conda-forge coolprop in your command line')
|
475
488
|
|
476
|
-
try:
|
477
|
-
import CoolProp.CoolProp as cp
|
478
|
-
except ImportError:
|
479
|
-
raise RuntimeError('You havent installed CoolProp, which is required to convert FI densities to pressures. If you have python through conda, run conda install -c conda-forge coolprop in your command line')
|
480
|
-
|
481
|
-
|
482
489
|
|
483
490
|
P_kbar=cp.PropsSI('P', 'D', Density_kgm3, 'T', T_K, 'CO2')/10**8
|
484
491
|
if isinstance(P_kbar, float):
|
@@ -1022,7 +1022,7 @@ def calc_prop_knownP_EOS_DZ2006(*, P_kbar=1, T_K=1200, XH2O=1):
|
|
1022
1022
|
|
1023
1023
|
|
1024
1024
|
|
1025
|
-
def calculate_entrapment_P_XH2O(*, XH2O, CO2_dens_gcm3, T_K):
|
1025
|
+
def calculate_entrapment_P_XH2O(*, XH2O, CO2_dens_gcm3, T_K, T_K_ambient=37+273.15, fast_calcs=False, Hloss=True):
|
1026
1026
|
"""" This function calculates pressure for a measured CO$_2$ density, temperature and estimate of initial XH2O.
|
1027
1027
|
It first corrects the density to obtain a bulk density for a CO2-H2O mix, assuming that H2O was lost from the inclusion.
|
1028
1028
|
correcting for XH2O. It assumes that H2O has been lost from the inclusion (see Hansteen and Klugel, 2008 for method). It also calculates using other
|
@@ -1037,47 +1037,131 @@ def calculate_entrapment_P_XH2O(*, XH2O, CO2_dens_gcm3, T_K):
|
|
1037
1037
|
Measured CO2 density in g/cm3
|
1038
1038
|
|
1039
1039
|
T_K: float, pd.Series
|
1040
|
-
Temperature in Kelvin
|
1040
|
+
Temperature in Kelvin fluid was trapped at
|
1041
|
+
|
1042
|
+
T_K_ambient: pd.Series
|
1043
|
+
Temperature in Kelvin Raman measurement was made at.
|
1044
|
+
|
1045
|
+
fast_calcs: bool (default False)
|
1046
|
+
If True, only performs one EOS calc for DZ06, not 4 (with water, without water, SP94 and SW96).
|
1047
|
+
also specify H2Oloss=True or False
|
1048
|
+
|
1049
|
+
|
1041
1050
|
|
1042
1051
|
Returns
|
1043
1052
|
-----------------------------
|
1053
|
+
if fast_calcs is False:
|
1044
1054
|
pd.DataFrame:
|
1045
1055
|
Columns showing:
|
1046
1056
|
P_kbar_pureCO2_SW96: Pressure calculated for the measured CO$_2$ density using the pure CO2 EOS from Span and Wanger (1996)
|
1047
1057
|
P_kbar_pureCO2_SP94: Pressure calculated for the measured CO$_2$ density using the pure CO2 EOS from Sterner and Pitzer (1994)
|
1048
1058
|
P_kbar_pureCO2_DZ06: Pressure calculated from the measured CO$_2$ density using the pure CO2 EOs from Duan and Zhang (2006)
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1059
|
+
P_kbar_mixCO2_DZ06_Hloss: Pressure calculated from the reconstructed mixed fluid density using the mixed EOS from Duan and Zhang (2006) assuming H loss
|
1060
|
+
P_kbar_mixCO2_DZ06_noHloss: Pressure calculated from the reconstructed mixed fluid density using the mixed EOS from Duan and Zhang (2006) assuming H loss
|
1061
|
+
P Mix_Hloss/P Pure DZ06: Correction factor - e.g. how much deeper the pressure is from the mixed EOS with H loss
|
1062
|
+
P Mix_noHloss/P Pure DZ06: Correction factor - e.g. how much deeper the pressure is from the mixed EOS with H loss
|
1063
|
+
rho_mix_calc_noHloss: Bulk density calculated (C+H)
|
1064
|
+
rho_mix_calc_Hloss: Bulk density calculated (C+H) after h loss
|
1052
1065
|
CO2_dens_gcm3: Input CO2 density
|
1053
1066
|
T_K: input temperature
|
1054
1067
|
XH2O: input molar fraction of H2O
|
1055
1068
|
|
1069
|
+
if fast_calcs is True:
|
1070
|
+
P_kbar_mixCO2_DZ06: Pressure calculated from the reconstructed mixed fluid density using the mixed EOS from Duan and Zhang (2006)
|
1071
|
+
|
1072
|
+
|
1073
|
+
|
1056
1074
|
"""
|
1057
1075
|
XH2O, rho_meas, T_K=ensure_series(a=XH2O, b=CO2_dens_gcm3, c=T_K)
|
1058
1076
|
alpha=XH2O/(1-XH2O)
|
1059
|
-
#
|
1060
|
-
|
1061
|
-
#
|
1062
|
-
P_SW=calculate_P_for_rho_T(T_K=T_K, CO2_dens_gcm3=rho_meas, EOS='SW96')
|
1063
|
-
P_SP=calculate_P_for_rho_T(T_K=T_K, CO2_dens_gcm3=rho_meas, EOS='SP94')
|
1064
|
-
# Same for DZ2006
|
1065
|
-
P_DZ=calculate_Pressure_DZ2006(density=rho_meas, T_K=T_K, XH2O=XH2O*0)
|
1066
|
-
# Now doing it with XH2O
|
1067
|
-
P_DZ_mix=calculate_Pressure_DZ2006(density=rho_orig, T_K=T_K, XH2O=XH2O)
|
1068
|
-
|
1069
|
-
df=pd.DataFrame(data={
|
1070
|
-
'P_kbar_pureCO2_SW96': P_SW['P_kbar'],
|
1071
|
-
'P_kbar_pureCO2_SP94': P_SW['P_kbar'],
|
1072
|
-
'P_kbar_pureCO2_DZ06': P_DZ/1000,
|
1073
|
-
'P_kbar_mixCO2_DZ06': P_DZ_mix/1000,
|
1074
|
-
'P Mix/P Pure DZ06': P_DZ_mix/P_DZ,
|
1075
|
-
'rho_mix_calc': rho_orig,
|
1076
|
-
'CO2_dens_gcm3': rho_meas,
|
1077
|
-
'T_K': T_K,
|
1078
|
-
'XH2O': XH2O})
|
1077
|
+
# IF water is lost
|
1078
|
+
rho_orig_H_loss=rho_meas*(1+alpha*(18/44))
|
1079
|
+
# IF water isnt lost
|
1079
1080
|
|
1080
|
-
|
1081
|
+
# Calculate mass ratio from molar ratio
|
1082
|
+
mass_ratio=(XH2O*18)/((1-XH2O)*44)
|
1083
|
+
# Calculate pressure in CO2 fluid
|
1084
|
+
P=calculate_P_for_rho_T_SW96(CO2_dens_gcm3, T_K_ambient)
|
1085
|
+
# Now calculate density of H2O fluid
|
1086
|
+
|
1087
|
+
# Calculate density of H2O
|
1088
|
+
rho_H2O=calculate_rho_for_P_T_H2O(P['P_kbar'], T_K_ambient)
|
1089
|
+
|
1090
|
+
|
1091
|
+
|
1092
|
+
# Assume a system of unit 1. Calculate volume of CO2
|
1093
|
+
VolCO2=(1-mass_ratio)/CO2_dens_gcm3
|
1094
|
+
VolH2O=mass_ratio/rho_H2O
|
1095
|
+
rho_orig_no_H_loss=1/(VolH2O+VolCO2)
|
1096
|
+
|
1097
|
+
if fast_calcs is True:
|
1098
|
+
if Hloss is True:
|
1099
|
+
P=calculate_Pressure_DZ2006(density=rho_orig_H_loss, T_K=T_K, XH2O=XH2O)
|
1100
|
+
if Hloss is False:
|
1101
|
+
P=calculate_Pressure_DZ2006(density=rho_orig_H_loss, T_K=T_K, XH2O=XH2O)
|
1102
|
+
return P/1000
|
1103
|
+
|
1104
|
+
else:
|
1105
|
+
|
1106
|
+
# Lets calculate the pressure using SW96
|
1107
|
+
P_SW=calculate_P_for_rho_T(T_K=T_K, CO2_dens_gcm3=rho_meas, EOS='SW96')
|
1108
|
+
P_SP=calculate_P_for_rho_T(T_K=T_K, CO2_dens_gcm3=rho_meas, EOS='SP94')
|
1109
|
+
# Same for DZ2006
|
1110
|
+
P_DZ=calculate_Pressure_DZ2006(density=rho_meas, T_K=T_K, XH2O=XH2O*0)
|
1111
|
+
# Now doing it with XH2O
|
1112
|
+
P_DZ_mix_H_loss=calculate_Pressure_DZ2006(density=rho_orig_H_loss, T_K=T_K, XH2O=XH2O)
|
1113
|
+
P_DZ_mix_noH_loss=calculate_Pressure_DZ2006(density=rho_orig_no_H_loss, T_K=T_K, XH2O=XH2O)
|
1114
|
+
|
1115
|
+
df=pd.DataFrame(data={
|
1116
|
+
'P_kbar_pureCO2_SW96': P_SW['P_kbar'],
|
1117
|
+
'P_kbar_pureCO2_SP94': P_SP['P_kbar'],
|
1118
|
+
'P_kbar_pureCO2_DZ06': P_DZ/1000,
|
1119
|
+
'P_kbar_mixCO2_DZ06_Hloss': P_DZ_mix_H_loss/1000,
|
1120
|
+
'P_kbar_mixCO2_DZ06_no_Hloss': P_DZ_mix_noH_loss/1000,
|
1121
|
+
'P Mix_Hloss/P Pure DZ06': P_DZ_mix_H_loss/P_DZ,
|
1122
|
+
'P Mix_no_Hloss/P Pure DZ06': P_DZ_mix_noH_loss/P_DZ,
|
1123
|
+
'rho_mix_calc_Hloss': rho_orig_H_loss,
|
1124
|
+
'rho_mix_calc_noHloss': rho_orig_no_H_loss,
|
1125
|
+
'CO2_dens_gcm3': rho_meas,
|
1126
|
+
'T_K': T_K,
|
1127
|
+
'XH2O': XH2O})
|
1128
|
+
|
1129
|
+
return df
|
1130
|
+
|
1131
|
+
|
1132
|
+
def calculate_rho_for_P_T_H2O(P_kbar, T_K):
|
1133
|
+
""" This function calculates H2O density in g/cm3 for a known Pressure (in kbar), a known T (in K) using the Wanger and Pru (2002) EOS from CoolProp
|
1134
|
+
doi:10.1063/1.1461829.
|
1135
|
+
|
1136
|
+
Parameters
|
1137
|
+
---------------------
|
1138
|
+
P_kbar: int, float, pd.Series, np.array
|
1139
|
+
Pressure in kbar
|
1140
|
+
|
1141
|
+
T_K: int, float, pd.Series, np.array
|
1142
|
+
Temperature in Kelvin
|
1143
|
+
|
1144
|
+
Returns
|
1145
|
+
--------------------
|
1146
|
+
pd.Series
|
1147
|
+
H2O density in g/cm3
|
1148
|
+
|
1149
|
+
"""
|
1150
|
+
if isinstance(P_kbar, pd.Series):
|
1151
|
+
P_kbar=np.array(P_kbar)
|
1152
|
+
if isinstance(T_K, pd.Series):
|
1153
|
+
T_K=np.array(T_K)
|
1154
|
+
|
1155
|
+
P_Pa=P_kbar*10**8
|
1156
|
+
|
1157
|
+
try:
|
1158
|
+
import CoolProp.CoolProp as cp
|
1159
|
+
except ImportError:
|
1160
|
+
raise RuntimeError('You havent installed CoolProp, which is required to convert FI densities to pressures. If you have python through conda, run conda install -c conda-forge coolprop in your command line')
|
1161
|
+
|
1162
|
+
H2O_dens_gcm3=cp.PropsSI('D', 'P', P_Pa, 'T', T_K, 'H2O')/1000
|
1163
|
+
|
1164
|
+
return pd.Series(H2O_dens_gcm3)
|
1081
1165
|
|
1082
1166
|
|
1083
1167
|
|
@@ -102,6 +102,7 @@ def filter_singleray(*,path=None,Diad_files=None,i=None,diad_peaks=None, exclude
|
|
102
102
|
|
103
103
|
file=Diad_files.iloc[i]
|
104
104
|
#open the spectrum in form of array
|
105
|
+
|
105
106
|
Diad_array=pf.get_data(path=path, filename=file, filetype=filetype)
|
106
107
|
|
107
108
|
# Get the intensity of the next and previous pixels
|
@@ -402,7 +403,7 @@ def filter_singleray(*,path=None,Diad_files=None,i=None,diad_peaks=None, exclude
|
|
402
403
|
|
403
404
|
record=pd.DataFrame([])
|
404
405
|
record.loc[file,'filename']=file
|
405
|
-
record.loc[file,'rays_present']=not all_rayswave.empty
|
406
|
+
record.loc[file,'rays_present']=float(not all_rayswave.empty)
|
406
407
|
|
407
408
|
if second_pass==True:
|
408
409
|
clean_spec_df=pxdf_filt_pass2[['Wavenumber','Intensity']]
|
@@ -619,8 +619,12 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
619
619
|
|
620
620
|
df.loc[zero, 'Preferred D']=0
|
621
621
|
df.loc[zero, 'Notes']=0
|
622
|
-
|
623
|
-
|
622
|
+
|
623
|
+
# Get rid of pandas 2 issue with warning of setting item of incompatible dtype
|
624
|
+
df['Preferred D'] = df['Preferred D'].astype('float64', errors='ignore')
|
625
|
+
df['Preferred D_σ'] = df['Preferred D_σ'].astype('float64', errors='ignore')
|
626
|
+
df['Preferred D_σ_split'] = df['Preferred D_σ_split'].astype('float64', errors='ignore')
|
627
|
+
df['Preferred D_σ_dens'] = df['Preferred D_σ_dens'].astype('float64', errors='ignore')
|
624
628
|
|
625
629
|
|
626
630
|
|
@@ -692,23 +696,39 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
692
696
|
|
693
697
|
|
694
698
|
|
699
|
+
# if Ne_pickle_str is not None:
|
700
|
+
#
|
701
|
+
# df_merge1=pd.concat([df_combo_c, Ne_corr], axis=1).reset_index(drop=True)
|
702
|
+
# else:
|
703
|
+
# df_merge1=df
|
704
|
+
# print('df')
|
705
|
+
# print(df['Preferred D'])
|
706
|
+
# print('df_merge1')
|
707
|
+
# print(df_merge1['Preferred D'])
|
695
708
|
if Ne_pickle_str is not None:
|
696
709
|
df_merge1=pd.concat([df_combo_c, Ne_corr], axis=1).reset_index(drop=True)
|
710
|
+
df_merge=pd.concat([df, df_merge1], axis=1).reset_index(drop=True)
|
711
|
+
elif Ne_pickle_str is None and df_combo is not None:
|
712
|
+
df_merge=pd.concat([df, df_combo_c], axis=1).reset_index(drop=True)
|
697
713
|
else:
|
698
|
-
|
714
|
+
df_merge=df
|
715
|
+
|
716
|
+
|
699
717
|
|
700
|
-
df_merge=pd.concat([df, df_merge1], axis=1).reset_index(drop=True)
|
718
|
+
#df_merge=pd.concat([df, df_merge1], axis=1).reset_index(drop=True)
|
701
719
|
|
702
720
|
|
703
721
|
|
704
722
|
|
705
|
-
|
723
|
+
|
724
|
+
|
706
725
|
|
707
726
|
df_merge = df_merge.rename(columns={'Preferred D': 'Density g/cm3'})
|
708
727
|
df_merge = df_merge.rename(columns={'Preferred D_σ': 'σ Density g/cm3'})
|
709
728
|
df_merge = df_merge.rename(columns={'Preferred D_σ_split': 'σ Density g/cm3 (from Ne+peakfit)'})
|
710
729
|
df_merge = df_merge.rename(columns={'Preferred D_σ_dens': 'σ Density g/cm3 (from densimeter)'})
|
711
730
|
df_merge = df_merge.rename(columns={'filename_x': 'filename'})
|
731
|
+
|
712
732
|
|
713
733
|
|
714
734
|
#
|
@@ -727,6 +747,7 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
727
747
|
df_merge = df_merge[cols_to_move + [
|
728
748
|
col for col in df_merge.columns if col not in cols_to_move]]
|
729
749
|
|
750
|
+
|
730
751
|
|
731
752
|
return df_merge
|
732
753
|
|
@@ -968,7 +989,7 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
968
989
|
Split=df_combo_c['Splitting']*pref_Ne
|
969
990
|
|
970
991
|
else:
|
971
|
-
Split_err=
|
992
|
+
Split_err=split_err
|
972
993
|
|
973
994
|
|
974
995
|
|
@@ -1129,6 +1150,14 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
1129
1150
|
|
1130
1151
|
df.loc[zero, 'Preferred D']=0
|
1131
1152
|
df.loc[zero, 'Notes']=0
|
1153
|
+
|
1154
|
+
# Assign to the right type to avoid annoying pandas 2 warning
|
1155
|
+
# Ensure the columns are of type float64
|
1156
|
+
df['Preferred D'] = df['Preferred D'].astype('float64', errors='ignore')
|
1157
|
+
df['Preferred D_σ'] = df['Preferred D_σ'].astype('float64', errors='ignore')
|
1158
|
+
df['Preferred D_σ_split'] = df['Preferred D_σ_split'].astype('float64', errors='ignore')
|
1159
|
+
df['Preferred D_σ_dens'] = df['Preferred D_σ_dens'].astype('float64', errors='ignore')
|
1160
|
+
|
1132
1161
|
|
1133
1162
|
|
1134
1163
|
|
@@ -1146,7 +1175,7 @@ CI_split=0.67, CI_neon=0.67, Ne_pickle_str=None, pref_Ne=None, Ne_err=None, cor
|
|
1146
1175
|
df.loc[SupCrit&(min_MD_SC_Split&max_MD_SC_Split), 'Preferred D_σ_split'] = medD_error['MedD_Density_σ_split']
|
1147
1176
|
df.loc[SupCrit&(min_MD_SC_Split&max_MD_SC_Split), 'Preferred D_σ_dens'] = medD_error['MedD_Density_σ_dens']
|
1148
1177
|
df.loc[SupCrit&(min_MD_SC_Split&max_MD_SC_Split), 'Notes']='SupCrit, Med density'
|
1149
|
-
|
1178
|
+
|
1150
1179
|
# If SupCrit, low density
|
1151
1180
|
df.loc[ SupCrit&(min_lowD_SC_Split&max_lowD_SC_Split), 'Preferred D'] = LowD_SC
|
1152
1181
|
df.loc[ SupCrit&(min_lowD_SC_Split&max_lowD_SC_Split), 'Preferred D_σ'] = lowD_error['LowD_Density_σ']
|