pynbody.simdict

pynbody.simdict#

simdict#

This submodule defines an augmented dictionary class (SimDict) for SimSnap properties where entries need to be managed e.g. for defining default entries, or for ensuring consistency between equivalent properties like redshift and scalefactor.

By default, a SimDict automatically converts between redshift (‘z’) and scalefactor (‘a’) and implements default entries for cosmological values listed in the [default-cosmology] section of the pynbody configuration files.

Adding further properties#

To add further properties use the SimDict.getter and SimDict.setter decorators. For instance, to add a property ‘X_copy’ which just reflects the value of the property ‘X’, you would use the following code:

@SimDict.getter
def X_copy(d) :
    return d['X']

@SimDict.setter
def X_copy(d, value) :
    d['X'] = value

Functions

default_fn(name, value)

Return a getter function for the default name/value pair

Classes

SimDict

Methods