DiadFit 1.0.0__py3-none-any.whl → 1.0.1__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/CO2_in_bubble_error.py +1 -1
- DiadFit/H2O_fitting.py +11 -11
- DiadFit/_version.py +1 -1
- DiadFit/densimeters.py +10 -1
- DiadFit/diads.py +36 -14
- {DiadFit-1.0.0.dist-info → DiadFit-1.0.1.dist-info}/METADATA +3 -3
- {DiadFit-1.0.0.dist-info → DiadFit-1.0.1.dist-info}/RECORD +9 -9
- {DiadFit-1.0.0.dist-info → DiadFit-1.0.1.dist-info}/WHEEL +0 -0
- {DiadFit-1.0.0.dist-info → DiadFit-1.0.1.dist-info}/top_level.txt +0 -0
DiadFit/CO2_in_bubble_error.py
CHANGED
@@ -159,7 +159,7 @@ plot_figure=True, fig_i=0, neg_values=True):
|
|
159
159
|
|
160
160
|
# This is the function doing the work to actually make the simulations for each variable.
|
161
161
|
if error_vol_perc_bub is not None:
|
162
|
-
|
162
|
+
|
163
163
|
|
164
164
|
df_synthetic=propagate_CO2_in_bubble_ind(
|
165
165
|
N_dup=N_dup,
|
DiadFit/H2O_fitting.py
CHANGED
@@ -10,7 +10,7 @@ from dataclasses import dataclass
|
|
10
10
|
from typing import Tuple, Optional
|
11
11
|
from DiadFit.importing_data_files import *
|
12
12
|
from numpy import trapz
|
13
|
-
from scipy.integrate import
|
13
|
+
from scipy.integrate import simpson
|
14
14
|
##
|
15
15
|
def extract_xstal_MI_name(*, files, char_xstal, pos_xstal, char_MI, pos_MI,
|
16
16
|
prefix=True, str_prefix=" ", file_ext='.txt'):
|
@@ -872,30 +872,30 @@ fit_sil='poly', dpi=200):
|
|
872
872
|
ydat_sil=y_corr_sil
|
873
873
|
|
874
874
|
xspace_sil=xdat_sil[1]-xdat_sil[0]
|
875
|
-
area_trap =
|
876
|
-
area_simps =
|
875
|
+
area_trap = trapezoid(y_corr_sil, dx=xspace_sil)
|
876
|
+
area_simps = simpson(y_corr_sil, dx=xspace_sil)
|
877
877
|
# Just the LW area
|
878
878
|
xsil_LW=xdat_sil[(xdat_sil>LW[0]) & (xdat_sil<LW[1])]
|
879
879
|
y_corr_sil_LW=y_corr_sil[(xdat_sil>LW[0]) & (xdat_sil<LW[1])]
|
880
880
|
xspace_sil_LW=xsil_LW[1]-xsil_LW[0]
|
881
|
-
area_trap_LW=
|
882
|
-
area_simp_LW=
|
881
|
+
area_trap_LW=trapezoid(y_corr_sil_LW, dx=xspace_sil_LW)
|
882
|
+
area_simp_LW=simpson(y_corr_sil_LW, dx=xspace_sil_LW)
|
883
883
|
|
884
884
|
|
885
885
|
# Just the HW area
|
886
886
|
xsil_HW=xdat_sil[(xdat_sil>HW[0]) & (xdat_sil<HW[1])]
|
887
887
|
y_corr_sil_HW=y_corr_sil[(xdat_sil>HW[0]) & (xdat_sil<HW[1])]
|
888
888
|
xspace_sil_HW=xsil_HW[1]-xsil_HW[0]
|
889
|
-
area_trap_HW=
|
890
|
-
area_simp_HW=
|
889
|
+
area_trap_HW=trapezoid(y_corr_sil_HW, dx=xspace_sil_HW)
|
890
|
+
area_simp_HW=simpson(y_corr_sil_HW, dx=xspace_sil_HW)
|
891
891
|
|
892
892
|
# MW
|
893
893
|
if MW is not None:
|
894
894
|
xsil_MW=xdat_sil[(xdat_sil>MW[0]) & (xdat_sil<MW[1])]
|
895
895
|
y_corr_sil_MW=y_corr_sil[(xdat_sil>MW[0]) & (xdat_sil<MW[1])]
|
896
896
|
xspace_sil_MW=xsil_MW[1]-xsil_MW[0]
|
897
|
-
area_trap_MW=
|
898
|
-
area_simp_MW=
|
897
|
+
area_trap_MW=trapezoid(y_corr_sil_MW, dx=xspace_sil_MW)
|
898
|
+
area_simp_MW=simpson(y_corr_sil_MW, dx=xspace_sil_MW)
|
899
899
|
|
900
900
|
|
901
901
|
# Plotting what its doing
|
@@ -1155,8 +1155,8 @@ def fit_area_for_water_region(*, path, filename, Spectra=None, config1: water_bc
|
|
1155
1155
|
|
1156
1156
|
|
1157
1157
|
xspace_water=xdat_water[1]-xdat_water[0]
|
1158
|
-
area_trap =
|
1159
|
-
area_simps =
|
1158
|
+
area_trap = trapezoid(y_corr_water, dx=xspace_water)
|
1159
|
+
area_simps = simpson(y_corr_water, dx=xspace_water)
|
1160
1160
|
|
1161
1161
|
|
1162
1162
|
# Plotting what its doing
|
DiadFit/_version.py
CHANGED
DiadFit/densimeters.py
CHANGED
@@ -944,20 +944,29 @@ def merge_fit_files(path):
|
|
944
944
|
|
945
945
|
if os.path.exists(os.path.join(path, 'Weak_Diads.xlsx')):
|
946
946
|
grp1 = pd.read_excel(os.path.join(path, 'Weak_Diads.xlsx'))
|
947
|
+
grp1['Standard']='No'
|
947
948
|
else:
|
948
949
|
grp1 = None
|
949
950
|
|
950
951
|
if os.path.exists(os.path.join(path, 'Medium_Diads.xlsx')):
|
951
952
|
grp2 = pd.read_excel(os.path.join(path, 'Medium_Diads.xlsx'))
|
953
|
+
grp2['Standard']='No'
|
952
954
|
else:
|
953
955
|
grp2 = None
|
954
956
|
|
955
957
|
if os.path.exists(os.path.join(path, 'Strong_Diads.xlsx')):
|
956
958
|
grp3 = pd.read_excel(os.path.join(path, 'Strong_Diads.xlsx'))
|
959
|
+
grp3['Standard']='No'
|
957
960
|
else:
|
958
961
|
grp3 = None
|
962
|
+
|
963
|
+
if os.path.exists(os.path.join(path, 'Std_Diads.xlsx')):
|
964
|
+
grp4 = pd.read_excel(os.path.join(path, 'Std_Diads.xlsx'))
|
965
|
+
grp4['Standard']='Yes'
|
966
|
+
else:
|
967
|
+
grp4 = None
|
959
968
|
|
960
|
-
df2 = pd.concat([grp1, grp2, grp3], axis=0).reset_index(drop=True)
|
969
|
+
df2 = pd.concat([grp1, grp2, grp3, grp4], axis=0).reset_index(drop=True)
|
961
970
|
|
962
971
|
if discard is not None:
|
963
972
|
discard_cols=discard[discard.columns.intersection(df2.columns)]
|
DiadFit/diads.py
CHANGED
@@ -18,7 +18,7 @@ import matplotlib.patches as patches
|
|
18
18
|
import warnings as w
|
19
19
|
from tqdm import tqdm
|
20
20
|
from numpy import trapz
|
21
|
-
from scipy.integrate import
|
21
|
+
from scipy.integrate import simpson
|
22
22
|
from scipy.interpolate import interp1d
|
23
23
|
|
24
24
|
# Allowed models
|
@@ -725,7 +725,7 @@ def plot_peak_params(fit_params,
|
|
725
725
|
def filter_splitting_prominence(*, fit_params, data_y_all,
|
726
726
|
x_cord,
|
727
727
|
splitting_limits=[100, 107],
|
728
|
-
lower_diad1_prom=10, exclude_str):
|
728
|
+
lower_diad1_prom=10, exclude_str=None, str_filt=None):
|
729
729
|
""" Filters Spectra based on approximate splitting, draws a plot showing spectra to discard and those to keep
|
730
730
|
|
731
731
|
Parameters
|
@@ -746,6 +746,12 @@ def filter_splitting_prominence(*, fit_params, data_y_all,
|
|
746
746
|
Only keeps spectra that meet the splitting parameter, and have an absolute
|
747
747
|
diad1 prominence greater than this value (helps filter out other weird spectra)
|
748
748
|
|
749
|
+
exclude_str: str
|
750
|
+
Excludes files with this string.
|
751
|
+
|
752
|
+
str_filt: str
|
753
|
+
Filters just based on string in filename
|
754
|
+
|
749
755
|
Returns
|
750
756
|
--------------
|
751
757
|
fit_params_filt: pd.DataFrame
|
@@ -759,21 +765,30 @@ def filter_splitting_prominence(*, fit_params, data_y_all,
|
|
759
765
|
|
760
766
|
|
761
767
|
"""
|
768
|
+
if str_filt is not None:
|
769
|
+
filt=fit_params['filename'].str.contains(str_filt)
|
762
770
|
|
763
|
-
reas_split=(fit_params['approx_split'].between(splitting_limits[0], splitting_limits[1]))
|
764
|
-
reas_heigh=fit_params['Diad1_abs_prom']>lower_diad1_prom
|
765
|
-
if exclude_str is not None:
|
766
|
-
name_in_file=~fit_params['filename'].str.contains(exclude_str)
|
767
771
|
else:
|
768
|
-
name_in_file=reas_heigh
|
769
772
|
|
770
|
-
|
771
|
-
|
773
|
+
reas_split=(fit_params['approx_split'].between(splitting_limits[0], splitting_limits[1]))
|
774
|
+
reas_heigh=fit_params['Diad1_abs_prom']>lower_diad1_prom
|
775
|
+
|
776
|
+
if exclude_str is not None:
|
777
|
+
name_in_file=~fit_params['filename'].str.contains(exclude_str)
|
778
|
+
else:
|
779
|
+
name_in_file=reas_heigh
|
780
|
+
|
781
|
+
filt=reas_split&reas_heigh&name_in_file
|
782
|
+
|
783
|
+
fit_params_filt=fit_params.loc[filt].reset_index(drop=True)
|
784
|
+
fit_params_disc=fit_params.loc[~(filt)].reset_index(drop=True)
|
772
785
|
|
773
786
|
print('Keeping N='+str(len(fit_params_filt)))
|
774
787
|
print('Discarding N='+str(len(fit_params_disc)))
|
775
788
|
|
776
|
-
|
789
|
+
|
790
|
+
|
791
|
+
# Then apply to get data
|
777
792
|
data_y_filt=data_y_all[:, (filt)]
|
778
793
|
data_y_disc=data_y_all[:, ~(filt)]
|
779
794
|
|
@@ -804,17 +819,21 @@ def filter_splitting_prominence(*, fit_params, data_y_all,
|
|
804
819
|
Diff=np.nanmax(data_y_filt[:, i])-np.nanmin(data_y_filt[:, i])
|
805
820
|
av_prom_Keep=fit_params_filt['Diad1_abs_prom'].iloc[i]
|
806
821
|
prom_filt=prom_filt+av_prom_Keep
|
822
|
+
file=fit_params_filt['filename'].iloc[i]
|
807
823
|
ax2.plot(x_cord+i*5, (data_y_filt[:, i]-np.nanmin(data_y_filt[:, i]))/Diff+i/3, '-b', lw=0.5)
|
824
|
+
yplot=np.quantile((data_y_filt[:, i]-np.nanmin(data_y_filt[:, i]))/Diff+i/3, 0.65)
|
825
|
+
ax2.annotate(str(file), xy=(1450+i*5, yplot),
|
826
|
+
xycoords="data", fontsize=8, bbox=dict(facecolor='white', edgecolor='none', pad=2))
|
808
827
|
|
809
828
|
|
810
829
|
ax2.set_xlim([1250, 1450+i*5])
|
811
830
|
ax2.set_xticks([])
|
812
831
|
ax2.set_yticks([])
|
813
832
|
|
814
|
-
return fit_params_filt, data_y_filt, fit_params_disc, data_y_disc
|
833
|
+
return fit_params_filt.reset_index(drop=True), data_y_filt, fit_params_disc.reset_index(drop=True), data_y_disc
|
815
834
|
|
816
835
|
|
817
|
-
def identify_diad_group(*, fit_params, data_y, x_cord, filter_bool,y_fig_scale=0.1, grp_filter='Weak'):
|
836
|
+
def identify_diad_group(*, fit_params, data_y, x_cord, filter_bool,y_fig_scale=0.1, grp_filter='Weak', str_filt=None):
|
818
837
|
|
819
838
|
"""Sorts diads into two groups. Those meeting the 'filter_bool' criteria, and those not
|
820
839
|
meeting this criteria. Ones meeting the criteria are shown on the left hand plot,
|
@@ -853,6 +872,9 @@ def identify_diad_group(*, fit_params, data_y, x_cord, filter_bool,y_fig_scale=
|
|
853
872
|
|
854
873
|
|
855
874
|
"""
|
875
|
+
if str_filt is not None:
|
876
|
+
filt_name=~fit_params['filename'].str.contains(str_filt)
|
877
|
+
filt_bool=filt_name&filt_bool
|
856
878
|
|
857
879
|
if np.shape(data_y)[1]==0:
|
858
880
|
Group1_df=pd.DataFrame().reindex_like(fit_params)
|
@@ -3835,8 +3857,8 @@ path=None, filename=None, filetype=None,
|
|
3835
3857
|
|
3836
3858
|
|
3837
3859
|
xspace_sil=x_new[1]-x_new[0]
|
3838
|
-
area_trap =
|
3839
|
-
area_simps =
|
3860
|
+
area_trap = trapezoid(Baseline_ysub_sil, dx=xspace_sil)
|
3861
|
+
area_simps = simpson(Baseline_ysub_sil, dx=xspace_sil)
|
3840
3862
|
|
3841
3863
|
|
3842
3864
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: DiadFit
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.1
|
4
4
|
Summary: DiadFit
|
5
5
|
Home-page: https://github.com/PennyWieser/DiadFit
|
6
6
|
Author: Penny Wieser
|
@@ -9,13 +9,13 @@ License: UNKNOWN
|
|
9
9
|
Platform: UNKNOWN
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: Operating System :: OS Independent
|
12
|
-
Requires-Python: >=3.
|
12
|
+
Requires-Python: >=3.8
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
Requires-Dist: pandas
|
15
15
|
Requires-Dist: numpy <2
|
16
16
|
Requires-Dist: matplotlib
|
17
17
|
Requires-Dist: scikit-learn
|
18
|
-
Requires-Dist: scipy
|
18
|
+
Requires-Dist: scipy >1.6
|
19
19
|
Requires-Dist: lmfit >=1.1.0
|
20
20
|
Requires-Dist: tqdm
|
21
21
|
Requires-Dist: python-docx
|
@@ -1,6 +1,6 @@
|
|
1
1
|
DiadFit/CO2_EOS.py,sha256=ti9HEZynM-BoiPGYG1C7vUpO-RNZY-NqmjUl2FFnO3E,73918
|
2
|
-
DiadFit/CO2_in_bubble_error.py,sha256=
|
3
|
-
DiadFit/H2O_fitting.py,sha256=
|
2
|
+
DiadFit/CO2_in_bubble_error.py,sha256=Nq5YEf2oa2rWRreEPXl2lEA86NXOGvll0Gca2AOu_RE,21224
|
3
|
+
DiadFit/H2O_fitting.py,sha256=ZOLWL8j7HQYKlx1-ISm1twvH34jhrGFwukU8ElRj0Dw,43920
|
4
4
|
DiadFit/Highrho_polyfit_data.pkl,sha256=7t6uXxI-HdfsvreAWORzMa9dXxUsnXqKBSo1O3EgiBw,1213
|
5
5
|
DiadFit/Highrho_polyfit_dataUCB_1117_1400.pkl,sha256=oBOarETLyfq2DJhYGQrJofgHjvRMLamE6G2b7EE5m-Y,1213
|
6
6
|
DiadFit/Highrho_polyfit_dataUCB_1117_1447.pkl,sha256=OG1qip_xU1hl3xp3HC8e9_2497-KYEV3Xz3mx0gdJ4Y,1213
|
@@ -29,13 +29,13 @@ 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=e_2FV9coO7Ff17u_XZSeherC0HKwQWI8n-EaEUoHEuU,295
|
33
33
|
DiadFit/argon_lines.py,sha256=vtzsuDdEgrAmEF9xwpejpFqKV9hKPS1JUYhIl4AfXZ0,7675
|
34
34
|
DiadFit/cosmicray_filter.py,sha256=a45x2_nmpi9Qcjc_L39UA9JOd1NMorIjtTRGnCdG3MU,23634
|
35
35
|
DiadFit/densimeter_fitting.py,sha256=zEyCwq1zDV3z6-MIu-eZqgp3YQPUGqwZiKczN3-22LQ,8247
|
36
|
-
DiadFit/densimeters.py,sha256=
|
36
|
+
DiadFit/densimeters.py,sha256=p3jY9709vKegCfWZIwoU4Rt5jFfwJJQobLb71AXUxAY,55250
|
37
37
|
DiadFit/density_depth_crustal_profiles.py,sha256=b072IJaoGDydKpqWWKoJHeXKIkcIXxKf82whpvLAPpw,17761
|
38
|
-
DiadFit/diads.py,sha256=
|
38
|
+
DiadFit/diads.py,sha256=PmCIxMXU6O5zFQWzQmhwkqEVoRDyw89ogKTYjIAvvMg,177423
|
39
39
|
DiadFit/error_propagation.py,sha256=STJUqjdhwo0geXi0iZ9XN0RD3t7qYqbNGHzelfLOANQ,50038
|
40
40
|
DiadFit/importing_data_files.py,sha256=0Cx_CKJZR8efssMzQit0aPRh_rsjQFGXgLtI285FW_k,41961
|
41
41
|
DiadFit/lookup_table.csv,sha256=Hs1tmSQ9ArTUDv3ymEXbvnLlPBxYUP0P51dz7xAKk-Q,2946857
|
@@ -43,7 +43,7 @@ DiadFit/lookup_table_noneg.csv,sha256=HelvewKbBy4cqT2GAqsMo-1ps1lBYqZ-8hCJZWPGfh
|
|
43
43
|
DiadFit/molar_gas_proportions.py,sha256=_oEZn_vndHGDaXAjZ6UU8ycujBx_qB2KGCGqZSzotQU,3389
|
44
44
|
DiadFit/ne_lines.py,sha256=6z9oo4lgh0iYv1mkSscgzCt_Pe4gQTnquG99pR6cJS8,63811
|
45
45
|
DiadFit/relaxifi.py,sha256=hHzRsJPQIVohYi3liy9IQJpaomgsa2zbLQmhqkpdfrI,31549
|
46
|
-
DiadFit-1.0.
|
47
|
-
DiadFit-1.0.
|
48
|
-
DiadFit-1.0.
|
49
|
-
DiadFit-1.0.
|
46
|
+
DiadFit-1.0.1.dist-info/METADATA,sha256=JVJSzMb7lAJj2u6IRmjuZRfn5i6um5XOl-jj3ISQU58,1174
|
47
|
+
DiadFit-1.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
48
|
+
DiadFit-1.0.1.dist-info/top_level.txt,sha256=yZC6OFLVznaFA5kcPlFPkvhKotcVd-YO4bKxZZw3LQE,8
|
49
|
+
DiadFit-1.0.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|