/*****************************************************************************************************************/ /*****************************************************************************************************************/ import type { HorizontalCoordinate } from './common'; /*****************************************************************************************************************/ /** * * A normalized score in the range [-1, 1], where 1 is the ideal observing condition and -1 is * completely unobservable. * */ export type ConstraintScore = number; /*****************************************************************************************************************/ /** * * The context against which a constraint is evaluated for a single observation at a given datetime. * */ export type ConstraintContext = { /** * * The target's horizontal coordinate { az, alt }. * */ target: HorizontalCoordinate; /** * * The Sun's horizontal coordinate { az, alt }. * */ sun: HorizontalCoordinate; /** * * The Moon's horizontal coordinate { az, alt }. * */ moon: HorizontalCoordinate; /** * * The Moon's illuminated fraction, as a percentage in the range [0, 100]. * */ illumination: number; /** * * The angular separation between the Moon and the target, in degrees in the range [0, 180]. * */ separation: number; }; /*****************************************************************************************************************/ /** * * * @class Constraint * * @description The abstract base for a standardised observational constraint. A constraint scores a * { ConstraintContext } on the range [-1, 1], where 1 is the ideal observing condition and -1 is * completely unobservable. * * */ export declare abstract class Constraint { abstract readonly name: string; required: boolean; weight: number; constructor(weight?: number); abstract score(context: ConstraintContext): ConstraintScore; isSatisfiedBy(context: ConstraintContext): boolean; } /*****************************************************************************************************************/ /** * * The parameters model shared by every { Constraint }. * */ export type ConstraintParameters = { /** * * The relative weight of the constraint in the aggregate of a set of constraints, e.g., the * weighted mean quality of an observation. Defaults to 1, e.g., every constraint contributes * equally. * */ weight?: number; }; /*****************************************************************************************************************/ /** * * The parameters model for a { TargetAltitudeConstraint }. * */ export type TargetAltitudeConstraintParameters = ConstraintParameters & { /** * * The minimum altitude (in degrees) at which the target is considered observable. * */ minimum?: number; /** * * The maximum altitude (in degrees) at which the target's score is maximal. * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class TargetAltitudeConstraint * * @description A constraint on the altitude of the target above the observer's horizon. The target * must be at or above a minimum altitude to be observable; the score then increases linearly with * altitude up to a maximum altitude (the zenith by default), where it reaches 1. * * */ export declare class TargetAltitudeConstraint extends Constraint { readonly name = "target-altitude"; required: boolean; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: TargetAltitudeConstraintParameters); score({ target }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { SunAltitudeConstraint }. * */ export type SunAltitudeConstraintParameters = ConstraintParameters & { /** * * The maximum altitude (in degrees) of the Sun for the observation to be dark enough. The Sun must * be at or below this altitude (e.g. -18° for astronomical darkness) for the observation to begin. * */ maximum?: number; /** * * The minimum altitude (in degrees) of the Sun at which the score is maximal (the Sun at its * deepest below the horizon). * */ minimum?: number; }; /*****************************************************************************************************************/ /** * * * @class SunAltitudeConstraint * * @description A constraint on the altitude of the Sun below the observer's horizon. The Sun must be * at or below a maximum altitude (e.g. -18° for astronomical darkness) for the observation to be * possible; the score then increases the deeper the Sun sinks, reaching 1 at the minimum altitude. * * Note that, unlike the target, a lower Sun altitude scores higher. * * */ export declare class SunAltitudeConstraint extends Constraint { readonly name = "sun-altitude"; required: boolean; maximum: number; minimum: number; constructor({ maximum, minimum, weight }?: SunAltitudeConstraintParameters); score({ sun }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * * @class IsNight * * @description A convenience constraint that is satisfied when it is astronomical night, i.e. the * Sun is at or below -18° below the horizon (Twilight.Night). It wraps a { SunAltitudeConstraint } * pre-configured with sensible night defaults, and accepts the same parameters should a different * darkness threshold be required. * * */ export declare class IsNight extends Constraint { readonly name = "is-night"; required: boolean; private readonly constraint; constructor(parameters?: SunAltitudeConstraintParameters); get maximum(): number; get minimum(): number; score(context: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { MoonAltitudeConstraint }. * */ export type MoonAltitudeConstraintParameters = ConstraintParameters & { /** * * The altitude (in degrees) at or below which the Moon causes no interference (the score is * maximal). Defaults to the horizon (0°). * */ minimum?: number; /** * * The altitude (in degrees) at which the Moon causes the most interference (the score is minimal). * Defaults to the zenith (90°). * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class MoonAltitudeConstraint * * @description A constraint on the altitude of the Moon above the observer's horizon. The Moon * interferes with an observation in proportion to how high it sits: the score is maximal (1) when the * Moon is at or below the horizon and decreases linearly to its minimum (-1) at the zenith. * * This is a soft constraint by default (a Moon above the horizon degrades, but does not preclude, an * observation). * * */ export declare class MoonAltitudeConstraint extends Constraint { readonly name = "moon-altitude"; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: MoonAltitudeConstraintParameters); score({ moon }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { MoonSeparationConstraint }. * */ export type MoonSeparationConstraintParameters = ConstraintParameters & { /** * * The angular separation (in degrees) at or below which the Moon causes the most interference (the * score is minimal). Defaults to a coincident Moon (0°). * */ minimum?: number; /** * * The angular separation (in degrees) at or above which the Moon causes no interference (the score * is maximal). Defaults to an antipodal Moon (180°). * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class MoonSeparationConstraint * * @description A constraint on the angular separation between the Moon and the target, weighted by * the Moon's illuminated fraction. The Moon interferes most when it is bright and close to the * target; the interference falls to zero as the separation grows, as the Moon darkens, or when the * Moon is below the horizon. * * This is a soft constraint by default (a nearby Moon degrades, but does not preclude, an * observation). * * */ export declare class MoonSeparationConstraint extends Constraint { readonly name = "moon-separation"; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: MoonSeparationConstraintParameters); score({ moon, illumination, separation }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { MoonIlluminationConstraint }. * */ export type MoonIlluminationConstraintParameters = ConstraintParameters & { /** * * The illuminated fraction (as a percentage) at or below which the Moon causes no interference (the * score is maximal). Defaults to a new Moon (0%). * */ minimum?: number; /** * * The illuminated fraction (as a percentage) at or above which the Moon causes the most * interference (the score is minimal). Defaults to a full Moon (100%). * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class MoonIlluminationConstraint * * @description A constraint on the Moon's illuminated fraction. The Moon interferes most when it is * full and falls to zero as it darkens towards a new Moon, or when the Moon is below the horizon. * * This is a soft constraint by default (a bright Moon degrades, but does not preclude, an * observation). * * */ export declare class MoonIlluminationConstraint extends Constraint { readonly name = "moon-illumination"; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: MoonIlluminationConstraintParameters); score({ moon, illumination }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for an { IsMoonDown } constraint. * */ export type IsMoonDownParameters = ConstraintParameters & { /** * * The altitude (in degrees) at or below which the Moon is considered to be "down". Defaults to the * horizon (0°). * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class IsMoonDown * * @description A convenience constraint that is satisfied only when the Moon is at or below the * horizon (or, more generally, at or below a maximum altitude). It is a hard gate: when the Moon is * above the threshold the observation is unobservable (-1), otherwise it is ideal (1). * * Unlike { IsNight }, which wraps the gating { SunAltitudeConstraint }, the Moon's altitude * constraint is a soft (graded) one, so this constraint gates on the Moon's altitude directly. * * */ export declare class IsMoonDown extends Constraint { readonly name = "is-moon-down"; required: boolean; maximum: number; constructor({ maximum, weight }?: IsMoonDownParameters); score({ moon }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for an { AirmassConstraint }. * */ export type AirmassConstraintParameters = ConstraintParameters & { /** * * The airmass at which the score is maximal (the best case). Defaults to 1 (the zenith), which is * the minimum possible airmass. * */ minimum?: number; /** * * The airmass at or above which the target is unobservable. Defaults to 2 (an altitude of roughly * 30°). * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class AirmassConstraint * * @description A constraint on the airmass of the target — the path length of light through the * atmosphere, which is minimal (1) at the zenith and rises towards the horizon. The score is maximal * (1) at the minimum airmass and decreases linearly to -1 at the maximum, above which the target is * unobservable. * * */ export declare class AirmassConstraint extends Constraint { readonly name = "airmass"; required: boolean; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: AirmassConstraintParameters); score({ target }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { SunAvoidanceConstraint }. * */ export type SunAvoidanceConstraintParameters = ConstraintParameters & { /** * * The angular separation (in degrees) from the Sun at or within which the target is unobservable, * e.g., the half-angle of the solar exclusion cone. Defaults to 45°. * */ minimum?: number; /** * * The angular separation (in degrees) from the Sun at or beyond which the Sun causes no * interference (the score is maximal). Defaults to 90°. * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class SunAvoidanceConstraint * * @description A constraint on the angular separation between the target and the Sun. The target is * unobservable within the solar exclusion cone, beyond which the score increases linearly with * separation as the scattered and stray light of the Sun falls away. * * N.B. The constraint is deliberately horizon-agnostic, e.g., it does not treat a Sun below the * horizon as causing no interference, as an observer in space has no horizon behind which the Sun * is hidden, and it is the pointing of the instrument relative to the Sun that is constrained. An * observer on the ground is served by { SunAltitudeConstraint } or { IsNight }. * * This is a hard constraint, e.g., a target within the exclusion cone makes the whole observation * unobservable. * * */ export declare class SunAvoidanceConstraint extends Constraint { readonly name = "sun-avoidance"; required: boolean; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: SunAvoidanceConstraintParameters); score({ target, sun }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for a { MoonAvoidanceConstraint }. * */ export type MoonAvoidanceConstraintParameters = ConstraintParameters & { /** * * The angular separation (in degrees) from the Moon at or within which the target is unobservable, * e.g., the half-angle of the lunar exclusion cone. Defaults to 15°. * */ minimum?: number; /** * * The angular separation (in degrees) from the Moon at or beyond which the Moon causes no * interference (the score is maximal). Defaults to 30°. * */ maximum?: number; }; /*****************************************************************************************************************/ /** * * * @class MoonAvoidanceConstraint * * @description A constraint on the angular separation between the target and the Moon. The target * is unobservable within the lunar exclusion cone, beyond which the score increases linearly with * separation as the scattered and stray light of the Moon falls away. * * N.B. The constraint is deliberately horizon-agnostic, e.g., it does not treat a Moon below the * horizon as causing no interference, as an observer in space has no horizon behind which the Moon * is hidden, and it is the pointing of the instrument relative to the Moon that is constrained. Nor * does it scale with the illuminated fraction of the Moon, as the exclusion cone is a limit on * where the instrument may be pointed, and not a measure of interference. An observer on the ground * is served by { MoonSeparationConstraint }, { MoonAltitudeConstraint } or { IsMoonDown }. * * This is a hard constraint, e.g., a target within the exclusion cone makes the whole observation * unobservable. * * */ export declare class MoonAvoidanceConstraint extends Constraint { readonly name = "moon-avoidance"; required: boolean; minimum: number; maximum: number; constructor({ minimum, maximum, weight }?: MoonAvoidanceConstraintParameters); score({ separation }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * @class IsAstronomicalTwilight * * @description A convenience constraint that is satisfied when the Sun's altitude is strictly below * -12°, i.e. it is at least astronomical twilight (the union of Twilight.Astronomical and * Twilight.Night). The threshold is exclusive: at exactly -12° the constraint is not satisfied. It * wraps a { SunAltitudeConstraint } pre-configured with sensible defaults, and accepts the same * parameters should a different darkness threshold be required. * * */ export declare class IsAstronomicalTwilight extends Constraint { readonly name = "is-astronomical-twilight"; required: boolean; private readonly constraint; constructor(parameters?: SunAltitudeConstraintParameters); get maximum(): number; get minimum(): number; score(context: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/ /** * * The parameters model for an { EarthLimbConstraint }. * */ export type EarthLimbConstraintParameters = ConstraintParameters & { /** * * The elevation of the observer above the surface of the Earth (in SI metres), from which the * angular radius of the limb is resolved. Defaults to 0, e.g., an observer at the surface. * */ elevation?: number; /** * * The height of the atmospheric shell to clear above the surface (in SI metres), e.g., the * grazing height an observer that must not look through the upper atmosphere avoids. Defaults * to 0, e.g., the solid Earth alone. * */ grazing?: number; /** * * The angular separation (in degrees) above the limb at or beyond which the Earth causes no * interference (the score is maximal). Defaults to 10°. * */ clearance?: number; }; /*****************************************************************************************************************/ /** * * * @class EarthLimbConstraint * * @description A constraint on the angular separation between the target and the limb of the Earth, * for an observer above the atmosphere. The target is unobservable where the Earth occults it, e.g., * where it lies within the cone the Earth subtends about the nadir of the observer, beyond which * the score increases linearly with its separation from the limb, as the scattered light of the * bright limb falls away. * * N.B. The Earth occults a third of the sky from a low Earth orbit, and so this is the dominant * constraint on what such an observer may see. It is resolved from the altitude of the target * alone, e.g., the nadir of the observer lies at an altitude of -90°, and so no position vector of * the observer is required beyond the elevation the limb is resolved from. * * This is a hard constraint, e.g., a target the Earth occults makes the whole observation * unobservable. * * */ export declare class EarthLimbConstraint extends Constraint { readonly name = "earth-limb"; required: boolean; elevation: number; grazing: number; clearance: number; constructor({ elevation, grazing, clearance, weight }?: EarthLimbConstraintParameters); score({ target }: ConstraintContext): ConstraintScore; } /*****************************************************************************************************************/