Instances of Parameter represent abstract model parameters, both free and fixed/derived variables.

class xpsi.Parameter.Parameter(name, strict_bounds, bounds=(None, None), doc=None, symbol='', value=None, permit_prepend=True, deactivate_verbosity=False, is_hyperparameter=False)[source]

A parameter.

  • name (str) – A unique parameter name for identification in attribute lookup.

  • strict_bounds (tuple) – One 2-tuple of hard bounds per parameter. Can be unbounded in principle, but read the documentation for the Prior class first.

  • bounds (tuple) – One 2-tuple of hard bounds per parameter. Can be unbounded in principle, but read the documentation for the Prior class first.

  • permit_prepend (bool) – Allow encapsulating subspaces to prepend the parameter name with a prefix? Note that this gives permission recursively to all encapsulating subspaces higher in the hierarchy.

  • is_hyperparameter (bool) – A boolean declaring whether the parameter is a hyperparameter.


Update or get current point if the parameter is free.


p (array-like) – New point to update to. If None, the current point is returned.


Current point (if the call was not an update).

Return type:



AttributeError – If parameter is derived or has no value yet but the argument is None.


Get a string summary of the parameter and current value.


Redirect to the magic doctring.

property bounds

Get the hard bounds of the parameter.

property cached

Get the cached value.

property doc

Redirect to the magic docstring.


Symlink to property pending dynamic overwrite.


caller (obj) – An object, such as the calling class itself, used to transfer information from higher in the hierarchy.

Overwrite if value must be explicitly computed from other variables and parameters. That is, subclass Derive, instantiate, and pass as a callable to the initialiser of the present class as a value of a derived parameter. The callable will automatically replace the bound variant of this present method and will have access to some caller object, plus other references (class and/or instance) attributes you define in the subclass.

property fixed

Is the variable fixed (or derived) or a free parameter?

property is_hyperparameter

Is the variable a hyperparameter?

property name

Get the name of the parameter.

property needs_update

Do cached dependencies need to be updated?

property permit_prepend

Allow subspaces to prepend parameter with prefixes?

property strict_bounds

Get the strict bounds of the parameter.

property symbol

Get TeX-compatible symbol.

property value

Get the current parameter value.

class xpsi.Parameter.Derive(refs)[source]

Helper class to bind to parameter instances as a method.

This is a powerful abstract base class for customisting how derived parameters are evaluated from references to existing parameter objects.


refs (obj) – Some references to parameter objects or subspace objects that need to be stored for deriving variable values. For example, a dictionary with key-ref pairs.


In principle, it might be the case that the calling parameter subspace does not have references to other parameter objects required, and that distinct subspaces require mutual references to each other. An example would be two hot regions, each of which has one or more parameters that are derived in part from parameters of the other hot region. In this case you need to instantiate the subspaces first by binding instances of this present class to parameters. However, you then need to complete these instances of this present class (or more precisely instances of subclasses) with the required references. As an example, consider the following:

bounds = dict(super_colatitude = (None, None),
              super_radius = (None, None),
              super_temperature = (None, None))

class derive(xpsi.Derive):
    def __init__(self):

    def __call__(self, boundto, caller = None):
        # ref is a reference to another hot region object
        return self.ref['phase_shift'] - 0.5

ref_1 = derive()

# a simple circular, simply-connected spot
primary = xpsi.HotRegion(bounds=bounds,
                            values={'phase_shift': ref_1},

bounds = dict(omit_colatitude = (None, None),
              super_radius = (None, None),
              phase_shift = (None, None),
              super_temperature = (None, None),
              omit_radius = (None, None),
              omit_azimuth = (None, None))

class derive(xpsi.Derive):
    def __init__(self):

    def __call__(self, boundto, caller = None):
        return math.pi - self.ref['super_colatitude']

ref_2 = derive()

# overlap of an omission region and
# and a radiating super region
secondary = xpsi.HotRegion(bounds=bounds,
                              values={'super_colatitude': ref_2},

from xpsi import HotRegions

hot = HotRegions((primary, secondary))

# the crux: resolve the mutual refs
ref_1.ref = secondary
ref_2.ref = primary
abstract __call__(boundto, caller=None)[source]

Derive value from some parameters.

The second argument is the parameter object to which this callable is bound. The third argument is a subspace from which the call comes, which might be useful or even sufficient for retrieving the required information, in which case write an initialiser with pass as the body.