nenupy.schedule.constraints.ElevationCnst
- class nenupy.schedule.constraints.ElevationCnst(elevationMin=0.0, scale_elevation=True, weight=1)[source]
Bases:
TargetConstraintElevation constraint
- Parameters:
elevationMin (
int,float, orAngle) – Target’s elevation below which the constraint score is null. If provided as a dimensionless quantity, the value is interpreted as degrees.weight (
intorfloat) – Weight of the constraint. Allows to ponderate each constraint with respect to each other ifElevationCnstis included inConstraintsfor 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.
Methods
__init__([elevationMin, scale_elevation, weight])get_score(indices)Computes the
ElevationCnst's score for the givenindices.plot([fig, ax])Plot the constraint's score previously evaluated.
Attributes
Minimal elevation required to perform an observation.
Relative weight associated to the constraint.
- get_score(indices)[source]
Computes the
ElevationCnst’s score for the givenindices.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).
- 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 defaultNone(i.e., a newFigurewill be created)ax (
Axes) – Ax instance to re-use for plotting purposes, by defaultNone(i.e., a newAxeswill 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 (seematplotlib.pyplot.plot()), by default'.'linestyle (
str) – Plot line style (seematplotlib.pyplot.plot()), by default':'linewidth (
int) – Plot line width (seematplotlib.pyplot.plot()), by default1
- 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.