cana.spectools.slopetool¶
Tool for measuring spectral slope.
Functions
slope(spec[, wmin, wmax, norm, errormethod, …]) |
Calculate the spectral gradient. |
Classes
Slope([wmin, wmax, norm]) |
Calculate the spectral gradient of a spectrum. |
SlopeValue(model, spec, slp[, slp_unc, label]) |
Representation of a slope mesurement. |
-
class
cana.spectools.slopetool.Slope(wmin=0.4, wmax=0.9, norm=0.55)[source]¶ Calculate the spectral gradient of a spectrum.
Methods
measure(spec[, error, label])Calculate the slope in a spectral region. -
measure(spec, error=<cana.spectools.uncertainties.SpecError object>, label=None)[source]¶ Calculate the slope in a spectral region.
If the “error” is set as True, then uses a Monte-Carlo model to estimate the error in the slope.
Parameters: - spec: Spectrum
The spectrum object
- error: SpecError
The model to estimate the slope uncertainty.
- label: str (optional)
The label of the spectrum. This is just to organize the output.
Returns: - slp: The slope value.
If error==True, then also returns the uncertainty.
-
-
class
cana.spectools.slopetool.SlopeValue(model, spec, slp, slp_unc=None, label=None)[source]¶ Representation of a slope mesurement.
Methods
plot([fax, show, savefig, axistitles, …])Plot the Spectrum and the measured slope. -
plot(fax=None, show=True, savefig=None, axistitles=True, speckwargs=None, slopekwargs=None, legendkwargs=None)[source]¶ Plot the Spectrum and the measured slope.
Parameters: - fax (Optional): matplotlib.axes
If desired to subplot image in a figure. Default is ‘None’, which will open a new plt.figure()
- show (Optional): boolean
True if want to plt.show().
- savefig (Optional): str
The path to save the figure. If set to None, wont save the figure.
- **kwargs: See matplotlib.pyplot.plot kwargs
-
-
cana.spectools.slopetool.slope(spec, wmin=0.4, wmax=0.9, norm=0.55, errormethod='rms', error_param=None, montecarlo=1000, speckwargs=None)[source]¶ Calculate the spectral gradient.
Parameters: - spec: Spectrum, spectrum file, spectrum file list
The input can be a Spectrum object, a spectrum file or a list of spectrum files
- wmin: float
wavelength lower limit for the adjust. Default: 0.4
- wmax: float
wavelength upper limit for the adjust. Default: 0.9
- norm: float
The wavelength for normalizing the slope. Default: 0.55
- errormethod: ‘rms’, ‘removal’ or ‘bin’
The error methodology that will be applied for estimating the slope error. Default is ‘rms’
- error_param: None or float
The error methodoly parameter if needed. If errormethod=’rms’, then no value is necessary. If it is set for removal, the percentage of points to remove. For rebin, the param represents the binsize.
- montecarlo: integer
Default is 1000
Returns: - slp: SlopeValue or Pandas.DataFrame
For a single spectrum it will return a SlopeValue For a list of spectra, returns a pandas.DataFrame with the results.