Skip to content

Framework for building a spectral library and performing linear spectral modelling on planetary surface spectra

Notifications You must be signed in to change notification settings

RyleighDavis/LinearSpectralModelling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinearSpectralModelling

Framework for building a spectral library and performing linear spectral modelling on planetary surface spectra

Add a new laboratory spectra to the library

To add a new spectrum to the spectral library, first create a LibrarySpectrum class object with the information about the spectra. Then use the save method to add your spectrum to the library.

import numpy as np
import pandas as pd
from SpectralLibrary import spectral_library_utils as lib

filenm = 'example_library.hdf5' #spectral library file

data = np.loadtxt('Examples/NaCl_80K.txt', skiprows=4)
spec = lib.LibrarySpectrum(name = 'sodium chloride'
                           ,chemical_formula = 'NaCl'
                           ,temp = 80. #K
                           ,grain_size = np.array([20,50])
                           ,spec_type = 'lab'
                           ,hydration = 0 #anhydrous
                           ,spec_features = np.array([]) #empty if no features of note
                           ,source = 'https://agupubs.onlinelibrary.wiley.com/action/downloadSupplement?doi=10.1002%2F2013JE004565&file=jgre20327-sup-0014-dataSetS13.txt'
                           ,citation = 'Hanley et al (2014)'
                           ,wavelength = data[:,0] #um
                           ,albedo = data[:,1]
                           )
spec.save('Examples/'+filenm) #overwrite=True only if you want to replace an existing object with the same name

Read in spectral library to pandas dataframe

df = lib.load_dataframe(filenm)
df
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
name chemical_formula temp grain_size spec_type hydration spec_features source citation wavelength albedo
0 sodium chloride NaCl 80.0 [20, 50] lab 0 [] https://agupubs.onlinelibrary.wiley.com/action... Hanley et al (2014) [0.35, 0.351, 0.352, 0.353, 0.354, 0.355, 0.35... [0.256260774, 0.258040028, 0.260486898, 0.2613...

About

Framework for building a spectral library and performing linear spectral modelling on planetary surface spectra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published