SkyDipModel

class sofia_redux.scan.source_models.sky_dip_model.SkyDipModel[source]

Bases: ABC

Initialize a sky dip model.

The skydip model is used to fit elevation vs. data to determine the best fit parameters and error estimates.

Attributes Summary

default_bounds

default_initial_guess

Methods Summary

copy()

Return a copy of the skydip model.

fit(skydip)

Fit the skydip model.

fit_elevation(elevation)

Returns a fit to elevation with the model.

get_parameter_format(parameter_name)

Return the string format for a given parameter.

get_parameter_string(parameter)

Return a string representation of a given parameter.

get_parameter_unit(parameter_name)

Return the parameter unit for the given parameter.

init_parameters(skydip)

Initialize the fitting parameters.

set_configuration(configuration)

Set the sky dip model configuration

value_at(elevation, tau, offset, kelvin, tsky)

Return the result of the fitted value.

Attributes Documentation

default_bounds = {'kelvin': [0.0, inf], 'offset': [-inf, inf], 'tau': [0.0, 10.0], 'tsky': [0.0, inf]}
default_initial_guess = {'kelvin': nan, 'offset': nan, 'tau': 1.0, 'tsky': 273.0}

Methods Documentation

copy()[source]

Return a copy of the skydip model.

Returns:
SkyDipModel
fit(skydip)[source]

Fit the skydip model.

Parameters:
skydipsofia_redux.scan.source_models.sky_dip.SkyDip
Returns:
None
fit_elevation(elevation)[source]

Returns a fit to elevation with the model.

The return value Tobs is given as:

fit = offset + (t_obs * kelvin) t_obs = t_sky * (-(exp(-tau / sin(el) - 1))

where t_sky is the sky temperature, kelvin is the conversion factor from instrument units to kelvin, offset is the signal offset, and el is the elevation.

Parameters:
elevationunits.Quantity or float or numpy.ndarray (float)

The elevations to fit. If floats are provided, they should be in radians.

Returns:
fitfloat or numpy.ndarray

The fit to the elevation in Kelvins

classmethod get_parameter_format(parameter_name)[source]

Return the string format for a given parameter.

Parameters:
parameter_namestr
Returns:
str
get_parameter_string(parameter)[source]

Return a string representation of a given parameter.

Parameters:
parameterstr
Returns:
str
get_parameter_unit(parameter_name)[source]

Return the parameter unit for the given parameter.

Parameters:
parameter_namestr
Returns:
units.Unit or None
init_parameters(skydip)[source]

Initialize the fitting parameters.

The initial fitting parameters are determined by the following logic:

- tsky: The 'skydip.tsky' configuration value, or the skydip model
  tamb attribute if it has a non-zero weight.  Otherwise the default
  is 273 Kelvins.
- offset: If the current initial value is non-finite, is taken to be
  the midpoint of the skydip model signal range.  If this cannot be
  determined, defaults to zero.
- kelvin: If the current initial value is non-finite, is taken to
  be the span of the skydip model signal range divided by the tsky
  value (above).  If this cannot be determined, defaults to one.
- tau: If the initial value for kelvin (above) is finite, tau is
  determined as -log(1-x) where x = s / (am * tsky * kelvin) and
  s is the span of the signal range, am is the span of the air mass
  range, and the other parameters are described above.  If x is
  negative, tau is set to 0.1, or 1 if x > 1.
Parameters:
skydipsofia_redux.scan.source_models.sky_dip.SkyDip

The SkyDip model to fit.

Returns:
None
set_configuration(configuration)[source]

Set the sky dip model configuration

Parameters:
configurationConfiguration
Returns:
None
static value_at(elevation, tau, offset, kelvin, tsky)[source]

Return the result of the fitted value.

The returned value is given as:

data = offset - ((exp(-tau / sin(elevation)) - 1) * tsky * kelvin)
Parameters:
elevationfloat or units.Quantity

The elevation in radians (float) or as an angle quantity.

taufloat

The tau value.

offsetfloat

The offset in kelvins.

kelvinfloat

The kelvin scaling factor.

tskyfloat

The sky temperature in kelvin.

Returns:
valuefloat or units.Quantity

The fitted value. If any quantities are passed in, the result will also be a quantity.