nenupy.schedule.constraints.ElevationCnst

class nenupy.schedule.constraints.ElevationCnst(elevationMin=0.0, scale_elevation=True, weight=1)[source]

Bases: TargetConstraint

Elevation constraint

Parameters:
  • elevationMin (int, float, or Angle) – Target’s elevation below which the constraint score is null. If provided as a dimensionless quantity, the value is interpreted as degrees.

  • weight (int or float) – Weight of the constraint. Allows to ponderate each constraint with respect to each other if ElevationCnst is included in Constraints for instance.

Added in version 1.2.0.

Example:
>>> from astropy.time import Time, TimeDelta
>>> from nenupy.schedule.targets import ESTarget
>>> from nenupy.schedule.constraints import ElevationCnst
>>> dt = TimeDelta(3600, format='sec')
>>> times = Time('2021-01-01 00:00:00') + np.arange(24)*dt
>>> cas_a = ESTarget.fromName('Cas A')
>>> cas_a.computePosition(times)
>>> elevation_constraint = ElevationCnst()
>>> score = elevation_constraint(target, None)
>>> c.plot()
__call__(*arg)

Evaluate the constraint against the schedule properties.

Returns:

The constraint score evaluated at each time step.

Return type:

ndarray

Raises:

AttributeError – If the constraint does not have an _evaluate() method.

__init__(elevationMin=0.0, scale_elevation=True, weight=1)[source]

Methods

__init__([elevationMin, scale_elevation, weight])

get_score(indices)

Computes the ElevationCnst's score for the given indices.

plot([fig, ax])

Plot the constraint's score previously evaluated.

Attributes

elevationMin

Minimal elevation required to perform an observation.

weight

Relative weight associated to the constraint.

property elevationMin

Minimal elevation required to perform an observation.

Type:

float or Angle

get_score(indices)[source]

Computes the ElevationCnst’s score for the given indices.

The score is computed as:

\[{\rm score} = \left\langle \frac{\mathbf{e}(t)}{{\rm max}(\mathbf{e})} \right\rangle_{\rm indices}\]

where \(\mathbf{e}(t)\) is the elevation of the target (set to \(0\) whenever it is lower than elevationMin).

Parameters:

indices (ndarray) – Indices of score on which the score will be evaluated.

Returns:

Constraint score.

Return type:

float

plot(fig=None, ax=None, **kwargs)

Plot the constraint’s score previously evaluated.

Parameters:
  • fig (Figure) – Figure instance to re-use for plotting purposes, by default None (i.e., a new Figure will be created)

  • ax (Axes) – Ax instance to re-use for plotting purposes, by default None (i.e., a new Axes will be created)

  • figsize ([float, float]) – Size of the figure, by default (10, 5)

  • figname (str) – Name of the figure to be saved, by default '' (i.e., the figure is only displayed)

  • marker (str) – Plot marker type (see matplotlib.pyplot.plot()), by default '.'

  • linestyle (str) – Plot line style (see matplotlib.pyplot.plot()), by default ':'

  • linewidth (int) – Plot line width (see matplotlib.pyplot.plot()), by default 1

property weight

Relative weight associated to the constraint. The constraint score of an observation block within a given schedule is ultimately taken at the weighted mean among all the constraints associated to this observaiton request.