DistortionParameters#

class esis.optics.DistortionParameters(yaw_grating, pitch_grating, roll_grating, roll_field_stop, spacing_rulings, displacement_primary, pitch, yaw, roll, z_primary=<Quantity 0. mm>, z_sensor=<Quantity 0. mm>, roll_sensor=<Quantity 0. deg>, pitch_sensor=<Quantity 0. deg>, yaw_sensor=<Quantity 0. deg>, x_sensor=<Quantity 0. mm>, y_sensor=<Quantity 0. mm>, degradation=<Quantity 1.>)[source]#

Bases: Printable

The 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.optimize routines: named_arrays.pack() flattens it into a dimensionless vector and named_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.        ,    0.        ,    0.        ,    0.        ,    0.        ,  -12.252     ,
                0.        ,    0.        ,    1.        ],
    shape={'pack': 17},
)

Attributes

degradation

The factor by which the channel's response falls short of the model.

pitch_sensor

The pitch of the sensor (a foreshortening of the image along one axis).

roll_sensor

The roll of the sensor about its normal (a rotation of the image).

x_sensor

The in-plane translation of the sensor along its \(x\) axis.

y_sensor

The in-plane translation of the sensor along its \(y\) axis.

yaw_sensor

The yaw of the sensor (a foreshortening of the image along the other axis).

z_primary

The displacement of the primary mirror along the optic axis at a fixed focal length: a defocus of the solar image at the field stop.

z_sensor

The displacement of the sensor along its normal, with the grating following along the beam by kappa_focus times less so that the image stays in focus: a change of the magnification of one channel without a change of its focus.

yaw_grating

The yaw angle of the diffraction grating.

pitch_grating

The pitch angle of the diffraction grating.

roll_grating

The roll angle of the diffraction grating.

roll_field_stop

The roll angle of the field stop.

spacing_rulings

The constant coefficient of the grating ruling spacing polynomial.

displacement_primary

The displacement of the primary mirror along the optic axis relative to its nominal focal length.

pitch

The pitch angle of the entire instrument.

yaw

The yaw angle of the entire instrument.

roll

The roll angle of the entire instrument about its optical axis.

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

Inheritance diagram of esis.optics.DistortionParameters
Parameters:
classmethod from_file(path, axis=None)[source]#

Load parameters saved by to_file().

The logical axis of the parameters is recovered from the axis entry of the table header.

Parameters:
  • path (str | Path) – The path of the file to read.

  • axis (None | str) – The name to use for the logical axis of the parameters, overriding the name recorded in the file.

Return type:

DistortionParameters

classmethod from_instrument(instrument)[source]#

Gather the current distortion parameters of the given instrument.

The parameters are converted to a canonical set of units (arcmin for the grating angles, arcsec for 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:

DistortionParameters

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:
  • path (str | Path) – The path of the file to write.

  • metadata (None | dict[str, Any]) – Additional provenance recorded in the table header, for example the date and configuration of the fit that produced the parameters.

Raises:

ValueError – If the parameters have more than one logical axis, or if metadata contains the reserved key "axis", which records the name of the logical axis for from_file().

Return type:

None

See also

from_file

The 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 placements the terms are measured from are remembered on the result, so this method may be applied repeatedly to the results of previous applications.

Parameters:

instrument (AbstractInstrument) – The instrument model to apply the parameters to. It must carry its focus ratio, kappa_focus.

Raises:

TypeError – If instrument does not carry a focus ratio. This is a fault of the setup, so it is not a ValueError, which merits treat as a failed trial.

Return type:

AbstractInstrument

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.

Parameters:

prefix (None | str) – an optional string, the length of which is used to calculate how much whitespace to add to the result.

Return type:

str

degradation: Quantity | AbstractScalar = <Quantity 1.>#

The factor by which the channel’s response falls short of the model.

A scale on the image rather than an optical parameter, for a merit which compares absolute intensities; to_instrument() ignores it.

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.

pitch_sensor: Quantity | AbstractScalar = <Quantity 0. deg>#

The pitch of the sensor (a foreshortening of the image along one axis).

roll: Quantity | AbstractScalar#

The roll angle of the entire instrument about its optical axis.

A roll turns the sky inside windows that stay put, since the field stop turns with the optics, so it sets the angle between every window and the sky. It is the same as a roll of the field stop with the opposite sign, which one frame cannot tell it apart from.

roll_field_stop: Quantity | AbstractScalar#

The roll angle of the field stop.

roll_grating: Quantity | AbstractScalar#

The roll angle of the diffraction grating.

roll_sensor: Quantity | AbstractScalar = <Quantity 0. deg>#

The roll of the sensor about its normal (a rotation of the image).

spacing_rulings: Quantity | AbstractScalar#

The constant coefficient of the grating ruling spacing polynomial.

x_sensor: Quantity | AbstractScalar = <Quantity 0. mm>#

The in-plane translation of the sensor along its \(x\) axis.

y_sensor: Quantity | AbstractScalar = <Quantity 0. mm>#

The in-plane translation of the sensor along its \(y\) axis.

yaw: Quantity | AbstractScalar#

The yaw angle of the entire instrument.

yaw_grating: Quantity | AbstractScalar#

The yaw angle of the diffraction grating.

yaw_sensor: Quantity | AbstractScalar = <Quantity 0. deg>#

The yaw of the sensor (a foreshortening of the image along the other axis).

z_primary: Quantity | AbstractScalar = <Quantity 0. mm>#

The displacement of the primary mirror along the optic axis at a fixed focal length: a defocus of the solar image at the field stop.

Unlike displacement_primary, this moves the focal plane off the field stop. Each channel views the defocused image through its own sector of the primary, so the image shifts on the sky by the sector’s offset times the defocus, differently in every channel, while the window edges stay put: it is the one term that moves the sky without moving the windows.

z_sensor: Quantity | AbstractScalar = <Quantity 0. mm>#

The displacement of the sensor along its normal, with the grating following along the beam by kappa_focus times less so that the image stays in focus: a change of the magnification of one channel without a change of its focus.