run_tolerances¶
- marxs.design.tolerancing.run_tolerances(photons_in, instrum, wigglefunc, wiggleparts, parameters, analyzefunc)[source] [edit on github]¶
Run tolerancing calculations for a range of parameters
This function takes an instrument configuration and a function to change one aspect of it. For every change it runs a simulations and calculates a figure of merit. As the name indicates, this function is designed to derive alignment tolerances for certain instrument parts but it might be general enough for other parameter studies in instrument design.
- Parameters:
- photons_in
astropy.table.Table
Input photons list. To speed up the computation, it is useful if photon list has been run through all elements of the instrument that are located before the first element that is toleranced here.
- instrum
marxs.simulator.Sequence
object An instance of the instrument which contains all elements that
photons_in
still have to pass. This can include elements that are toleranced in this run and those that are located behind them.- wigglefunccallable
Function that modifies the
instrum
with the following calling signature:wigglefunc(wiggleparts, pars)
wherepars
is one dict fromparameters
. Note that this function is called withwiggleparts
which can be the same asinstrum
or just a subset.- wiggleparts
marxs.base.SimulationSequenceElement
instance Element which is modified by
wigglefunc
. Typically this is a subset ofinstrum
. For example, to tolerance the mirror alignmentswiggleparts
would just be the mirror objects, whileinstrum
would contain all the parts of the instrument that the photons need to run though up to the detector.- parameterslist of dicts
List of parameter values for calls to
wigglefunc
.- analyzefunccallable function or object
This is called with a photon table and should return a dictionary of results. This could be, e.g. a
marxs.analysis.gratings.CaptureResAeff
instance.
- photons_in
- Returns:
- resultlist of dicts
Each dict contains parameters and results for one run.
Notes
The format of input and output as lists of dicts is chosen because this would work well for a parallel version of this function which could have the same interface when it is implemented.