Skip to content

Commit

Permalink
Fixed LW to HW bug and more sensible sample names given
Browse files Browse the repository at this point in the history
  • Loading branch information
PennyWieser committed Sep 5, 2024
1 parent f27bcd8 commit 875bc8e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
================
Change Log
================
Sept 4th, 2024 - Penny Wieser - V.1.0.3
-------------------------------------------
Changed column names in H2O method from HW:LW_Trapezoid and HW:LW_Simpson to Water_to_HW_ratio_Trapezoid and Water_to_HW_ratio_Simpson
Was also a bug where LW area was being populated in the HW area column in the output dataframe.


Publication version Penny Wieser - V.1.0.1
-------------------------------------------
Updated code to allow for fitting of standards as a seperate groups
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Welcome to DiadFits documentation!
installation
importing_data
pythonjargon
badpeakfits
ChangeLog

.. toctree::
Expand Down
20 changes: 12 additions & 8 deletions src/DiadFit/H2O_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ def fit_area_for_silicate_region(*, path, filename, Spectra=None,
xspace_sil=xdat_sil[1]-xdat_sil[0]
area_trap = trapezoid(y_corr_sil, dx=xspace_sil)
area_simps = simpson(y_corr_sil, dx=xspace_sil)

# Just the LW area
xsil_LW=xdat_sil[(xdat_sil>LW[0]) & (xdat_sil<LW[1])]
y_corr_sil_LW=y_corr_sil[(xdat_sil>LW[0]) & (xdat_sil<LW[1])]
Expand Down Expand Up @@ -966,8 +967,8 @@ def fit_area_for_silicate_region(*, path, filename, Spectra=None,
'Silicate_Simpson_Area': area_simps,
'LW_Silicate_Trapezoid_Area':area_trap_LW,
'LW_Silicate_Simpson_Area':area_simp_LW,
'HW_Silicate_Trapezoid_Area':area_trap_LW,
'HW_Silicate_Simpson_Area':area_simp_LW,
'HW_Silicate_Trapezoid_Area':area_trap_HW,
'HW_Silicate_Simpson_Area':area_simp_HW,
}, index=[0])

if MW is not None:
Expand Down Expand Up @@ -1039,7 +1040,8 @@ def fit_area_for_water_region(*, path, filename, Spectra=None, config1: water_bc
Returns
-------
pd.DataFrame
DataFrame with columns for 'Water_Trapezoid_Area', 'Water_Simpson_Area', as well as parameters for the selected background positions
DataFrame with columns for different areas, and parameters for choosen background positions.
"""
Water=Spectra
Expand Down Expand Up @@ -1242,7 +1244,9 @@ def stitch_dataframes_together(df_sil, df_water, MI_file, Host_file=None, save_
Returns
-----------
pd.DataFrame
DataFrame with columns for MI filename, HW:LW_Trapezoid, HW:LW_Simpson, Water_Trapezoid_Area,
DataFrame with columns for MI filename,
HW:LW_Trapezoid (Water Trapezoid area divided by HW region of silicate melt, using the trapezoid method to get area under the curve.
HW:LW_Simpson, Water_Trapezoid_Area,
Water_Simpson_Area, Silicate_Trapezoid_Area, and Silicate_Simpson_Area.
If Host_file is provided,
the DataFrame will also include a column for Host filename.
Expand All @@ -1253,16 +1257,16 @@ def stitch_dataframes_together(df_sil, df_water, MI_file, Host_file=None, save_
if Host_file is not None:
Combo_Area.insert(0, 'Host filename', Host_file)
Combo_Area.insert(1, 'MI filename', MI_file)
Combo_Area.insert(2, 'HW:LW_Trapezoid',
Combo_Area.insert(2, 'Water_to_HW_ratio_Trapezoid',
Combo_Area['Water_Trapezoid_Area']/Combo_Area['HW_Silicate_Trapezoid_Area'])
Combo_Area.insert(3, 'HW:LW_Simpson',
Combo_Area.insert(3, 'Water_to_HW_ratio_Simpson',
Combo_Area['Water_Simpson_Area']/Combo_Area['HW_Silicate_Simpson_Area'])

if Host_file is not None:
cols_to_move=['Host filename', 'MI filename', 'HW:LW_Trapezoid', 'HW:LW_Simpson',
cols_to_move=['Host filename', 'MI filename', 'Water_to_HW_ratio_Trapezoid', 'Water_to_HW_ratio_Simpson',
'Water_Trapezoid_Area', 'Water_Simpson_Area', 'Silicate_Trapezoid_Area', 'Silicate_Simpson_Area']
else:
cols_to_move=['MI filename', 'HW:LW_Trapezoid', 'HW:LW_Simpson',
cols_to_move=['MI filename', 'Water_to_HW_ratio_Trapezoid', 'Water_to_HW_ratio_Simpson',
'Water_Trapezoid_Area', 'Water_Simpson_Area', 'Silicate_Trapezoid_Area', 'Silicate_Simpson_Area']


Expand Down
2 changes: 1 addition & 1 deletion src/DiadFit/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module
__version__ = '1.0.2'
__version__ = '1.0.3'

0 comments on commit 875bc8e

Please sign in to comment.