run_tolerances¶
- marxs.design.tolerancing.run_tolerances(photons_in, instrum, wigglefunc, wiggleparts, parameters, analyzefunc)[source]¶
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.Sequenceobject An instance of the instrument which contains all elements that
photons_instill 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
instrumwith the following calling signature:wigglefunc(wiggleparts, pars)whereparsis one dict fromparameters. Note that this function is called withwigglepartswhich can be the same asinstrumor just a subset.- wiggleparts
marxs.base.SimulationSequenceElementinstance Element which is modified by
wigglefunc. Typically this is a subset ofinstrum. For example, to tolerance the mirror alignmentswigglepartswould just be the mirror objects, whileinstrumwould 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.CaptureResAeffinstance.
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.
- photons_in