DistortionParameters#
- class esis.optics.DistortionParameters(yaw_grating, pitch_grating, roll_grating, roll_field_stop, spacing_rulings, displacement_primary, pitch, yaw, roll)[source]#
Bases:
PrintableThe degrees of freedom adjusted when fitting an instrument model to images.
An instance of this class serves both as a point in parameter space and as the prototype that defines the units and structure of the flat vector seen by
scipy.optimizeroutines:named_arrays.pack()flattens it into a dimensionless vector andnamed_arrays.unpack()rebuilds it.Examples
Gather the distortion parameters of the ESIS flight-1 design and flatten them into a vector suitable for
scipy.optimize.import named_arrays as na import esis instrument = esis.flights.f1.optics.design(num_distribution=0) parameters = esis.optics.DistortionParameters.from_instrument(instrument) na.pack(parameters)
ScalarArray( ndarray=[-268.17403457, 0. , 0. , 0. , 0.38660662, -0. , 0. , 0. , 0. ], axes=('pack',), )Attributes
The yaw angle of the diffraction grating.
The pitch angle of the diffraction grating.
The roll angle of the diffraction grating.
The roll angle of the field stop.
The constant coefficient of the grating ruling spacing polynomial.
The displacement of the primary mirror along the optic axis relative to its nominal focal length.
The pitch angle of the entire instrument.
The yaw angle of the entire instrument.
The roll angle of the entire instrument.
Methods
__init__(yaw_grating, pitch_grating, ...)from_file(path[, axis])Load parameters saved by
to_file().from_instrument(instrument)Gather the current distortion parameters of the given instrument.
to_file(path[, metadata])Save these parameters as a plain-text ECSV table.
to_instrument(instrument)Apply these parameters to a copy of the given instrument.
to_string([prefix])Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.Inheritance Diagram

- Parameters:
yaw_grating (Quantity | AbstractScalar)
pitch_grating (Quantity | AbstractScalar)
roll_grating (Quantity | AbstractScalar)
roll_field_stop (Quantity | AbstractScalar)
spacing_rulings (Quantity | AbstractScalar)
displacement_primary (Quantity | AbstractScalar)
pitch (Quantity | AbstractScalar)
yaw (Quantity | AbstractScalar)
roll (Quantity | AbstractScalar)
- classmethod from_file(path, axis=None)[source]#
Load parameters saved by
to_file().The logical axis of the parameters is recovered from the
axisentry of the table header.- Parameters:
- Return type:
- classmethod from_instrument(instrument)[source]#
Gather the current distortion parameters of the given instrument.
The parameters are converted to a canonical set of units (
arcminfor the grating angles,arcsecfor the instrument pointing, etc.) so that the components of the packed vector are of order unity and bounds built from different instances are consistent.- Parameters:
instrument (AbstractInstrument) – The instrument model to gather the parameters from.
- Return type:
- to_file(path, metadata=None)[source]#
Save these parameters as a plain-text ECSV table.
The fields become the columns of the table (with their units), and the elements along the (single) logical axis of the parameters become its rows, so that fit results can be committed to version control and reviewed as text. Scalar fields are broadcast along the axis.
- Parameters:
- Raises:
ValueError – If the parameters have more than one logical axis.
- Return type:
None
See also
from_fileThe inverse of this method.
- to_instrument(instrument)[source]#
Apply these parameters to a copy of the given instrument.
The given instrument is left unmodified, and any cached optical system on the result is discarded so that it is rebuilt with the new parameters.
The nominal focal length of the primary mirror is recovered from the invariant
focal_length + translation.z, which is unchanged by applying adisplacement_primary, so this method may be applied repeatedly to the results of previous applications.- Parameters:
instrument (AbstractInstrument) – The instrument model to apply the parameters to.
- Return type:
- to_string(prefix=None)#
Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.
- displacement_primary: Quantity | AbstractScalar#
The displacement of the primary mirror along the optic axis relative to its nominal focal length.
A displacement \(d\) simultaneously sets the focal length to \(f_\mathrm{nominal} + d\) and the translation of the primary mirror to \(-d\), so that the primary moves while the focal plane stays put.
- pitch: Quantity | AbstractScalar#
The pitch angle of the entire instrument.
- pitch_grating: Quantity | AbstractScalar#
The pitch angle of the diffraction grating.
- roll: Quantity | AbstractScalar#
The roll angle of the entire instrument.
- roll_field_stop: Quantity | AbstractScalar#
The roll angle of the field stop.
- roll_grating: Quantity | AbstractScalar#
The roll angle of the diffraction grating.
- spacing_rulings: Quantity | AbstractScalar#
The constant coefficient of the grating ruling spacing polynomial.
- yaw: Quantity | AbstractScalar#
The yaw angle of the entire instrument.
- yaw_grating: Quantity | AbstractScalar#
The yaw angle of the diffraction grating.