Skip to content

Commit

Permalink
PyIRoGlass v0.6.1!
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahshi committed Apr 4, 2024
1 parent 0f79149 commit 90fd57d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ __pycache__
/Baseline_Comparison/ND70Spec/
/Baseline_Comparison/ND70_Merge.pdf
/Baseline_Comparison/Comparison_Standards.csv
/Baseline_Comparison/BLChem.pdf
/Baseline_Comparison/BLChem_lim.pdf
/docs/examples/transmission_ftir/LOGFILES/RESULTS/AC4_OL49_021920_30x30_H2O_a.log
/docs/examples/transmission_ftir/LOGFILES/RESULTS/AC4_OL53_101220_256s_30x30_a.log
/docs/examples/transmission_ftir/LOGFILES/RESULTS/STD_D1010_012821_256s_100x100_a.log
Expand All @@ -35,7 +37,7 @@ __pycache__
/docs/examples/transmission_ftir/LOGFILES/RESULTS/AC4_OL53_101220_256s_30x30_a.log
/docs/examples/transmission_ftir/LOGFILES/RESULTS/STD_D1010_012821_256s_100x100_a.log
/Epsilon_Inversion/OldEpsilonRegressions/
/Inputs/TransmissionSpectra/Devolatilized
/Inputs/TransmissionSpectra/BadSpectra/
/Thickness/FuegoOlMicrometer.csv
/Thickness/FuegoOlThickness.csv
/Thickness/ND70_Micrometer.csv
Expand Down
Binary file added Baseline_Comparison/BLChem_lim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Baseline_PCA/BaselinePC_Vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def rescale_peak(abs, range):
fig.supxlabel('Wavenumber ($\mathregular{cm^{-1}}$)', y=0.03)
fig.supylabel('Absorbance', x = 0.05)
plt.tight_layout()
plt.savefig('AllBaselines1.pdf', bbox_inches='tight', pad_inches = 0.025)
# plt.savefig('AllBaselines.pdf', bbox_inches='tight', pad_inches = 0.025)

# %%

Expand Down
2 changes: 1 addition & 1 deletion Baseline_PCA/H2OmPC_Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def basic_scale_data(spectrum):
Returns:
spectrum_scale (numeric 2D array): The data after scaling to the range
of -0.5 to 0.5 and recentring by the mean spectrum.
of -0.5 to 0.5 and recentering by the mean spectrum.
mean_baseline (numeric array): The mean baseline spectrum across all
observations after scaling.
"""
Expand Down
2 changes: 1 addition & 1 deletion Epsilon_Inversion/Epsilon_Comp_Regress.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,6 @@

fig.delaxes(ax[5])
plt.tight_layout()
plt.savefig('AllEpsilonRegress_SHI1.pdf', bbox_inches='tight', pad_inches=0.025)
# plt.savefig('AllEpsilonRegress_SHI.pdf', bbox_inches='tight', pad_inches=0.025)

# %%
14 changes: 9 additions & 5 deletions PyIRoGlass_RUN.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,37 @@
# %%

# Get working paths
path_input = os.getcwd() + '/Inputs/'
path_input = os.path.join(os.getcwd(), 'Inputs')

# Change paths to direct to folder with SampleSpectra -- last bit should be whatever your folder with spectra is called.
PATHS = [path_input + 'TransmissionSpectra/' + string for string in ['Fuego/', 'Standards/', 'Fuego1974RH/']]
PATHS = [os.path.join(path_input, 'TransmissionSpectra', directory)
for directory in ['Fuego', 'Standards', 'Fuego1974RH']]

# Put ChemThick file in Inputs. Direct to what your ChemThick file is called.
CHEMTHICK_PATHS = [path_input + string for string in ['FuegoChemThick.csv', 'StandardChemThick.csv', 'FuegoRHChemThick.csv']]
CHEMTHICK_PATHS = [os.path.join(path_input, filename)
for filename in ['FuegoChemThick.csv', 'StandardChemThick.csv', 'FuegoRHChemThick.csv']]

# Change last value in list to be what you want your output directory to be called.
OUTPUT_PATHS = ['FUEGO', 'STD', 'FRH']

# %%
# %%

ref_ol_loader = pig.SampleDataLoader(spectrum_path=path_input+'ReflectanceSpectra/FuegoOl/')
ref_ol_loader = pig.SampleDataLoader(spectrum_path=os.path.join(path_input, 'ReflectanceSpectra/FuegoOl'))
ref_ol_dfs_dict = ref_ol_loader.load_spectrum_directory(wn_high=2700, wn_low=2100)

# Use DHZ parameterization of olivine reflectance index.
n_ol = pig.reflectance_index(0.72)
ref_fuego = pig.calculate_mean_thickness(ref_ol_dfs_dict, n=n_ol, wn_high=2700, wn_low=2100, plotting=False, phaseol=True)
display(ref_fuego)

ref_gl_loader = pig.SampleDataLoader(spectrum_path=path_input+'ReflectanceSpectra/rf_ND70/')
ref_gl_loader = pig.SampleDataLoader(spectrum_path=os.path.join(path_input, 'ReflectanceSpectra/rf_ND70'))
ref_gl_dfs_dict = ref_gl_loader.load_spectrum_directory(wn_high=2850, wn_low=1700)

# n=1.546 in the range of 2000-2700 cm^-1 following Nichols and Wysoczanski, 2007 for basaltic glass
n_gl = 1.546
ref_nd70 = pig.calculate_mean_thickness(ref_gl_dfs_dict, n=n_gl, wn_high=2850, wn_low=1700, plotting=False, phaseol=False)
display(ref_nd70)

# %%
# %%
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/reflectance_ftir/PyIRoGlass_Reflectance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"metadata": {},
"outputs": [],
"source": [
"FUEGO_THICK = pig.calculate_mean_thickness(REF_DFS_DICT_OL, n=n_ol, wn_high=2700, wn_low=2100, remove_baseline=True, plotting=True, phaseol=True)"
"FUEGO_THICK = pig.calculate_mean_thickness(REF_DFS_DICT_OL, n=n_ol, wn_high=2700, wn_low=2100, plotting=True, phaseol=True)"
]
},
{
Expand Down Expand Up @@ -195,7 +195,7 @@
"\n",
"n_gl = 1.546\n",
"\n",
"REF_GLASS = pig.calculate_mean_thickness(REF_DFS_DICT_GL, n=n_gl, wn_high=2850, wn_low=1700, remove_baseline=True, plotting=True, phaseol=False)\n",
"REF_GLASS = pig.calculate_mean_thickness(REF_DFS_DICT_GL, n=n_gl, wn_high=2850, wn_low=1700, plotting=True, phaseol=False)\n",
"\n",
"REF_GLASS\n"
]
Expand Down

0 comments on commit 90fd57d

Please sign in to comment.