adler.science.PhaseCurve
Attributes
Classes
A class to define the phasecurve model and associated functions. |
Module Contents
- class PhaseCurve(H=18, phase_parameter_1=0.2, phase_parameter_2=None, model_name='HG', H_err=None, phase_parameter_1_err=None, phase_parameter_2_err=None)[source]
A class to define the phasecurve model and associated functions. Units - by default no units are set but astropy units can be passed. It is up to the user to ensure that units are correct for the relevant phasecurve model.
- phase_parameter_1[source]
The first phase parameter of the phasecurve model, e.g. G from HG (often dimensionless units unless S from LinearPhaseFunc, which has units mag/deg or mag/rad).
- Type:
float
- phase_parameter_2[source]
The second phase parameter, only used for the 3 parameter HG1G2 phasecurve model.
- Type:
float
- model_name[source]
Label for the phasecurve model to be used. Choice of: “HG”, “HG1G2”, “HG12”, “HG12_Pen16”, “LinearPhaseFunc”
- Type:
str
- bounds
Flag for using the default bounds on the sbpy model (True) or ignoring bounds (False).
- Type:
bool
- phase_parameter_2_err[source]
Uncertainty in the (second, if required) phase parameter.
- Type:
float
- SetModelBounds(param, bound_vals=(None, None))[source]
Set the “bounds” attribute of an sbpy model parameter, i.e. the lower and upper constraints for the fitter.
- Parameters:
param (str) – Parameter name bounds to be set fix, if not an sbpy parameter name (e.g. G) the corresponding adler name is looked up (e.g. phase_parameter_1)
bound_vals (tuple) – Set the fitter constraints to (upper, lower) for the param.
- FixParam(param, fix_flag=True)[source]
Set the “fixed” attribute of an sbpy model parameter. E.g. use this to fit for absolute magnitude whilst keeping phase parameter fixed.
- Parameters:
param (str) – Parameter name to fix, if not an sbpy parameter name (e.g. G) the corresponding adler name is looked up (e.g. phase_parameter_1)
fix_flag (bool) – Set True to keep the param fixed when fitting
- ReturnModelDict()[source]
Return the values for the PhaseCurve class as a dict
- Returns:
self.__dict__ – The dict of PhaseCurve object parameters.
- Return type:
dict
- ReturnParamStr(err=False)[source]
Return a string with the PhaseCurve model parameters. Useful for plot labels etc.
- Parameters:
err (bool) – Flag which controls if label is generated with uncertainties
- Returns:
label – A label containing the PhaseCurve parameters.
- Return type:
str
- InitModelDict(model_dict)[source]
Set up a new PhaseCurve model object from a dictionary. This could be written by the user or generated from another PhaseCurve object using ReturnModelDict
- Parameters:
model_dict (dict) – Dictionary containing the PhaseCurve parameters you wish to set, e.g. H, phase_parameter_1
- Returns:
model – The new PhaseCurve class object
- Return type:
object
- InitModelSbpy(model_sbpy)[source]
Set up a new PhaseCurve model object from an existing sbpy model ### TODO or create dict from sbpy model and then use InitModelDict?
- Parameters:
model_sbpy (object) – The sbpy model object, e.g. HG()
- Returns:
model – The new PhaseCurve class object
- Return type:
object
- ReducedMag(phase_angle)[source]
Return the reduced magnitude of the phasecurve model for a given phase angle(s)
phase_angle - value or array, must have astropy units of degrees
- Parameters:
phase_angle (float or array) – value or array of phase angles at which to evaluate the phasecurve model. Must have astropy units of degrees if sbpy model uses units, otherwise pass radian values.
- Returns:
return_value – The phasecurve model reduced magnitude at the given phase angle(s)
- Return type:
float or array
- ReducedMagBounds(phase_angle, std=1)[source]
Accounting for the parameter uncertainties, return the minimum and maximum reduced magnitudes of the phasecurve model for a given phase angle(s). This is done by determining the minimum and maximum values of each parameter given the uncertainty (and some std, assuming a gaussian distribution). A PhaseCurve model is made for all unique combinations of the min, max of each parameter. For each PhaseCurve model the ReducedMag is calculated; the overall min/max ReducedMag is determined at each phase angle.
- Parameters:
phase_angle (float or array) – value or array of phase angles at which to evaluate the phasecurve model. Must have astropy units of degrees if sbpy model uses units, otherwise pass radian values.
std (float) – Number of standard deviations we want to consider when determining the minimum/maximum parameter values, where we assume that the parameter uncertainty is representative of a 1 sigma std in a gaussian distribution.
- Returns:
pc_bounds – mag_min - The minimum reduced magnitude of all PhaseCurve models at every phase angle mag_max - The maximum reduced magnitude of all PhaseCurve models at every phase angle mag_mean - The mean reduced magnitude of all PhaseCurve models at every phase angle PhaseCurves - A list of all unique PhaseCurve models given the possible combinations of parameters and their uncertainties
- Return type:
dict
- ModelResiduals(phase_angle, reduced_mag)[source]
For a set of phase curve observations, return the residuals to the PhaseCurve model. NB that units must match the sbpy model. E.g. phase_angle should be passed with units of degrees, or be in values of radians
- Parameters:
phase_angle (float or array) – value or array of phase angles at which to evaluate the phasecurve model.
reduced_mag (float or array) – value or array of reduced magnitudes at which to evaluate the phasecurve model.
- Returns:
residuals – The residuals of the observations minus PhaseCurve model values
- Return type:
float or array
- AbsMag(phase_angle, reduced_mag)[source]
For a set of phase curve observations, return the absolute magnitude from the fitted phase curve model. I.e. this is the model residuals, shifted by the fitted absolute magnitude NB that units for phase_angle and reduced_mag must match the sbpy model. E.g. phase_angle should be passed with units of degrees, or be in values of radians
- Parameters:
phase_angle (float or array) – value or array of phase angles at which to evaluate the phasecurve model.
reduced_mag (float or array) – value or array of reduced magnitudes at which to evaluate the phasecurve model.
- Returns:
abs_mag – The residuals of the observations minus PhaseCurve model values shifted by the model absolute magnitude
- Return type:
float or array
- FitModel(phase_angle, reduced_mag, mag_err=None, fitter=None, resample=None)[source]
Fit the phasecurve model parameters to observations. starts with a phase curve model as an initial guess for parameters. fits model to phase angle and reduced magnitude.
phase_angle - phase angle of each observations reduced_mag - distance corrected reduced magnitudes mag_err - photometric uncertainties to weight the measurements fitter - can pass a fitting function from astropy.modeling.fitting, defaults to astropy.modeling.fitting.LevMarLSQFitter
- Parameters:
phase_angle (float or array) – The Sun-object-observer phase angles of the observations.
reduced_mag (float or array) – The observed reduced magnitudes at the corresponding phase angles.
mag_err (float or array) – Uncertainty on the reduced magnitude, used to weight the fit.
fitter (object) – Select a fitting function from astropy.modeling.fitting, defaults to astropy.modeling.fitting.LevMarLSQFitter. N.B. that LevMarLSQFitter cannot handle inequality constraints for the HG1G2 model, use something like SLSQPLSQFitter from astropy.modeling.fitting (does not return covariance matrix!).
resample (int) – Optional - if passed this forces a monte carlo resampling of data points within their uncertainties. This the number of times to resample and fit the phase curve. The phase curve parameter value and uncertainties are determined from the mean and std of the fitted values respectively.
- Returns:
model_fit – The sbpy phasecurve model object
- Return type:
object