Chain

class xspec.Chain(fileName, fileType=None, burn=None, runLength=None, proposal=None, rand=None, rescale=None, temperature=None, algorithm=None, walkers=None)

Monte Carlo Markov Chain class.

Methods

  • __init__

  • run

  • show

Attributes ((*) = get-only)

  • algorithm

  • burn

  • fileName*

  • fileType*

  • proposal

  • rand

  • rescale

  • runLength

  • temperature

  • totalLength*

  • walkers

The following attribute settings will apply to the NEXT run for this chain: algorithm, runLength, proposal, rescale, temperature, burn, rand, walkers.

The algorithm, burn, rand, and walkers settings are irrelevant if run is performing an appending operation.

__init__(fileName, fileType=None, burn=None, runLength=None, proposal=None, rand=None, rescale=None, temperature=None, algorithm=None, walkers=None)
Construct a chain object, perform a run, and load into AllChains

container.

The only required argument is fileName. All other arguments will take their default values from the current settings in the AllChains container.

run(append=True)
Perform a new chain run, either appending to or overwriting an

existing chain.

Args:
append: If this is set to True the new run will be appended.

If False, the new run will overwrite. Note that the algorithm, burn, rand, and walkers settings do not apply when appending.

show()

Display current settings of Chain object's attributes.

property algorithm

The current chain algorithm. Valid settings are 'gw' (Goodman-Weare) or 'mh' (Metropolis-Hastings).

property burn

The number of steps that will be thrown away prior to storing the chain [int].

property fileName

Chain output file name.

property fileType

Output format of the chain file [string]. Will be either 'fits' (the default), or 'ascii'.

property proposal

The proposal distribution and source of covariance information to be used for the next run [string].

Examples: 'gaussian fit', 'cauchy fit','gaussian chain', etc.

See the 'chain' command in the standard XSPEC manual for more information.

property rand

Determines whether chain start point will be randomized (True) or taken from the current parameters (False).

property rescale

Determines whether a rescale fraction will be applied to the covariance matrix. [float] or None

property runLength

The length of chain to be added during the next run [int].

property temperature

The temperature parameter used in the Metropolis-Hastings algorithm for the proposal acceptance or rejection [float].

property totalLength

The cumulative length of the chain [int]. This will increase every time a run is performed.

property walkers

The number of walkers to be used for 'gw' chains [int].