FitResults
- class mcalf.models.FitResults(shape, n_parameters, time=None)[source]
Bases:
object
Class that holds multiple fit results in a way that can be easily processed.
- Parameters:
shape (tuple of int) – The number of rows and columns to hold data for, e.g. (n_rows, n_columns).
n_parameters (int) – The number of fitted parameters per spectrum that need to be stored.
time (int, optional, default=None) – The time the FitResults object will store data for. Optional, but if it is set, only
FitResult
objects with a matching time can be appended.
- parameters
Array of fitted parameters.
- Type:
numpy.ndarray, shape=(row, column, parameter)
- classifications
Array of classifications.
- Type:
numpy.ndarray of int, shape=(row, column)
- profile
Array of profiles.
- Type:
numpy.ndarray of str, shape=(row, column)
- success
Array of success statuses.
- Type:
numpy.ndarray of bool, shape=(row, column)
- chi2
Array of chi-squared values.
- Type:
numpy.ndarray, shape=(row, column)
Methods Summary
append
(result)Append a
FitResult
object to the FitResults object.save
(filename[, model])Saves the FitResults object to a FITS file.
velocities
(model[, row, column, vtype])Calculate the Doppler velocities of the fit results using model parameters.
Methods Documentation
- save(filename, model=None)[source]
Saves the FitResults object to a FITS file.
- Parameters:
filename (file path, file object or file-like object) – FITS file to write to. If a file object, must be opened in a writeable mode.
model (child class of mcalf.models.ModelBase, optional, default=None) – If provided, use this model to calculate and include both quiescent and active Doppler velocities. The stationary line core value will also be added to the SLC card in the primary HDU header.
Notes
Saves a FITS file to the location specified by filename. All the parameters are stored in a separate, named, HDU.
- velocities(model, row=None, column=None, vtype='quiescent')[source]
Calculate the Doppler velocities of the fit results using model parameters.
- Parameters:
model (child class of mcalf.models.ModelBase) – The model object to take parameters from.
row (int, list, array_like, iterable, optional, default=None) – The row indices to find velocities for. All if omitted.
column (int, list, array_like, iterable, optional, default=None) – The column indices to find velocities for. All if omitted.
vtype ({'quiescent', 'active'}, default='quiescent') – The velocity type to find.
- Returns:
velocities – The calculated velocities for the specified row and column positions.
- Return type:
numpy.ndarray, shape=(row, column)