DiadFit 0.0.54__tar.gz → 0.0.57__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.54 → DiadFit-0.0.57}/PKG-INFO +1 -1
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/CO2_EOS.py +185 -18
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/__init__.py +1 -2
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/_version.py +1 -1
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/diads.py +19 -8
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/error_propagation.py +283 -165
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/importing_data_files.py +160 -29
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/ne_lines.py +117 -38
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit.egg-info/PKG-INFO +1 -1
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit.egg-info/SOURCES.txt +0 -7
- DiadFit-0.0.54/src/DiadFit/example_peak_params.py +0 -0
- DiadFit-0.0.54/src/DiadFit/microthermometry.py +0 -10
- DiadFit-0.0.54/src/DiadFit/ne_lines_BACKUP_966.py +0 -1431
- DiadFit-0.0.54/src/DiadFit/ne_lines_BASE_966.py +0 -1427
- DiadFit-0.0.54/src/DiadFit/ne_lines_LOCAL_966.py +0 -1427
- DiadFit-0.0.54/src/DiadFit/ne_lines_REMOTE_966.py +0 -1427
- DiadFit-0.0.54/src/DiadFit/skewness.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/README.md +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/setup.cfg +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/setup.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/H2O_fitting.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/Psensor.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/cosmicray_filter.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/densimeters.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit/density_depth_crustal_profiles.py +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit.egg-info/dependency_links.txt +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit.egg-info/requires.txt +0 -0
- {DiadFit-0.0.54 → DiadFit-0.0.57}/src/DiadFit.egg-info/top_level.txt +0 -0
@@ -125,7 +125,8 @@ def calculate_CO2_density_homog_T(T_h_C, EOS='SW96', Sample_ID=None, homog_to=No
|
|
125
125
|
homog_L=homog_to=='V'
|
126
126
|
df.loc[homog_L, 'Bulk_gcm3']=gas_density
|
127
127
|
|
128
|
-
|
128
|
+
if Sample_ID is not None:
|
129
|
+
df['Sample_ID']=Sample_ID
|
129
130
|
|
130
131
|
|
131
132
|
return df
|
@@ -277,7 +278,7 @@ def calculate_CO2_density_homog_T_SW96_NIST(T_h_C, Sample_ID=None, homog_to=None
|
|
277
278
|
|
278
279
|
## Calculating density for a given pressure and temperature - have a generic function, that calls the individual EOS depending on which one you select
|
279
280
|
|
280
|
-
def
|
281
|
+
def calculate_rho_for_P_T(P_kbar, T_K, EOS='SW96', Sample_ID=None):
|
281
282
|
""" This function calculates CO2 density in g/cm3 for a known Pressure (in kbar), a known T (in K), and a specified EOS
|
282
283
|
|
283
284
|
Parameters
|
@@ -291,6 +292,9 @@ def calculate_rho_gcm3_for_P_T(P_kbar, T_K, EOS='SW96'):
|
|
291
292
|
EOS: str
|
292
293
|
'SW96' for Span and Wanger (1996), or 'SP94' for Sterner and Pitzer (1994)
|
293
294
|
|
295
|
+
Sample_ID: str, pd.Series
|
296
|
+
Sample ID to append onto outputted dataframe
|
297
|
+
|
294
298
|
Returns
|
295
299
|
--------------------
|
296
300
|
pd.Series
|
@@ -299,12 +303,15 @@ def calculate_rho_gcm3_for_P_T(P_kbar, T_K, EOS='SW96'):
|
|
299
303
|
"""
|
300
304
|
|
301
305
|
if EOS=='SW96':
|
302
|
-
CO2_dens_gcm3=
|
306
|
+
CO2_dens_gcm3=calculate_rho_for_P_T_SW96(P_kbar, T_K)
|
303
307
|
|
304
308
|
|
305
309
|
if EOS=='SP94':
|
306
310
|
|
307
|
-
CO2_dens_gcm3=
|
311
|
+
CO2_dens_gcm3=calculate_rho_for_P_T_SP94(T_K=T_K, P_kbar=P_kbar)
|
312
|
+
|
313
|
+
if Sample_ID is not None:
|
314
|
+
df['Sample_ID']=Sample_ID
|
308
315
|
|
309
316
|
return pd.Series(CO2_dens_gcm3)
|
310
317
|
|
@@ -313,7 +320,7 @@ def calculate_rho_gcm3_for_P_T(P_kbar, T_K, EOS='SW96'):
|
|
313
320
|
|
314
321
|
# Function for Span and Wanger (1996)
|
315
322
|
|
316
|
-
def
|
323
|
+
def calculate_rho_for_P_T_SW96(P_kbar, T_K):
|
317
324
|
""" This function calculates CO2 density in g/cm3 for a known Pressure (in kbar), a known T (in K) for the Span and Wagner (1996) EOS
|
318
325
|
|
319
326
|
Parameters
|
@@ -336,12 +343,18 @@ def calculate_rho_gcm3_for_P_T_SW96(P_kbar, T_K):
|
|
336
343
|
T_K=np.array(T_K)
|
337
344
|
|
338
345
|
P_Pa=P_kbar*10**8
|
346
|
+
|
347
|
+
try:
|
348
|
+
import CoolProp.CoolProp as cp
|
349
|
+
except ImportError:
|
350
|
+
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')
|
351
|
+
|
339
352
|
CO2_dens_gcm3=cp.PropsSI('D', 'P', P_Pa, 'T', T_K, 'CO2')/1000
|
340
353
|
|
341
354
|
return pd.Series(CO2_dens_gcm3)
|
342
355
|
|
343
356
|
# Function for Sterner and Pitzer, references functions down below
|
344
|
-
def
|
357
|
+
def calculate_rho_for_P_T_SP94(P_kbar, T_K):
|
345
358
|
""" This function calculates CO2 density in g/cm3 for a known Pressure (in kbar), a known T (in K) for the Sterner and Pitzer EOS
|
346
359
|
it references the objective functions to solve for density.
|
347
360
|
|
@@ -359,7 +372,7 @@ def calculate_rho_gcm3_for_P_T_SP94(P_kbar, T_K):
|
|
359
372
|
CO2 density in g/cm3
|
360
373
|
|
361
374
|
"""
|
362
|
-
target_pressure_MPa=P_kbar*
|
375
|
+
target_pressure_MPa=P_kbar*100
|
363
376
|
Density=calculate_SP19942(T_K=T_K, target_pressure_MPa=target_pressure_MPa)
|
364
377
|
return pd.Series(Density)
|
365
378
|
|
@@ -367,7 +380,7 @@ def calculate_rho_gcm3_for_P_T_SP94(P_kbar, T_K):
|
|
367
380
|
|
368
381
|
## Generic function for converting rho and T into Pressure
|
369
382
|
|
370
|
-
def calculate_P_for_rho_T(CO2_dens_gcm3, T_K, EOS='SW96'):
|
383
|
+
def calculate_P_for_rho_T(CO2_dens_gcm3, T_K, EOS='SW96', Sample_ID=None):
|
371
384
|
""" This function calculates P in kbar for a specified CO2 density in g/cm3, a known T (in K), and a specified EOS
|
372
385
|
|
373
386
|
Parameters
|
@@ -381,6 +394,9 @@ def calculate_P_for_rho_T(CO2_dens_gcm3, T_K, EOS='SW96'):
|
|
381
394
|
EOS: str
|
382
395
|
'SW96' for Span and Wanger (1996), or 'SP94' for Sterner and Pitzer (1994)
|
383
396
|
|
397
|
+
Sample_ID: str, pd.Series
|
398
|
+
Sample ID to be appended onto output dataframe
|
399
|
+
|
384
400
|
Returns
|
385
401
|
--------------------
|
386
402
|
pd.DataFrame
|
@@ -395,6 +411,10 @@ def calculate_P_for_rho_T(CO2_dens_gcm3, T_K, EOS='SW96'):
|
|
395
411
|
df=calculate_P_for_rho_T_SP94(CO2_dens_gcm3=CO2_dens_gcm3, T_K=T_K)
|
396
412
|
else:
|
397
413
|
raise TypeError('Please choose either SP94 or SW96 as an EOS')
|
414
|
+
|
415
|
+
if Sample_ID is not None:
|
416
|
+
df['Sample_ID']=Sample_ID
|
417
|
+
|
398
418
|
return df
|
399
419
|
|
400
420
|
# Calculating P for a given density and Temperature using Coolprop
|
@@ -450,8 +470,9 @@ def calculate_P_for_rho_T_SW96(CO2_dens_gcm3, T_K):
|
|
450
470
|
})
|
451
471
|
|
452
472
|
return df
|
453
|
-
|
473
|
+
# OVeral
|
454
474
|
# Calculating P for a given density and Temp, Sterner and Pitzer
|
475
|
+
|
455
476
|
def calculate_P_for_rho_T_SP94(T_K, CO2_dens_gcm3, scalar_return=False):
|
456
477
|
|
457
478
|
""" This function calculates P in kbar for a specified CO2 density in g/cm3 and a known T (in K) for the Sterner and Pitzer (1994) EOS
|
@@ -495,7 +516,9 @@ def calculate_P_for_rho_T_SP94(T_K, CO2_dens_gcm3, scalar_return=False):
|
|
495
516
|
+a9*MolConc**2*np.exp(-a10*MolConc)))
|
496
517
|
if scalar_return is True:
|
497
518
|
return P_MPa
|
498
|
-
|
519
|
+
|
520
|
+
elif isinstance(P_MPa, pd.Series) or isinstance(P_MPa, np.ndarray):
|
521
|
+
|
499
522
|
|
500
523
|
df=pd.DataFrame(data={'P_kbar': P_MPa/100,
|
501
524
|
'P_MPa': P_MPa,
|
@@ -503,7 +526,118 @@ def calculate_P_for_rho_T_SP94(T_K, CO2_dens_gcm3, scalar_return=False):
|
|
503
526
|
'CO2_dens_gcm3': CO2_dens_gcm3
|
504
527
|
|
505
528
|
})
|
506
|
-
|
529
|
+
|
530
|
+
|
531
|
+
else:
|
532
|
+
df=pd.DataFrame(data={'P_kbar': P_MPa/100,
|
533
|
+
'P_MPa': P_MPa,
|
534
|
+
'T_K': T_K,
|
535
|
+
'CO2_dens_gcm3': CO2_dens_gcm3
|
536
|
+
|
537
|
+
}, index=[0])
|
538
|
+
|
539
|
+
return df
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
## Inverting for temp if you know density and pressure
|
544
|
+
def calculate_T_for_rho_P(CO2_dens_gcm3, P_kbar, EOS='SW96', Sample_ID=None):
|
545
|
+
""" This function calculates P in kbar for a specified CO2 density in g/cm3, a known T (in K), and a specified EOS
|
546
|
+
|
547
|
+
Parameters
|
548
|
+
---------------------
|
549
|
+
CO2_dens_gcm3: int, float, pd.Series, np.array
|
550
|
+
CO2 density in g/cm3
|
551
|
+
|
552
|
+
P_kbar: int, float, pd.Series, np.array
|
553
|
+
Pressure in kbar
|
554
|
+
|
555
|
+
EOS: str
|
556
|
+
'SW96' for Span and Wanger (1996), or 'SP94' for Sterner and Pitzer (1994)
|
557
|
+
|
558
|
+
Sample_ID: str, pd.Series
|
559
|
+
Sample ID to be appended onto output dataframe
|
560
|
+
|
561
|
+
Returns
|
562
|
+
--------------------
|
563
|
+
pd.DataFrame
|
564
|
+
Temp in Kelvin and input parameters
|
565
|
+
|
566
|
+
"""
|
567
|
+
|
568
|
+
|
569
|
+
if EOS=='SW96':
|
570
|
+
df=calculate_T_for_rho_P_SW96(CO2_dens_gcm3=CO2_dens_gcm3, P_kbar=P_kbar)
|
571
|
+
elif EOS=='SP94':
|
572
|
+
df=calculate_T_for_rho_P_SP94(CO2_dens_gcm3=CO2_dens_gcm3, P_kbar=P_kbar)
|
573
|
+
else:
|
574
|
+
raise TypeError('Please choose either SP94 or SW96 as an EOS')
|
575
|
+
|
576
|
+
if Sample_ID is not None:
|
577
|
+
df['Sample_ID']=Sample_ID
|
578
|
+
|
579
|
+
return df
|
580
|
+
|
581
|
+
def calculate_T_for_rho_P_SW96(CO2_dens_gcm3, P_kbar):
|
582
|
+
""" This function calculates Temperature for a known CO2 density in g/cm3 and a known Pressure (in kbar)
|
583
|
+
for the Span and Wagner (1996) EOS
|
584
|
+
|
585
|
+
Parameters
|
586
|
+
---------------------
|
587
|
+
CO2_dens_gcm3: int, float, pd.Series, np.array
|
588
|
+
CO2 density in g/cm3
|
589
|
+
|
590
|
+
P_kbar: int, float, pd.Series, np.array
|
591
|
+
Pressure in kbar
|
592
|
+
|
593
|
+
|
594
|
+
Returns
|
595
|
+
--------------------
|
596
|
+
pd.Series
|
597
|
+
Pressure in kbar
|
598
|
+
|
599
|
+
"""
|
600
|
+
if isinstance(P_kbar, pd.Series):
|
601
|
+
P_kbar=np.array(P_kbar)
|
602
|
+
if isinstance(CO2_dens_gcm3, pd.Series):
|
603
|
+
CO2_dens_gcm3=np.array(CO2_dens_gcm3)
|
604
|
+
|
605
|
+
P_Pa=P_kbar*10**8
|
606
|
+
|
607
|
+
try:
|
608
|
+
import CoolProp.CoolProp as cp
|
609
|
+
except ImportError:
|
610
|
+
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')
|
611
|
+
|
612
|
+
Temp=cp.PropsSI('T', 'D', CO2_dens_gcm3*1000, 'P', P_Pa, 'CO2')
|
613
|
+
|
614
|
+
|
615
|
+
return pd.Series(Temp)
|
616
|
+
|
617
|
+
def calculate_T_for_rho_P_SP94(P_kbar, CO2_dens_gcm3):
|
618
|
+
""" This function calculates Temp for a known Pressure (in kbar) and a known CO2 density in g/cm3
|
619
|
+
using the Sterner and Pitzer EOS.
|
620
|
+
it references the objective functions to solve for density.
|
621
|
+
|
622
|
+
Parameters
|
623
|
+
---------------------
|
624
|
+
P_kbar: int, float, pd.Series, np.array
|
625
|
+
Pressure in kbar
|
626
|
+
|
627
|
+
CO2_dens_gcm3: int, float, pd.Series, np.array
|
628
|
+
CO2 density in g/cm3
|
629
|
+
|
630
|
+
Returns
|
631
|
+
--------------------
|
632
|
+
pd.Series
|
633
|
+
Temp in K
|
634
|
+
|
635
|
+
"""
|
636
|
+
target_pressure_MPa=P_kbar*100
|
637
|
+
Temp=calculate_SP1994_Temp(CO2_dens_gcm3=CO2_dens_gcm3, target_pressure_MPa=target_pressure_MPa)
|
638
|
+
return pd.Series(Temp)
|
639
|
+
|
640
|
+
|
507
641
|
|
508
642
|
|
509
643
|
|
@@ -605,10 +739,10 @@ T_h_C=None, phase=None, CO2_dens_gcm3=None, return_array=False):
|
|
605
739
|
## Sterner and Pitzer inverting for Density
|
606
740
|
import scipy
|
607
741
|
from scipy.optimize import minimize
|
608
|
-
# What we are trying to do, is run at various densities, until pressure matches input pressure
|
742
|
+
# What we are trying to do, is run at various CO2 densities, until pressure matches input pressure
|
609
743
|
|
610
|
-
def
|
611
|
-
""" This function minimises the offset between the calculated and target pressure
|
744
|
+
def objective_function_CO2_dens(CO2_dens_gcm3, T_K, target_pressure_MPa):
|
745
|
+
""" This function minimises the offset between the calculated and target pressure
|
612
746
|
"""
|
613
747
|
# The objective function that you want to minimize
|
614
748
|
calculated_pressure = calculate_P_for_rho_T_SP94(CO2_dens_gcm3=CO2_dens_gcm3, T_K=T_K, scalar_return=True)
|
@@ -619,17 +753,14 @@ def calculate_Density_Sterner_Pitzer_1994(T_K, target_pressure_MPa):
|
|
619
753
|
""" This function uses the objective function above to solve for CO2 density for a given pressure and Temp
|
620
754
|
"""
|
621
755
|
initial_guess = 1 # Provide an initial guess for the density
|
622
|
-
result = minimize(
|
756
|
+
result = minimize(objective_function_CO2_dens, initial_guess, bounds=((0, 2), ), args=(T_K, target_pressure_MPa))
|
623
757
|
return result.x
|
624
758
|
|
625
759
|
|
626
|
-
|
627
|
-
|
628
760
|
def calculate_SP19942(T_K, target_pressure_MPa):
|
629
761
|
""" This function Solves for CO2 density for a given temp and pressure using the objective and minimise functions above.
|
630
762
|
"""
|
631
763
|
if isinstance(target_pressure_MPa, float) or isinstance(target_pressure_MPa, int):
|
632
|
-
print('yes')
|
633
764
|
target_p=np.array(target_pressure_MPa)
|
634
765
|
Density=calculate_Density_Sterner_Pitzer_1994(T_K=T_K, target_pressure_MPa=target_p)
|
635
766
|
else:
|
@@ -638,6 +769,42 @@ def calculate_SP19942(T_K, target_pressure_MPa):
|
|
638
769
|
Density[i]=calculate_Density_Sterner_Pitzer_1994(T_K=T_K, target_pressure_MPa=target_pressure_MPa[i])
|
639
770
|
return Density
|
640
771
|
|
772
|
+
# Lets do the same to solve for tempreature here
|
773
|
+
|
774
|
+
|
775
|
+
def objective_function_Temp(T_K, CO2_dens_gcm3, target_pressure_MPa):
|
776
|
+
""" This function minimises the offset between the calculated and target pressure
|
777
|
+
"""
|
778
|
+
# The objective function that you want to minimize
|
779
|
+
calculated_pressure = calculate_P_for_rho_T_SP94(T_K=T_K, CO2_dens_gcm3=CO2_dens_gcm3, scalar_return=True)
|
780
|
+
objective = np.abs(calculated_pressure - target_pressure_MPa)
|
781
|
+
return objective
|
782
|
+
|
783
|
+
|
784
|
+
def calculate_Temp_Sterner_Pitzer_1994(CO2_dens_gcm3, target_pressure_MPa):
|
785
|
+
""" This function uses the objective function above to solve for Temp for a given pressure and CO2 density
|
786
|
+
"""
|
787
|
+
initial_guess = 1200 # Provide an initial guess for the density
|
788
|
+
result = minimize(objective_function_Temp, initial_guess, bounds=((0, 2000), ), args=(CO2_dens_gcm3, target_pressure_MPa))
|
789
|
+
return result.x
|
790
|
+
|
791
|
+
def calculate_SP1994_Temp(CO2_dens_gcm3, target_pressure_MPa):
|
792
|
+
""" This function Solves for Temp for a given CO2 density and pressure using the objective and minimise functions above.
|
793
|
+
"""
|
794
|
+
if isinstance(target_pressure_MPa, float) or isinstance(target_pressure_MPa, int):
|
795
|
+
target_p=np.array(target_pressure_MPa)
|
796
|
+
Density=calculate_Temp_Sterner_Pitzer_1994(CO2_dens_gcm3=CO2_dens_gcm3, target_pressure_MPa=target_p)
|
797
|
+
else:
|
798
|
+
Density=np.empty(len(target_pressure_MPa))
|
799
|
+
for i in range(0, len(target_pressure_MPa)):
|
800
|
+
Density[i]=calculate_Temp_Sterner_Pitzer_1994(CO2_dens_gcm3=CO2_dens_gcm3, target_pressure_MPa=target_pressure_MPa[i])
|
801
|
+
return Density
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
|
641
808
|
|
642
809
|
|
643
810
|
|
@@ -3126,6 +3126,8 @@ class generic_peak_config:
|
|
3126
3126
|
# Return other parameteres e.g. intermediate outputs
|
3127
3127
|
return_other_params: bool = False
|
3128
3128
|
|
3129
|
+
N_peaks: int= 1
|
3130
|
+
|
3129
3131
|
|
3130
3132
|
|
3131
3133
|
|
@@ -3434,7 +3436,7 @@ def plot_secondary_peaks(*, Diad_Files, path, filetype,
|
|
3434
3436
|
if True, finds max y coordinate in spectra. If its more than sigma*standard deviations above the
|
3435
3437
|
median, it is classified as a peak.
|
3436
3438
|
|
3437
|
-
|
3439
|
+
find_peaks_filter: bool
|
3438
3440
|
|
3439
3441
|
if True, uses scipy find peaks to find peaks. Can tweak distance, prominence, width,
|
3440
3442
|
threshold, and height.
|
@@ -3474,6 +3476,8 @@ def plot_secondary_peaks(*, Diad_Files, path, filetype,
|
|
3474
3476
|
|
3475
3477
|
|
3476
3478
|
for file in Diad_Files:
|
3479
|
+
|
3480
|
+
|
3477
3481
|
|
3478
3482
|
|
3479
3483
|
Diad_df=get_data(path=path, filename=file, filetype=filetype)
|
@@ -3501,21 +3505,28 @@ def plot_secondary_peaks(*, Diad_Files, path, filetype,
|
|
3501
3505
|
# Find peaks for trimmed spectra (e.g. in region peaks have been asked for)
|
3502
3506
|
peaks = find_peaks(y_trim,height = height, threshold = threshold,
|
3503
3507
|
distance = distance, prominence=prominence, width=width)
|
3504
|
-
|
3508
|
+
|
3509
|
+
|
3510
|
+
height_PEAK = peaks[1]['peak_heights'] #list of the heights of the peaks
|
3505
3511
|
peak_pos = x_trim[peaks[0]] #list of the peaks positions
|
3512
|
+
|
3506
3513
|
df_sort=pd.DataFrame(data={'pos': peak_pos,
|
3507
|
-
'height':
|
3514
|
+
'height': height_PEAK})
|
3508
3515
|
|
3509
3516
|
df_peak_sort=df_sort.sort_values('height', axis=0, ascending=False)
|
3510
3517
|
|
3511
3518
|
# Trim number of peaks based on user-defined N peaks
|
3512
|
-
|
3519
|
+
|
3520
|
+
|
3513
3521
|
|
3514
3522
|
#print(df_peak_sort_short)
|
3515
|
-
if len(
|
3523
|
+
if len(df_peak_sort>=1):
|
3524
|
+
|
3525
|
+
df_peak_sort_short=df_peak_sort[0:1]
|
3516
3526
|
peak_pos_saved[i]=df_peak_sort_short['pos'].values
|
3517
3527
|
peak_height_saved[i]=df_peak_sort_short['height'].values
|
3518
3528
|
else:
|
3529
|
+
|
3519
3530
|
peak_pos_saved[i]=np.nan
|
3520
3531
|
peak_height_saved[i]=np.nan
|
3521
3532
|
|
@@ -3526,7 +3537,7 @@ def plot_secondary_peaks(*, Diad_Files, path, filetype,
|
|
3526
3537
|
|
3527
3538
|
ax1.plot(x_plot, ((y_plot-np.min(y_plot))/Diff)+i, '-r')
|
3528
3539
|
ax1.plot(x_plot, ((y_plot-np.min(y_plot))/Diff)+i, '.k', ms=1)
|
3529
|
-
if len(
|
3540
|
+
if len(height_PEAK)>0:
|
3530
3541
|
|
3531
3542
|
|
3532
3543
|
ax1.plot(df_peak_sort_short['pos'], (df_peak_sort_short['height']-np.min(y_plot))/Diff+i, '*k', mfc='yellow', ms=10)
|
@@ -3723,7 +3734,7 @@ skewness='abs', height=1, prominence=5, width=0.5, plot_figure=True, dpi=200):
|
|
3723
3734
|
|
3724
3735
|
|
3725
3736
|
y_corr_diad1, Py_base_diad1, x_diad1, Diad_short, Py_base_diad1, Pf_baseline, Baseline_ysub_diad1, Baseline_x_diad1, Baseline, span=remove_diad_baseline(
|
3726
|
-
path=path, filename=filename, filetype=filetype,
|
3737
|
+
path=path, filename=filename, filetype=filetype, N_poly=config1.N_poly_bck_diad1,
|
3727
3738
|
lower_bck=config1.lower_bck_diad1, upper_bck=config1.upper_bck_diad1, plot_figure=False)
|
3728
3739
|
|
3729
3740
|
|
@@ -3967,7 +3978,7 @@ skewness='abs', height=1, prominence=5, width=0.5, plot_figure=True, dpi=200):
|
|
3967
3978
|
|
3968
3979
|
# First, do the background subtraction
|
3969
3980
|
y_corr_diad2, Py_base_diad2, x_diad2, Diad_short, Py_base_diad2, Pf_baseline, Baseline_ysub_diad2, Baseline_x_diad2, Baseline, span=remove_diad_baseline(
|
3970
|
-
path=path, filename=filename, filetype=filetype,
|
3981
|
+
path=path, filename=filename, filetype=filetype, N_poly=config1.N_poly_bck_diad2,
|
3971
3982
|
lower_bck=config1.lower_bck_diad2, upper_bck=config1.upper_bck_diad2, plot_figure=False)
|
3972
3983
|
|
3973
3984
|
|