lineshape

Module: skretrieval.core.lineshape

LineShape

class LineShape

Base class for implementing line shapes. A line shape represents integration across a high resolution measurement down to a lower resolution measurement.

bounds()

Boundaries of the line shape. Values outside this range are 0

Returns

Left and right boundaries of the line shape

Return type

(left, right)

abstract integration_weights(mean: float, available_samples: numpy.ndarray, normalize=True)

Integration weights for the line shape.

Parameters
  • mean (float) – Value to integrate to

  • available_samples (np.ndarray) – Array of sample values that are available to use in the integration.

  • normalize (bool, Optional) – If true, resulting weights are normalized such that np.nansum(weights) = 1

Returns

Integration weights, same size as available_samples.

Return type

np.ndarray

Gaussian

class Gaussian(fwhm: Optional[float] = None, stdev: Optional[float] = None, max_stdev=5, mode='linear')
bounds()

If integration_weights is called with mean=0, all values outside the range [lower_bound, upper_bound] are guaranteed to be 0.

Returns

Return type

[lower_bound, upper_bound]

integration_weights(mean: float, available_samples: numpy.ndarray, normalize=True)

The lineshape converts a function at high resolution, H, to one at low resolution, L.

L(mean) = np.dot(H, integration_weights(mean, available_samples))

Parameters
  • mean (float) – value (in the range of available_samples) to integrate to

  • available_samples (np.ndarray) – Values that the high resolution function is available at

  • normalize (bool, optional) – If true, the returned weights will sum to 1

Returns

Weights to use in the high resolution integration

Return type

np.ndarray

DeltaFunction

class DeltaFunction
bounds()

Boundaries of the line shape. Values outside this range are 0

Returns

Left and right boundaries of the line shape

Return type

(left, right)

integration_weights(mean: float, available_samples: numpy.ndarray, normalize=True, tolerance=1e-07)

Integration weights for the line shape.

Parameters
  • mean (float) – Value to integrate to

  • available_samples (np.ndarray) – Array of sample values that are available to use in the integration.

  • normalize (bool, Optional) – If true, resulting weights are normalized such that np.nansum(weights) = 1

Returns

Integration weights, same size as available_samples.

Return type

np.ndarray

Rectangle

class Rectangle(width, mode='linear')
bounds()

Boundaries of the line shape. Values outside this range are 0

Returns

Left and right boundaries of the line shape

Return type

(left, right)

integration_weights(mean: float, available_samples: numpy.ndarray, normalize=True)

Integration weights for the line shape.

Parameters
  • mean (float) – Value to integrate to

  • available_samples (np.ndarray) – Array of sample values that are available to use in the integration.

  • normalize (bool, Optional) – If true, resulting weights are normalized such that np.nansum(weights) = 1

Returns

Integration weights, same size as available_samples.

Return type

np.ndarray