across.tools.visibility.base

Classes

Visibility

Abstract base class for visibility calculations.

Module Contents

class Visibility(/, **data)[source]

Bases: abc.ABC, across.tools.core.schemas.base.BaseSchema

Abstract base class for visibility calculations.

Parameters:
  • ra – Right ascension of the target in degrees.

  • dec – Declination of the target in degrees.

  • coordinate – SkyCoord object representing the position of the target in sky coordinates. Optional if ra and dec are provided.

  • begin – Start time of visibility period.

  • end – End time of visibility period.

  • step_size – Time step size for visibility calculations. Default is 60 seconds.

  • min_vis – Minimum visibility duration in seconds for a window to be included. Default is 0.

  • observatory_id – Unique Observatory ID for which this visibility is calculated.

  • observatory_name – Name of the observatory for which this visibility is calculated.

timestamp[source]

Array of time values used in the visibility calculation.

inconstraint[source]

Boolean array indicating whether the target is not constrained at each time step.

calculated_constraints[source]

Ordered dictionary mapping constraint types to boolean arrays.

visibility_windows[source]

List of visibility windows computed from the constraints.

computed_values[source]

Container (VisibilityComputedValues) providing access to geometric quantities calculated during visibility analysis. After running a visibility calculation, you can inspect these values for further analysis or visualization. Fields include:

  • sun_angle: Angular separation between target and Sun (Quantity array)

  • moon_angle: Angular separation between target and Moon (Quantity array)

  • earth_angle: Angular separation between target and Earth limb (Quantity array)

  • alt_az: Altitude-azimuth coordinates of target from observatory (SkyCoord)

Not all fields are populated for every calculation; values are only computed and stored by constraints that need them.

visible(t)[source]

Check if the target is visible at a given time.

compute()[source]

Perform visibility calculation.

ra: float | None = None[source]
dec: float | None = None[source]
step_size: across.tools.core.schemas.AstropyTimeDelta[source]
coordinate: astropy.coordinates.SkyCoord | None = None[source]
begin: across.tools.core.schemas.AstropyDateTime[source]
end: across.tools.core.schemas.AstropyDateTime[source]
min_vis: int = 0[source]
observatory_id: uuid.UUID = None[source]
observatory_name: str[source]
timestamp: across.tools.core.schemas.AstropyDateTime | None = None[source]
inconstraint: numpy.typing.NDArray[numpy.bool_] = None[source]
calculated_constraints: collections.OrderedDict[across.tools.core.enums.constraint_type.ConstraintType, numpy.typing.NDArray[numpy.bool_]] = None[source]
visibility_windows: list[across.tools.core.schemas.VisibilityWindow] = [][source]
computed_values: across.tools.core.schemas.visibility.VisibilityComputedValues = None[source]
classmethod validate_parameters(values)[source]

Validate and synchronize SkyCoord, RA and DEC values. This method ensures that both coordinate representations (SkyCoord object and separate RA/DEC values) are present and consistent. If one representation is missing, it is computed from the other. In addition, it validates the step size and ensures it is a positive value. The begin and end times are rounded to the nearest step size, to ensure consistency.

Parameters:

values (dict[str, float | astropy.coordinates.SkyCoord]) – Dictionary containing the input values to validate, including coordinate, ra, dec, step_size, begin, and end.

Return type:

Validated and synchronized dictionary of values.

visible(t)[source]

For a given time or array of times, is the target visible?

Parameters:

t (astropy.time.Time) – Time to check

Return type:

True if visible, False if not

_compute_timestamp()[source]

Compute timestamp array for visibility calculation. The base implementation is to create a timestamp array from the begin and end times with a step size defined by the step_size attribute.

_quantize_to_step(t)[source]

Quantize a time to the nearest configured step size relative to begin.

index(t)[source]

For a given time, return the index in the ephemeris.

Parameters:

t (astropy.time.Time) – Time to find the index for

Return type:

Index of the nearest time in the ephemeris

abstract _constraint(i)[source]

For a given index, return the constraint at that time.

Parameters:

i (int) – Index in the timestamp array.

Return type:

The constraint type at the given index.

abstract _merge_computed_values()[source]

Abstract method to merge computed values from constraints.

abstract prepare_data()[source]

Abstract method to perform visibility calculation.

_get_id(i)[source]

For a given index, get the ID of the observatory or instrument.

Parameters:

i (int) – Index in the timestamp array.

Return type:

The observatory or instrument ID.

_get_name(i)[source]

For a given index, get the name of the observatory or instrument.

Parameters:

i (int) – Index in the timestamp array.

Return type:

The observatory or instrument name.

_make_windows()[source]

Create visibility windows from the inconstraint array.

Return type:

List of VisibilityWindow objects representing periods when the target is visible.

plot(fig=None, offset=0, width=700, height=1000)[source]

Method to visualize visibility windows using plotly. Calls the across-tools plotting core functionality and configures the plot layout to user specifications.

Parameters:
  • fig (go.Figure, optional) – An existing plotly figure to add to, by default None

  • offset (int | float, optional) – The x-axis offset to plot new visibility windows, by default 0

  • width (int, optional) – The width of the plot, in pixels. Defaults to 700

  • height (int, optional) – The height of the plot, in pixels. Defaults to 1000

Returns:

The plotly figure containing the footprint plot

Return type:

go.Figure

compute()[source]

Perform visibility calculation.