DistortionObjective#
- class esis.optics.DistortionObjective(instrument, parameters, scene, observation, pupil=None, axis_wavelength=None, axis_field=None, axis_channel=None, weight_correlation=1000)[source]#
Bases:
PrintableAn objective function which compares modeled images to an observation.
Instances of this class are intended to be passed directly to
scipy.optimizeroutines such asscipy.optimize.differential_evolution(): they are callables of a flat, dimensionless parameter vector, and they are picklable so that the optimizer can evaluate them in parallel worker processes.Each evaluation unpacks the vector into a
DistortionParametersusingparametersas the prototype, applies it to a copy ofinstrument, imagesscenethrough the resulting optical system, and compares the result toobservationusing the Pearson correlation coefficient. A penalty proportional to the squared distance between the mean ray position and the origin of the sensor discourages solutions that walk the image off the detector.Note that the imaging model samples photons randomly, so evaluations of this objective are stochastic even for identical parameter vectors, and it should only be used with optimizers that tolerate a noisy objective, such as
scipy.optimize.differential_evolution().Attributes
The logical axis of the observation corresponding to changing camera channel.
The logical axes of the scene corresponding to changing field position.
The logical axis of the scene corresponding to changing wavelength.
The vertices of the pupil grid used to image the scene.
The weight of the correlation term relative to the distance penalty.
The instrument model being fit to the observation.
The prototype which defines the units and structure of the flat parameter vector, usually the initial guess of the fit.
The spectral radiance of the scene as a function of wavelength and field position, imaged through the instrument on every evaluation.
The observed image that the modeled image is compared against.
Methods
__init__(instrument, parameters, scene, ...)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:
instrument (AbstractInstrument)
parameters (DistortionParameters)
scene (FunctionArray)
observation (AbstractScalar)
pupil (None | AbstractCartesian2dVectorArray)
axis_wavelength (None | str)
axis_channel (None | str)
weight_correlation (float)
- 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.
- axis_channel: None | str = None#
The logical axis of the observation corresponding to changing camera channel.
If given, the correlation and the off-target penalty are computed independently for each channel and then averaged, so that brightness differences between the channels (e.g. from differing gains) do not suppress the correlation. This is the appropriate setting when fitting several channels at once with shared parameters.
- axis_field: None | tuple[str, str] = None#
The logical axes of the scene corresponding to changing field position.
- axis_wavelength: None | str = None#
The logical axis of the scene corresponding to changing wavelength.
- instrument: AbstractInstrument#
The instrument model being fit to the observation.
- observation: AbstractScalar#
The observed image that the modeled image is compared against.
Any axes of the modeled image which are not present in this array are summed over before comparing.
- parameters: DistortionParameters#
The prototype which defines the units and structure of the flat parameter vector, usually the initial guess of the fit.
- pupil: None | AbstractCartesian2dVectorArray = None#
The vertices of the pupil grid used to image the scene.
- scene: FunctionArray#
The spectral radiance of the scene as a function of wavelength and field position, imaged through the instrument on every evaluation.