upd API
This commit is contained in:
parent
12922f0f79
commit
a9df27b7c7
13 changed files with 43 additions and 40 deletions
|
@ -2,8 +2,8 @@ import numpy as np
|
|||
|
||||
|
||||
def load_spectrum(spectrum_path,
|
||||
lambda_min=0,
|
||||
lambda_max=np.inf,
|
||||
wavelength_min=0,
|
||||
wavelength_max=np.inf,
|
||||
delimiter=','):
|
||||
"""
|
||||
Load a spectrum file.
|
||||
|
@ -15,10 +15,10 @@ def load_spectrum(spectrum_path,
|
|||
----------
|
||||
spectrum_path : string
|
||||
File path.
|
||||
lambda_min : scalar, optional
|
||||
Cut the data at this minimum wavelength in nm.
|
||||
lambda_max : scalar, optional
|
||||
Cut the data at this maximum wavelength in nm.
|
||||
wavelength_min : scalar, optional
|
||||
Cut the data at this minimum wavelength (included).
|
||||
wavelength_max : scalar, optional
|
||||
Cut the data at this maximum wavelength (included).
|
||||
delimiter : string, optional
|
||||
Delimiter between columns in the datafile.
|
||||
|
||||
|
@ -30,5 +30,5 @@ def load_spectrum(spectrum_path,
|
|||
data = np.loadtxt(spectrum_path, delimiter=delimiter)
|
||||
lambdas, intensities = np.column_stack(data)
|
||||
|
||||
mask = (lambdas > lambda_min) & (lambdas < lambda_max)
|
||||
mask = (lambdas >= wavelength_min) & (lambdas <= wavelength_max)
|
||||
return lambdas[mask], intensities[mask]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue