astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- Models And Fitting (`astropy.modeling`) »
- ParametricModel

# ParametricModel

class `astropy.modeling.core.``ParametricModel`(**kwargs)

  Bases: `astropy.modeling.core.Model`

  Base class for all fittable models.

  Parameters:

  param_dim : int

  > number of parameter sets

  fittable : bool

  > indicator if the model is fittable

  fixed : a dict

  > a dictionary `{parameter_name: boolean}` of parameters to not be varied during fitting. True means the parameter is held fixed. Alternatively the `fixed` property of a parameter may be used.

  tied : dict

  > a dictionary `{parameter_name: callable}` of parameters which are linked to some other parameter. The dictionary values are callables providing the linking relationship. Alternatively the `tied` property of a parameter may be used.

  bounds : dict

  > a dictionary `{parameter_name: boolean}` of lower and upper bounds of parameters. Keys are parameter names. Values are a list of length 2 giving the desired range for the parameter. Alternatively the `min` and `max` properties of a parameter may be used.

  eqcons : list

  > A list of functions of length n such that `eqcons[j](x0, *args) == 0.0` in a successfully optimized problem.

  ineqcons : list

  > A list of functions of length n such that `ieqcons[j](x0, *args) >= 0.0` is a successfully optimized problem.

  Notes

  All models which can be fit to data should subclass this class.

  Sets the `parameters` attributes.

  Examples

      >>> from astropy.modeling import models
      >>> def tie_center(model):
      ...         mean = 50 * model.stddev
      ...         return mean
      >>> tied_parameters = {'mean': tie_center}

  Specify that `'mean'` is a tied parameter in one of two ways:

      >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,
      ...                             tied=tied_parameters)

  or

      >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)
      >>> g1.mean.tied
      False
      >>> g1.mean.tied = tie_center
      >>> g1.mean.tied
      <function tie_center at 0x...>

  Fixed parameters:

      >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,
      ...                             fixed={'stddev': True})
      >>> g1.stddev.fixed
      True

  or

      >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)
      >>> g1.stddev.fixed
      False
      >>> g1.stddev.fixed = True
      >>> g1.stddev.fixed
      True

  Attributes Summary

  `bounds` |
  `col_deriv` | bool(x) -> bool
  `deriv` |
  `eqcons` |
  `fittable` | bool(x) -> bool
  `fixed` | A dictionary mapping parameter names to their fixed constraint
  `ineqcons` |
  `linear` | bool(x) -> bool
  `parameters` | A flattened array of all parameter values in all parameter sets Fittable parameters maintain this list and fitters modify it.
  `tied` | A dictionary mapping parameter names to their tied constraint

  Methods Summary

  `set_joint_parameters`(jparams) | Used by the `JointFitter` class to store parameters which are considered common for several models and are to be fitted together.

  Attributes Documentation

  `bounds`
  `col_deriv` = True
  `deriv` = None
  `eqcons`
  `fittable` = True
  `fixed`

    A dictionary mapping parameter names to their fixed constraint

  `ineqcons`
  `linear` = False
  `parameters`

    A flattened array of all parameter values in all parameter sets

    Fittable parameters maintain this list and fitters modify it.

  `tied`

    A dictionary mapping parameter names to their tied constraint

  Methods Documentation

  `set_joint_parameters`(jparams)

    Used by the `JointFitter` class to store parameters which are considered common for several models and are to be fitted together.