varyattribute¶
- marxs.design.tolerancing.varyattribute(element, **kwargs)[source]¶
Modify the attributes of an element.
This function modifies the attributes of an object. The keyword arguments are name and value of the attributes to be changed. This can be used for a wide variety of MARXS objects where the value of a parameter is stored as an instance attribute.
Parameters¶
- elementobject
Some optical component.
- kwargsdict
Attributes to be changed and their new values.
Examples¶
In a
marxs.optics.RadialMirrorScatterobject, the width of the scattering can be modified like this:>>> from astropy import units as u >>> from marxs.optics import RadialMirrorScatter >>> from marxs.design.tolerancing import varyattribute >>> rms = RadialMirrorScatter(inplanescatter=2 * u.arcsec, perpplanescatter=0 * u.arcsec) >>> varyattribute(rms, inplanescatter=1 * u.arcsec)
It is usually easy to see which attributes of a
marxs.simulator.SimulationSequenceElementare relevant to be changed in tolerancing simulations when looking at the attributes or the implementation of those elements.