/*****************************************************************************************************************/ import type { EquatorialCoordinate, GeographicCoordinate, GeographicCoordinateAtEpoch, Interval } from './common'; import { type Constraint, type ConstraintContext, type ConstraintScore } from './constraints'; /*****************************************************************************************************************/ /** * * The evaluation of a single { Constraint } against the resolved context of an observation. * */ export type ConstraintEvaluation = { /** * * The human-readable name of the constraint that was evaluated. * */ name: string; /** * * The score of the constraint, in the range [-1, 1]. * */ score: ConstraintScore; /** * * Whether failing the constraint (a score of -1) makes the whole observation unobservable. * */ required: boolean; /** * * Whether the constraint is satisfied at all, e.g., its score is above the unobservable floor. * */ satisfied: boolean; /** * * The relative weight of the constraint in the weighted mean quality. * */ weight: number; }; /*****************************************************************************************************************/ /** * * The observational quality of an observation, resolved from a set of { Constraint } instances. * */ export type ObservationalQuality = { /** * * The observational quality index, in the range [-1, 1], where 1 is the best possible quality * and -1 is the worst (or unobservable). * */ quality: number; /** * * Whether the observation is observable at all, e.g., every required (hard) constraint is * satisfied. * */ observable: boolean; /** * * The evaluation of each constraint, in the order the constraints were given, such that the * constraint that makes an observation unobservable may be identified. * */ scores: ConstraintEvaluation[]; /** * * The resolved context the constraints were evaluated against, e.g., the horizontal coordinates * of the target, the Sun and the Moon, the Moon's illuminated fraction, and the Moon-target * angular separation, for the given datetime. * */ context: ConstraintContext; }; /*****************************************************************************************************************/ /** * * getObservationalQuality() * * @brief A measure of the observational quality of an observation, in the range [-1, 1], where 1 is * the best possible quality and -1 is the worst (or unobservable). * * The quality is the weighted mean of the scores of a set of standardised { Constraint } instances, * evaluated against the observation's resolved context, e.g., each score contributes in proportion * to the weight of its constraint. Any failed required (hard) constraint makes the whole * observation unobservable, with a quality of -1, and the evaluation of every constraint is * returned such that the failing constraint may be identified. * * @param datetime - The date and time of the observation. * @param observer - The geographic coordinates of the observer, or their coordinate as a function of the epoch, e.g., a spacecraft. * @param target - The equatorial coordinates of the target object (at J2000.0). * @param constraints - The constraints to evaluate (defaults to target altitude, Sun altitude and * Moon separation). * @returns The observational quality of the observation, e.g., the quality index, whether the * observation is observable, the evaluation of each constraint, and the resolved context. */ export declare function getObservationalQuality(datetime: Date, observer: GeographicCoordinate | GeographicCoordinateAtEpoch, target: EquatorialCoordinate, constraints?: Constraint[]): ObservationalQuality; /*****************************************************************************************************************/ /** * * An interval over which an observation is observable, together with the mean quality of the * observation over the interval. * * N.B. The interval is half-open, e.g., [from, to): every sampled instant from the start of the * window, up to but not including the end of it, satisfies every required (hard) constraint. The * end of the window is the first sampled instant at which the observation is not observable, or * the end of the interval that was resolved, at which it may still be observable. * */ export type ObservationalQualityWindow = { /** * * The interval over which the observation is observable. * */ interval: Interval; /** * * The mean observational quality index over the interval, in the range [-1, 1]. * */ quality: number; }; /*****************************************************************************************************************/ /** * * getObservationalQualityWindows() * * @brief Resolves the intervals within the given interval over which an observation is observable, * e.g., every required (hard) constraint is satisfied at every sampled instant, together with the * mean quality of the observation over each interval. * * The interval is sampled at the given step, and each maximal contiguous run of observable samples * forms a window. Each window is half-open, e.g., [from, to): it closes at the first sampled * instant at which the observation is not observable, or at the end of the interval given. The * windows are returned in chronological order; a caller that wants the best window may sort them * by their quality. * * @param interval - The interval over which to resolve the windows, e.g., the coming night. * @param observer - The geographic coordinates of the observer, or their coordinate as a function of the epoch, e.g., a spacecraft. * @param target - The equatorial coordinates of the target object (at J2000.0). * @param constraints - The constraints to evaluate (defaults to target altitude, Sun altitude and * Moon separation). * @param params - The parameters for the resolution, e.g., the step (in seconds) at which the * interval is sampled. * @returns The observable windows within the interval, in chronological order. */ export declare function getObservationalQualityWindows(interval: Interval, observer: GeographicCoordinate | GeographicCoordinateAtEpoch, target: EquatorialCoordinate, constraints?: Constraint[], params?: { stepSeconds?: number; }): ObservationalQualityWindow[]; /*****************************************************************************************************************/ /** * * The observational quality of a single target within a ranking, e.g., the target given together * with the quality resolved for it. * */ export type ObservationalQualityRank = ObservationalQuality & { /** * * The target the quality was resolved for, as it was given. * */ target: T; }; /*****************************************************************************************************************/ /** * * getObservationalQualityRanking() * * @brief Ranks a set of targets by their observational quality for a given datetime and observer, * e.g., the best target to observe first. * * Every target is scored with the same set of constraints, and the ranking is ordered by quality, * from the best to the worst. A target that is not observable, e.g., a required (hard) constraint * fails for it, ranks below every observable target, and the targets of equal quality retain the * order they were given in. * * @param datetime - The date and time of the observation. * @param observer - The geographic coordinates of the observer, or their coordinate as a function of the epoch, e.g., a spacecraft. * @param targets - The equatorial coordinates of the target objects (at J2000.0). * @param constraints - The constraints to evaluate (defaults to target altitude, Sun altitude and * Moon separation). * @returns The targets, each together with its observational quality, ordered from the best to * the worst. */ export declare function getObservationalQualityRanking(datetime: Date, observer: GeographicCoordinate | GeographicCoordinateAtEpoch, targets: T[], constraints?: Constraint[]): ObservationalQualityRank[]; /*****************************************************************************************************************/