Skip to content

Horizons SPK

API reference for the JPL Horizons SPK client. All types are available via brahe.datasets.horizons.

HorizonsClient

HorizonsClient

HorizonsClient(base_url: str = None)

Client for the JPL Horizons SPK generation API.

Parameters:

Name Type Description Default
base_url str

Override the Horizons base URL (for testing).

None
Example
1
2
3
4
5
import brahe as bh
client = bh.datasets.horizons.HorizonsClient()
req = bh.datasets.horizons.HorizonsSPKRequest.for_spkid(20000001, t0, t1)
resp = client.get_spk(req)
resp.load()

Initialize instance.

get_spk method descriptor

Generate (or reuse a cached) SPK for the request.

Parameters:

Name Type Description Default
request HorizonsSPKRequest

The SPK generation request.

required

Returns:

Name Type Description
HorizonsSPKResponse HorizonsSPKResponse

Handle to the cached .bsp.

HorizonsSPKRequest

HorizonsSPKRequest

HorizonsSPKRequest(command: str, start: Epoch, stop: Epoch)

A request to generate a small-body SPK over a time span.

Parameters:

Name Type Description Default
command str

Horizons COMMAND target, e.g. "DES=20000001;".

required
start Epoch

SPK span start.

required
stop Epoch

SPK span stop.

required

Initialize instance.

center property

center: Any

TODO: Add docstring

command property

command: Any

TODO: Add docstring

for_spkid staticmethod

for_spkid(spkid: int, start: Epoch, stop: Epoch) -> HorizonsSPKRequest

Create a request targeting a small body by SPK-ID.

Parameters:

Name Type Description Default
spkid int

Small-body SPK-ID (NAIF ID).

required
start Epoch

SPK span start.

required
stop Epoch

SPK span stop.

required

Returns:

Name Type Description
HorizonsSPKRequest HorizonsSPKRequest

The configured request.

with_center method descriptor

with_center(center: str) -> HorizonsSPKRequest

Override the CENTER body (default "500@0", the SSB).

Parameters:

Name Type Description Default
center str

Horizons center specification.

required

Returns:

Name Type Description
HorizonsSPKRequest HorizonsSPKRequest

The request with the new center.

HorizonsSPKResponse

HorizonsSPKResponse

HorizonsSPKResponse()

A handle to a generated (or cached) Horizons SPK kernel.

Attributes:

Name Type Description
path str

Path to the cached .bsp kernel.

spk_file_id str | None

Horizons spk_file_id, if returned.

Initialize instance.

path property

path: Any

TODO: Add docstring

spk_file_id property

spk_file_id: Any

TODO: Add docstring

bytes method descriptor

bytes() -> bytes

Read the raw SPK bytes from the cached file.

Returns:

Name Type Description
bytes bytes

The kernel file contents.

load method descriptor

load() -> None

Load the cached SPK into the global SPICE registry.

Returns:

Name Type Description
None None

On success.


See Also