# WavelengthFromGratingEquation¶

class gwcs.spectroscopy.WavelengthFromGratingEquation(groove_density, spectral_order, **kwargs)[source]

Bases: Model

Solve the Grating Dispersion Law for the wavelength.

Note

This form of the equation can be used for paraxial (small angle approximation) as well as oblique incident angles. With paraxial systems the inputs are sin of the angles and it transforms to

$$(\sin(alpha_in) + \sin(alpha_out)) / (groove_density * spectral_order)$$.

With oblique angles the inputs are the direction cosines of the angles.

Parameters
groove_densityint

Grating ruling density in units of 1/length.

spectral_orderint

Spectral order.

Examples

>>> from astropy.modeling.models import math
>>> model = WavelengthFromGratingEquation(groove_density=20000*1/u.m, spectral_order=-1)
>>> alpha_in = (math.Deg2radUfunc() | math.SinUfunc())(.0001 * u.deg)
>>> alpha_out = (math.Deg2radUfunc() | math.SinUfunc())(.0001 * u.deg)
>>> lam = model(alpha_in, alpha_out)
>>> print(lam)
-1.7453292519934437e-10 m


Attributes Summary

 groove_density Grating ruling density in units of 1/m. linear n_inputs The number of inputs. n_outputs The number of outputs. param_names Names of the parameters that describe models of this type. return_units This property is used to indicate what units or sets of units the output of evaluate should be in, and returns a dictionary mapping outputs to units (or None if any units are accepted). spectral_order Spectral order.

Methods Summary

 __call__(*inputs[, model_set_axis, ...]) Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated. evaluate(alpha_in, alpha_out, ...) Evaluate the model on some input variables.

Attributes Documentation

groove_density = Parameter('groove_density', value=1.0)

Grating ruling density in units of 1/m.

linear = False
n_inputs = 2

The number of inputs.

n_outputs = 1

The number of outputs.

param_names = ('groove_density', 'spectral_order')

Names of the parameters that describe models of this type.

The parameters in this tuple are in the same order they should be passed in when initializing a model of a specific type. Some types of models, such as polynomial models, have a different number of parameters depending on some other property of the model, such as the degree.

When defining a custom model class the value of this attribute is automatically set by the Parameter attributes defined in the class body.

return_units
spectral_order = Parameter('spectral_order', value=1.0)

Spectral order.

Methods Documentation

__call__(*inputs, model_set_axis=None, with_bounding_box=False, fill_value=nan, equivalencies=None, inputs_map=None, **new_inputs)

Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated.

evaluate(alpha_in, alpha_out, groove_density, spectral_order)[source]

Evaluate the model on some input variables.