across.tools.core.schemas

Submodules

Attributes

AstropyDateTime

AstropyTimeDelta

Classes

EnergyBandpass

A class representing a bandpass filter defined in terms of energy.

FrequencyBandpass

A class representing a bandpass filter defined in terms of frequency.

WavelengthBandpass

A class representing a bandpass filter defined in terms of wavelength.

BaseSchema

Base class for schemas.

Coordinate

Class that represents a point in spherical space

HealpixOrder

Class to represent and validate a Healpix Order

Polygon

Class to represent a spherical polygon

RollAngle

Class to represent and validate a roll angle

ConstrainedDate

Represents a constrained date with associated constraint information.

ConstraintReason

Represents the reasons for constraints at the boundaries of a visibility window.

VisibilityWindow

Represents a visibility window with duration and constraint information.

Window

Represents a time window bounded by constrained dates.

Functions

convert_to_wave(bandpass)

Converts a given EnergyBandpass or FrequencyBandpass to a WavelengthBandPass.

Package Contents

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

Bases: BaseBandpass

A class representing a bandpass filter defined in terms of energy.

Inherits from BaseBandpass, this class specializes the filter to operate in the energy domain.

type

A constant string indicating the type of the bandpass filter.

Type:

Literal[‘ENERGY’]

unit

The unit of measurement for the energy.

Type:

EnergyUnit

type: Literal['ENERGY'] = 'ENERGY'
unit: across.tools.core.enums.EnergyUnit
model_post_init(__context)[source]

Validates that the min and max energy values are positive.

Raises:

ValueError – If the min or max energy values are not defined, are non-positive, and max is greater than min.

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

Bases: BaseBandpass

A class representing a bandpass filter defined in terms of frequency.

Inherits from BaseBandpass, this class specializes the filter to operate in the frequency domain.

type

A constant string indicating the type of the bandpass filter.

Type:

Literal[‘FREQUENCY’]

unit

The unit of measurement for the frequency.

Type:

FrequencyUnit

type: Literal['FREQUENCY'] = 'FREQUENCY'
unit: across.tools.core.enums.FrequencyUnit
model_post_init(__context)[source]

Validates that the min and max frequency values are positive.

Raises:

ValueError – If the min or max energy values are not defined, are non-positive, and max is greater than min.

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

Bases: BaseBandpass

A class representing a bandpass filter defined in terms of wavelength.

Inherits from BaseBandpass, this class specializes the filter to operate in the wavelength domain and provides additional functionality for wavelength-based filters.

type

A constant string indicating the type of the bandpass filter.

Type:

Literal[‘WAVELENGTH’]

central_wavelength

The central wavelength of the filter. It is defined as the midpoint between the min and max.

Type:

float or None

bandwidth

The bandwidth of the filter. It is defined as half the difference between the max and min.

Type:

float or None

unit

The unit of measurement for the wavelength.

Type:

WavelengthUnit

type: Literal['WAVELENGTH'] = 'WAVELENGTH'
central_wavelength: float | None = None
peak_wavelength: float | None = None
bandwidth: float | None = None
unit: across.tools.core.enums.WavelengthUnit
model_post_init(__context)[source]

Validates the min and max values of the wavelength bandpass and calculates the central wavelength and bandwidth if they are not provided. Also ensures the values are positive and that the max wavelength is greater than the min wavelength. Lastly, it converts the units to angstroms.

Raises:

ValueError – If the min/max values are invalid or if the calculated values for central wavelength or bandwidth are non-positive.

convert_to_wave(bandpass)[source]

Converts a given EnergyBandpass or FrequencyBandpass to a WavelengthBandPass.

Parameters:

bandpass (EnergyBandpass or FrequencyBandpass) – The bandpass filter in energy or frequency domain.

Returns:

The corresponding bandpass filter in the wavelength domain.

Return type:

WavelengthBandpass

Notes

When converting from Energy/Frequency to wavelength, the min/max values are inverted in relation to their corresponding wavelengths. Thus, the min/max values are switched during conversion.

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

Bases: pydantic.BaseModel

Base class for schemas.

This class provides a base implementation for schemas and defines the from_attributes method. Subclasses can inherit from this class and override the from_attributes method to define their

own schema logic.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

__hash__()[source]
class Coordinate(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Class that represents a point in spherical space

ra: float = None
dec: float = None
model_post_init(__context)[source]

Pydantic post-init hook

Post-Init validations.

Ensure the RA is positive, and rounded to an appropriate precision

__repr__()[source]

Overrides the print statement

__eq__(other)[source]

Overrides the coordinate equals

AstropyDateTime[source]
AstropyTimeDelta[source]
class HealpixOrder(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Class to represent and validate a Healpix Order

constraint: Must be (0 >= a >= 13)

value: int = None
class Polygon(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Class to represent a spherical polygon

coordinates: list[across.tools.core.schemas.coordinate.Coordinate]
model_post_init(__context)[source]

Pydantic post-init hook

Post-Init validations.

1.) a polygon must contain a list of coordinates 1.) a polygon’s first and final coordinates must be the same (wrapping) 2.) a polygon has more than 3 unique coordinates

__repr__()[source]

Overrides the print statement

__eq__(other)[source]

Overrides the coordinate equals

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

Bases: across.tools.core.schemas.base.BaseSchema

Class to represent and validate a roll angle

constraint: Must be (-360.0 >= a >= 360.0)

value: float = None
class ConstrainedDate(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Represents a constrained date with associated constraint information.

datetime

The time of the constrained date.

constraint

The type of constraint active at this time.

observatory_id

UUID of the observatory or instrument associated with this constraint.

datetime: across.tools.core.schemas.custom_types.AstropyDateTime
constraint: across.tools.core.enums.constraint_type.ConstraintType
observatory_id: uuid.UUID
class ConstraintReason(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Represents the reasons for constraints at the boundaries of a visibility window.

start_reason

Human-readable description of the constraint that ends before the window starts.

end_reason

Human-readable description of the constraint that begins after the window ends.

start_reason: str
end_reason: str
class VisibilityWindow(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Represents a visibility window with duration and constraint information.

window

The time window defining the start and end of the visibility period.

max_visibility_duration

Maximum visibility duration in seconds for this window.

constraint_reason

The reasons for constraints at the window boundaries.

window: Window
max_visibility_duration: int
constraint_reason: ConstraintReason
class Window(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema

Represents a time window bounded by constrained dates.

begin

The start of the window with its associated constraint.

end

The end of the window with its associated constraint.

begin: ConstrainedDate
end: ConstrainedDate