Chain

class xspec.Chain(fileName, fileType=None, burn=None, runLength=None, proposal=None, rand=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
  • runLength
  • temperature
  • totalLength*
  • walkers

The following attribute settings will apply to the NEXT run for this chain: algorithm, runLength, proposal, 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, 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.

algorithm

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

burn

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

fileName

Chain output file name.

fileType

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

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.

rand

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

runLength

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

temperature

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

totalLength

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

walkers

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