Access Computation API¶
The access computation module provides comprehensive tools for determining when satellites can observe or communicate with ground locations.
Core Functions¶
location_accesses builtin ¶
location_accesses(locations: PointLocation | PolygonLocation | List[PointLocation | PolygonLocation], propagators: SGPPropagator | KeplerianPropagator | List[SGPPropagator | KeplerianPropagator], search_start: Epoch, search_end: Epoch, constraint: Union[ElevationConstraint, OffNadirConstraint, LocalTimeConstraint, LookDirectionConstraint, AscDscConstraint, ElevationMaskConstraint, ConstraintAll, ConstraintAny, ConstraintNot], property_computers: [List[AccessPropertyComputer]] = None, config: [AccessSearchConfig] = None) -> List[AccessWindow]
Compute access windows for locations and satellites.
This function accepts either single items or lists for both locations and propagators, automatically handling all combinations. All location-satellite pairs are computed and results are returned sorted by window start time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locations | PointLocation | PolygonLocation | List[PointLocation | PolygonLocation] | Single location or list of locations | required |
propagators | SGPPropagator | KeplerianPropagator | List[SGPPropagator | KeplerianPropagator] | Single propagator or list of propagators | required |
search_start | Epoch | Start of search window | required |
search_end | Epoch | End of search window | required |
constraint | AccessConstraint | Access constraints to evaluate | required |
property_computers | Optional[List[AccessPropertyComputer]] | Optional property computers | None |
config | Optional[AccessSearchConfig] | Search configuration (time step, tolerance, subdivisions, etc.) | None |
Returns:
| Type | Description |
|---|---|
List[AccessWindow] | List[AccessWindow]: List of access windows sorted by start time |
Example
Configuration¶
AccessSearchConfig ¶
AccessSearchConfig(initial_time_step: float = 60.0, adaptive_step: bool = False, adaptive_fraction: float = 0.75, parallel: bool = True, num_threads: [int] = None, time_tolerance: float = 0.001, subdivisions: [SubdivisionConfig] = None)
Configuration for access search grid parameters.
Controls the time step, adaptive stepping, boundary refinement tolerance, and optional subdivision behavior for access window finding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_time_step | float | Initial time step in seconds for grid search (default: 60.0) | 60.0 |
adaptive_step | bool | Enable adaptive stepping after first access (default: False) | False |
adaptive_fraction | float | Fraction of orbital period to use for adaptive step (default: 0.75) | 0.75 |
parallel | bool | Enable parallel computation (default: True) | True |
num_threads | Optional[int] | Number of threads for parallel computation (default: None) | None |
time_tolerance | float | Boundary refinement tolerance in seconds (default: 0.001) | 0.001 |
subdivisions | Optional[SubdivisionConfig] | Subdivision configuration per window (default: None) | None |
Example
Initialize instance.
adaptive_fraction property ¶
adaptive_fraction: float
Get the adaptive fraction (fraction of orbital period).
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Adaptive fraction |
adaptive_step property ¶
adaptive_step: bool
Get whether adaptive stepping is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | Adaptive stepping flag |
num_threads property ¶
parallel property ¶
parallel: bool
Get whether parallel computation is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | Parallel computation flag (default: True) |
subdivisions property ¶
subdivisions: Optional[SubdivisionConfig]
Get the subdivision configuration per access window.
Returns:
| Type | Description |
|---|---|
Optional[SubdivisionConfig] | Optional[SubdivisionConfig]: Subdivision configuration, or None for no subdivision |
SubdivisionConfig ¶
SubdivisionConfig(count: [int] = None, duration: [float] = None, offset: float = 0.0, gap: float = 0.0, truncate_partial: bool = False)
Configuration for how access windows are subdivided.
Supports two modes: equal-count (split into N equal parts) and fixed-duration (generate sub-windows with a specific duration at regular intervals).
Can be created using keyword constructor or named class methods:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count | Optional[int] | Number of equal subdivisions (EqualCount mode) | None |
duration | Optional[float] | Duration of each sub-window in seconds (FixedDuration mode) | None |
offset | float | Offset from parent window start in seconds (default: 0.0) | 0.0 |
gap | float | Gap between sub-windows in seconds, negative for overlap (default: 0.0) | 0.0 |
truncate_partial | bool | If True, truncate partial sub-windows; if False, drop them (default: False) | False |
Example
Initialize instance.
count property ¶
duration property ¶
gap property ¶
offset property ¶
truncate_partial property ¶
equal_count staticmethod ¶
equal_count(count: int) -> SubdivisionConfig
Create an equal-count subdivision configuration.
Splits each access window into N equal-duration sub-windows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count | int | Number of equal subdivisions (must be >= 1) | required |
Returns:
| Name | Type | Description |
|---|---|---|
SubdivisionConfig | SubdivisionConfig | Equal-count subdivision configuration |
fixed_duration staticmethod ¶
fixed_duration(duration: float, offset: float = 0.0, gap: float = 0.0, truncate_partial: bool = False) -> SubdivisionConfig
Create a fixed-duration subdivision configuration.
Generates sub-windows with a specific duration at regular intervals within each parent access window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration | float | Duration of each sub-window in seconds (must be > 0.0) | required |
offset | float | Offset from parent window start in seconds (default: 0.0) | 0.0 |
gap | float | Gap between sub-windows in seconds, negative for overlap (default: 0.0) | 0.0 |
truncate_partial | bool | If True, truncate partial sub-windows; if False, drop them (default: False) | False |
Returns:
| Name | Type | Description |
|---|---|---|
SubdivisionConfig | SubdivisionConfig | Fixed-duration subdivision configuration |
Threading Control¶
set_num_threads builtin ¶
Set the number of threads for parallel computation.
Configures the global thread pool used by Brahe for parallel operations such as access computations. This function can be called multiple times to dynamically change the thread pool configuration - each call will reinitialize the pool with the new thread count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n | int | Number of threads to use. Must be at least 1. | required |
Raises:
| Type | Description |
|---|---|
ValueError | If n < 1. |
RuntimeError | If thread pool fails to build. |
Example
Note
Unlike earlier versions, this function no longer raises an error if the thread pool has already been initialized. You can safely call it at any time to reconfigure the thread pool.
set_max_threads builtin ¶
set_max_threads() -> Any
Set the thread pool to use all available CPU cores.
This is a convenience function that sets the number of threads to 100% of available CPU cores. Can be called multiple times to reinitialize the thread pool dynamically.
Raises:
| Type | Description |
|---|---|
RuntimeError | If thread pool fails to build. |
Example
Note
This function can be called at any time, even after the thread pool has been initialized with a different configuration.
set_ludicrous_speed builtin ¶
set_ludicrous_speed() -> Any
LUDICROUS SPEED! GO!
Set the thread pool to use all available CPU cores (alias for set_max_threads).
This is a fun alias for set_max_threads() that sets the number of threads to 100% of available CPU cores for maximum performance. Can be called multiple times to dynamically reinitialize the thread pool.
Raises:
| Type | Description |
|---|---|
RuntimeError | If thread pool fails to build. |
Example
Note
This function can be called at any time to reconfigure the thread pool to use maximum available cores, regardless of previous configuration.
get_max_threads builtin ¶
get_max_threads() -> int
Get the current maximum number of threads for parallel computation.
Returns the number of threads configured for the global thread pool. If the thread pool hasn't been initialized yet, this initializes it with the default (90% of available cores) and returns that value.
Returns:
| Name | Type | Description |
|---|---|---|
int | int | Number of threads currently configured. |
Example
Note
Calling this function will initialize the thread pool with default settings (90% of cores) if it hasn't been configured yet. After initialization, you can still reconfigure it using set_num_threads() or set_max_threads().