ModelFactory

class specviz.interfaces.factories.ModelFactory[source]

Bases: specviz.interfaces.factories.Factory

Create a model

Notes

Ideally we should be getting these classes from astropy directly and transparently, instead of explicitly naming them here. This is basically a maintenance issue: at each new release of astropy we should check if new models became available, and existing models got deprecated.

This might not be possible unless astropy itself somehow manages to further subclass its Fittable1DModel class into spectrum-specific and other types. Right now we have a mix of spectral models, galaxy surface brightness models, and others, all lumped into a single type. Thus we have to keep picking the spectral relevant types by hand for the time being.

Attributes Summary

all_models

Methods Summary

create_model(name) Create a model

Attributes Documentation

all_models = {u'Scale': <class 'astropy.modeling.functional_models.Scale'> Name: Scale Inputs: (u'x',) Outputs: (u'x',) Fittable parameters: ('factor',), u'BrokenPowerLaw': <class 'astropy.modeling.powerlaws.BrokenPowerLaw1D'> Name: BrokenPowerLaw1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_break', 'alpha_1', 'alpha_2'), u'Linear': <class 'astropy.modeling.functional_models.Linear1D'> Name: Linear1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('slope', 'intercept'), u'LogParabola': <class 'astropy.modeling.powerlaws.LogParabola1D'> Name: LogParabola1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'alpha', 'beta'), u'Shift': <class 'astropy.modeling.functional_models.Shift'> Name: Shift Inputs: (u'x',) Outputs: (u'x',) Fittable parameters: ('offset',), u'Gaussian': <class 'astropy.modeling.functional_models.Gaussian1D'> Name: Gaussian1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'mean', 'stddev'), u'Const': <class 'astropy.modeling.functional_models.Const1D'> Name: Const1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude',), u'Lorentz': <class 'astropy.modeling.functional_models.Lorentz1D'> Name: Lorentz1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'fwhm'), u'GaussianAbsorption': <class 'specviz.analysis.models.gaussian_absorption.GaussianAbsorption'> Name: GaussianAbsorption Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'mean', 'stddev'), u'PowerLaw': <class 'astropy.modeling.powerlaws.PowerLaw1D'> Name: PowerLaw1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'alpha'), u'Voigt': <class 'astropy.modeling.functional_models.Voigt1D'> Name: Voigt1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('x_0', 'amplitude_L', 'fwhm_L', 'fwhm_G'), u'Box1D': <class 'astropy.modeling.functional_models.Box1D'> Name: Box1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'width'), u'MexicanHat': <class 'astropy.modeling.functional_models.MexicanHat1D'> Name: MexicanHat1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'sigma'), u'Trapezoid': <class 'astropy.modeling.functional_models.Trapezoid1D'> Name: Trapezoid1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'width', 'slope'), u'ExpCutoffPowerLaw': <class 'astropy.modeling.powerlaws.ExponentialCutoffPowerLaw1D'> Name: ExponentialCutoffPowerLaw1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'x_0', 'alpha', 'x_cutoff'), u'Sine': <class 'astropy.modeling.functional_models.Sine1D'> Name: Sine1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('amplitude', 'frequency', 'phase'), u'Spline': <class 'specviz.analysis.models.spline.Spline1D'> Name: Spline1D Inputs: (u'x',) Outputs: (u'y',) Fittable parameters: ('degree', 'smooth')}

Methods Documentation

classmethod create_model(name)[source]

Create a model

Parameters:name (str) – The name of the model desired.
Returns:model – The requested model. None if the requested model does not exist.
Return type:models