Skip to content

Property Computers

Property computers calculate additional measurements for access windows beyond basic visibility timing.

Configuration

SamplingConfig

SamplingConfig

SamplingConfig(relative_times: list[float] = None, interval: float = None, offset: float = None, count: int = None)

Sampling configuration for access property computation.

Determines how many times and when to sample satellite states during an access window for property calculations.

Parameters:

Name Type Description Default
relative_times list[float]

Relative times from 0.0 (start) to 1.0 (end). If provided, uses relative points sampling.

None
interval float

Time between samples (seconds). If provided with offset, uses fixed interval sampling.

None
offset float

Time offset from window start (seconds). Used with interval.

None
count int

Number of evenly-spaced sample points. If provided, uses fixed count sampling.

None
Note

If no parameters are provided, defaults to midpoint sampling. Parameters are checked in priority order: relative_times, interval+offset, count.

Example
import brahe as bh

# Midpoint (default)
config = bh.SamplingConfig()

# Relative points
config = bh.SamplingConfig(relative_times=[0.0, 0.5, 1.0])

# Fixed interval
config = bh.SamplingConfig(interval=0.1, offset=0.0)

# Fixed count
config = bh.SamplingConfig(count=10)

# Or use convenience static methods
config = bh.SamplingConfig.midpoint()
config = bh.SamplingConfig.relative_points([0.0, 0.5, 1.0])

Initialize instance.

fixed_count staticmethod

fixed_count(count: int) -> SamplingConfig

Create a fixed count sampling configuration.

Parameters:

Name Type Description Default
count int

Number of evenly-spaced sample points (including endpoints)

required

Returns:

Name Type Description
SamplingConfig SamplingConfig

Fixed count sampling configuration

Example
1
2
3
import brahe as bh
# Sample at 10 evenly-spaced points
config = bh.SamplingConfig.fixed_count(10)

fixed_interval staticmethod

fixed_interval(interval: float, offset: float) -> SamplingConfig

Create a fixed interval sampling configuration.

Parameters:

Name Type Description Default
interval float

Time between samples (seconds)

required
offset float

Time offset from window start (seconds)

required

Returns:

Name Type Description
SamplingConfig SamplingConfig

Fixed interval sampling configuration

Example
1
2
3
import brahe as bh
# Sample every 0.1 seconds, starting at window open
config = bh.SamplingConfig.fixed_interval(0.1, 0.0)

midpoint staticmethod

midpoint() -> SamplingConfig

Create a midpoint sampling configuration (single sample at window center).

Returns:

Name Type Description
SamplingConfig SamplingConfig

Midpoint sampling configuration

Example
import brahe as bh
config = bh.SamplingConfig.midpoint()

relative_points staticmethod

relative_points(relative_times: list[float]) -> SamplingConfig

Create a relative points sampling configuration.

Parameters:

Name Type Description Default
relative_times list[float]

Relative times from 0.0 (window start) to 1.0 (window end)

required

Returns:

Name Type Description
SamplingConfig SamplingConfig

Relative points sampling configuration

Example
1
2
3
import brahe as bh
# Sample at start, quarter, middle, three-quarters, and end
config = bh.SamplingConfig.relative_points([0.0, 0.25, 0.5, 0.75, 1.0])

Built-in Computers

DopplerComputer

DopplerComputer

DopplerComputer(uplink_frequency: Any, downlink_frequency: Any, sampling_config: Any)

Computes Doppler shift during access windows.

Calculates uplink and/or downlink Doppler shifts based on satellite velocity and line-of-sight geometry.

Example
1
2
3
4
5
6
7
8
9
import brahe as bh

# Doppler for GPS L1 downlink
config = bh.SamplingConfig.midpoint()
computer = bh.DopplerComputer(
    uplink_frequency=None,
    downlink_frequency=1.57542e9,  # Hz
    sampling_config=config
)

Initialize instance.

RangeComputer

RangeComputer

RangeComputer(sampling_config: Any)

Computes range (distance) during access windows.

Calculates the distance between satellite and ground location.

Example
1
2
3
4
import brahe as bh

config = bh.SamplingConfig.fixed_interval(0.1 / 86400.0, 0.0)
computer = bh.RangeComputer(config)

Initialize instance.

RangeRateComputer

RangeRateComputer

RangeRateComputer(sampling_config: Any)

Computes range rate (radial velocity) during access windows.

Calculates the rate of change of distance between satellite and ground location.

Example
1
2
3
4
import brahe as bh

config = bh.SamplingConfig.fixed_interval(0.1 / 86400.0, 0.0)
computer = bh.RangeRateComputer(config)

Initialize instance.

Custom Property Computers

AccessPropertyComputer

AccessPropertyComputer

AccessPropertyComputer()

Base class for custom access property computers.

Subclass this class and implement the compute and property_names methods to create custom property calculations that can be applied to access windows.

The compute method is called for each access window and should return a dictionary of property names to values. Properties can be scalars, vectors, time series, booleans, strings, or any JSON-serializable value.

Example
import brahe as bh
import numpy as np

class DopplerComputer(bh.AccessPropertyComputer):
    '''Computes Doppler shift time series during access windows.'''

    def sampling_config(self) -> bh.SamplingConfig:
        '''Configure sampling at 1 Hz during access windows.'''
        return bh.SamplingConfig.fixed_interval(1.0, 0.0)

    def compute(
        self,
        window: bh.AccessWindow,
        sample_epochs: np.ndarray,
        sample_states_ecef: np.ndarray,
        location_ecef: np.ndarray,
        location_geodetic: np.ndarray
    ) -> dict:
        '''
        Args:
            window (AccessWindow): AccessWindow with timing information
            sample_epochs (ndarray): Sample epochs in MJD [N]
            sample_states_ecef (ndarray): Satellite states [N x 6] in ECEF (m, m/s)
            location_ecef (ndarray or list): Location position [x,y,z] in ECEF (m)
            location_geodetic (ndarray or list): Location geodetic [lon,lat,alt] (deg, deg, m)

        Returns:
            dict: Property name -> value (scalar, list, or dict for time series)
        '''
        # Compute Doppler shift at each sample
        doppler_values = []
        for state in sample_states_ecef:
            sat_pos = state[:3]
            sat_vel = state[3:6]

            # Line-of-sight vector
            los = sat_pos - location_ecef
            los_unit = los / np.linalg.norm(los)

            # Radial velocity
            radial_velocity = np.dot(sat_vel, los_unit)

            # Doppler shift (L-band)
            freq_hz = 1.57542e9  # GPS L1
            doppler_hz = -radial_velocity * freq_hz / bh.C_LIGHT
            doppler_values.append(doppler_hz)

        # Return time series
        return {
            "doppler_shift": {
                "times": sample_epochs.tolist(),
                "values": doppler_values
            }
        }

    def property_names(self) -> list:
        '''Return list of property names this computer produces.'''
        return ["doppler_shift"]

# Use with access computation (future)
computer = DopplerComputer()
# accesses = bh.compute_accesses(..., property_computers=[computer])
Notes
  • The compute method receives ECEF coordinates in SI units (meters, m/s)
  • Property values are automatically converted to appropriate Rust types
  • The window parameter provides access to timing via:
  • window.window_open: Start epoch
  • window.window_close: End epoch
  • window.midtime(): Midpoint epoch
  • window.duration(): Duration in seconds

Initialize instance.

compute method descriptor

compute(window: AccessWindow, sample_epochs: ndarray, sample_states_ecef: ndarray, location_ecef: Union[ndarray, List], location_geodetic: Union[ndarray, List]) -> dict

Compute custom properties for an access window.

Override this method in your subclass to implement custom property calculations.

Parameters:

Name Type Description Default
window AccessWindow

Access window with timing information

required
sample_epochs ndarray

Sample epochs in MJD (Modified Julian Date)

required
sample_states_ecef ndarray

Satellite states in ECEF (N x 6) [x,y,z,vx,vy,vz] (meters, m/s)

required
location_ecef ndarray or list

Location position in ECEF [x,y,z] (meters)

required
location_geodetic ndarray or list

Location geodetic coordinates [lon,lat,alt] (radians, meters)

required

Returns:

Name Type Description
dict dict

Dictionary mapping property names (str) to values (scalar, list, dict, etc.)

property_names method descriptor

property_names() -> list[str]

Return list of property names this computer will produce.

Override this method to return the list of property names that your compute() method will include in its returned dictionary.

Returns:

Type Description
list[str]

list[str]: List of property names

sampling_config method descriptor

sampling_config() -> SamplingConfig

Return sampling configuration for this property computer.

Override this method to specify how you want the satellite states to be sampled during the access window.

Returns:

Name Type Description
SamplingConfig SamplingConfig

The sampling configuration

Example
1
2
3
4
5
import brahe as bh

class MyComputer(bh.AccessPropertyComputer):
    def sampling_config(self) -> bh.SamplingConfig:
        return bh.SamplingConfig.midpoint()

Property Storage

PropertiesDict

PropertiesDict

PropertiesDict()

A dictionary-like wrapper for Location properties that supports dict-style assignment.

This class provides a Pythonic dict interface for accessing and modifying location properties. Changes are automatically synchronized with the underlying Location object.

Example
import brahe as bh

loc = bh.PointLocation(15.4, 78.2, 0.0)

# Dict-style assignment
loc.properties["climate"] = "Arctic"
loc.properties["country"] = "Norway"

# Dict-style access
climate = loc.properties["climate"]

# Dict methods work
if "country" in loc.properties:
    print(loc.properties["country"])

# Iteration
for key in loc.properties:
    print(key, loc.properties[key])

Initialize instance.

clear method descriptor

clear() -> None

Remove all properties.

Returns:

Type Description
None

None

get method descriptor

get(key: str, default: Any = None) -> Any

Get property value with optional default.

Parameters:

Name Type Description Default
key str

Property name

required
default optional

Value to return if key not found

None

Returns:

Name Type Description
Any Any

Property value if key exists, otherwise default value

items method descriptor

items() -> List

Return a list of (key, value) tuples.

Returns:

Type Description
List

List of (key, value) tuples

keys method descriptor

keys() -> List

Return a list of property keys.

Returns:

Type Description
List

List of property key strings

update method descriptor

update(other: dict) -> None

Update properties from another dict.

Parameters:

Name Type Description Default
other dict

Dictionary to merge into properties

required

Returns:

Type Description
None

None

values method descriptor

values() -> List

Return a list of property values.

Returns:

Type Description
List

List of property values