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, time_tolerance: [float] = 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 (default: 60s fixed grid, no adaptation) | None |
time_tolerance | Optional[float] | Bisection search tolerance in seconds (default: 0.01) | 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: Any = True, num_threads: Any = None)
Configuration for access search grid parameters.
Controls the time step and adaptive stepping 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 |
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 ¶
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().