BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class AstropyModel( Model )Source

Wrapper for Astropy Models, so they can be used in BayesicFitting.

Examples

from astropy.modelling.models import Gaussian1D
gm = Gaussian1D( mean=0, stddev=1, amplitude=1 )

gauss = AstropyModel( gm )
print( gauss )
AstropyModel( Gauss1D )
print( gauss.getNumberOfParameters( ) )
3
print( gauss( numpy.linspace( -5, 5, 11 ) ) )
[  3.72665317e-06   3.35462628e-04   1.11089965e-02   1.35335283e-01
   6.06530660e-01   1.00000000e+00   6.06530660e-01   1.35335283e-01
   1.11089965e-02   3.35462628e-04   3.72665317e-06]

Attributes

  • astromodel : astropy.modeling.FittableModel
         The astropy model to be wrapped

Attributes from Model

     npchain, parameters, stdevs, xUnit, yUnit

Attributes from FixedModel

     npmax, fixed, parlist, mlist

Attributes from BaseModel

     npbase, ndim, priors, posIndex, nonZero, tiny, deltaP, parNames

AstropyModel( astromodel, copy=None, **kwargs )

Gaussian model.

Number of parameters is 3.

Parameters

  • fitmodel : FittableModel
         FittableModel from astropy.modeling
  • copy : GaussModel
         to be copied
  • fixed : None or dictionary of {int:float|Model}
         int index of parameter to fix permanently.
         float|Model values for the fixed parameters.
         Attribute fixed can only be set in the constructor.
         See: FixedModel

copy( )

Copy method.

baseResult( xdata, params )
Returns the result of the model function.

Parameters

  • xdata : array_like
         values at which to calculate the result
  • params : array_like
         values for the parameters.

basePartial( xdata, params, parlist=None )
Returns the partials at the input value.

Parameters

  • xdata : array_like
         values at which to calculate the partials
  • params : array_like
         values for the parameters.
  • parlist : array_like
         list of indices active parameters (or None for all)

baseDerivative( xdata, params )
Return the derivative df/dx at each xdata (=x).

Parameters

  • xdata : array_like
         values at which to calculate the result
  • params : array_like
         values for the parameters.

baseName( )
Returns a string representation of the model.
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel