The client¶
- class lunaspace.Client¶
The API with your organisation’s key.
api_keydefaults to the environment’sLUNA_API_KEY,base_urltoLUNA_API_URLor the service’s address.transportreplaces httpx’s (tests). Use it as a context manager, or callclose(), to release its connections.- __init__(api_key=None, *, base_url=None, timeout=60.0, transport=None)¶
- close()¶
Releases the client’s connections.
- Return type:
None
- request(method, path, *, json=None, content=None, params=None)¶
One call of the API: its JSON answer (None for an empty one); a LunaError for an answer that is not a success.
- fetch(path)¶
A file of the API’s, as it is, and the name the API gives it.
- save(path, to=None, name=None)¶
A file of the API’s: written to
to(a file; or a directory, under the name the API gives it, elsename) and its path returned, or its bytes returned.
- wait_until(fetch, done, what, *, timeout, poll, sleep=<built-in function sleep>)¶
fetch()again everypollseconds untildone; WaitTimeout aftertimeout.
- me()¶
Your organisation, and the features of its tier.
- Return type:
- profiles()¶
The kinds of orbit determination the service runs, with their settings.
Resources¶
Each is an attribute of the client: client.assets, client.runs, client.orbits and so on. Wherever a
method takes a satellite, it takes the Asset, its id or its name.
- class lunaspace.client.Assets¶
Your satellites.
- create(name, *, external_id=None, group=None, norad_id=None, international_designator=None)¶
A new satellite;
groupkeeps it in a group of that name (a constellation, a mission).
- class lunaspace.client.Properties¶
A satellite’s spacecraft properties, each from the time it is valid.
- list(asset)¶
The satellite’s spacecraft properties, every version.
- Parameters:
- Return type:
- add(asset, *, mass_kg, drag_area_m2, srp_area_m2, drag_coefficient=None, reflectivity_coefficient=None, antenna_offset_m=None, valid_from=None)¶
A new version of the satellite’s spacecraft properties, from
valid_from(none: from the start).
- class lunaspace.client.Tracking¶
A satellite’s navigation fixes: CSV (
epoch,x,y,z[,vx,vy,vz], ITRF, km) or SP3.- upload(asset, file=None, *, data=None, filename=None, satellite=None)¶
Upload fixes: a file, or
dataheld in memory with thefilenameto record (both CSV or SP3);satellitepicks one of an SP3 file’s. Uploading the same fixes again returns the first upload.
- class lunaspace.client.Runs¶
Orbit determinations.
- request(asset, arc_start, arc_end, *, setting=None, custom=None, profile=None, engine=None)¶
Ask for an orbit determination over the arc, from the satellite’s uploads and properties; it is queued, and
Run.wait()waits for it.settingnames one of the profile’s settings;customgives the estimation’s settings yourself in its place ({"segment_minutes": 45, ...}: seeProfile.custom_settings; the featureod_custom_settings, orFeatureNotIncluded).
- list(asset, *, limit=50, comparisons=False)¶
The satellite’s runs, the newest first; a comparison’s only if asked for.
- wait(run, *, timeout=1800.0, poll=5.0, raise_on_failure=True, sleep=<built-in function sleep>)¶
The run once it has finished:
RunFailedif it failed (unlessraise_on_failureis False),WaitTimeoutif it has not finished intimeoutseconds.
- diagnostics(run)¶
What an analyst looks at to judge a finished run beyond its gate: the residuals against N(0, 1) and per segment, the estimates with their sigmas, correlations, convergence, the run before’s prediction against its sigmas (feature
od_diagnostics).- Parameters:
- Return type:
- trends(asset, *, limit=60)¶
The satellite’s latest finished runs, oldest arc first, figure by figure (feature
od_trends).
- download(run, name, to=None)¶
A product of the run (
oem,residuals,uncertainty,result): written toto(a file, or a directory for the product’s own file name) and its path returned, or its bytes returned.
- report(run, to=None)¶
The run as a report to read and pass on: one self-contained HTML page (the verdict and its checks, the fit, the estimates, the orbit’s uncertainty, the inputs), of a finished run. Written to
to(a file, or a directory for<run-id>.html) and its path returned, or its bytes returned.
- class lunaspace.client.Schedules¶
A satellite’s automatic runs.
- get(asset)¶
The satellite’s schedule, or None if it has none.
- set(asset, **fields)¶
Make or change the schedule:
enabled,profile,setting,custom(the estimation’s settings given yourself, as inruns.request; None takes them away),arc_hours,interval_hours,max_wait_hours,prior_covariance,first_arc_start. A schedule that exists keeps what is not given.
- class lunaspace.client.Orbits¶
A satellite’s current orbit: the accepted run it comes from, and its ephemeris.
- get(asset)¶
The satellite’s orbit, or None before its first accepted run.
- ephemeris(asset, to=None)¶
The current orbit’s ephemeris (CCSDS OEM): written to
to(a file, or a directory for<satellite>.oem), or returned as bytes.
- reconstructed(asset, start, end, *, frame='GCRF', covariance=True, step_s=None)¶
Ask for the satellite’s reconstructed orbit over a span: the fitted arcs of its accepted runs one after another in one ephemeris (CCSDS OEM), never a prediction. Two arcs that overlap meet in the middle of what they share; a time no arc covers stays a gap (
pieces,gaps). Inframe(“GCRF” or “ITRF”), atstep_s(None: the runs’ own time tags), with or without the covariances..wait()waits for it,.download()gets the file.
- reconstructed_list(asset, *, limit=20)¶
The reconstructed orbits asked for of the satellite, the latest first.
- drag_coefficients(asset, *, start=None, end=None)¶
The history of the satellite’s drag coefficient: what each accepted run estimated over its arc, with its sigma, the oldest arc first (
start,end: the arcs that end after, start before).lunaspace.frames.drag_coefficientsmakes a data frame of it.
- drag_coefficients_file(asset, to=None, *, start=None, end=None)¶
The drag coefficient’s history as a table (CSV): written to
to(a file, or a directory for the name the API gives it), or returned as bytes.
- class lunaspace.client.Stations¶
The organisation’s ground stations, and the ones each satellite uses.
- create(name, *, latitude_deg=None, longitude_deg=None, height_m=None, cartesian_m=None, mask_deg=None, horizon=None, downlink_frequency_hz=None)¶
A station from its geodetic position (WGS84), or its Cartesian one in ITRF (
cartesian_m={"x": ..., "y": ..., "z": ...}); a mask in degrees, or a horizon of{"azimuth_deg", "elevation_deg"}points.
- update(station, **fields)¶
Replace the station’s description with
fields(the same ascreate’s).
- catalogue(query=None)¶
The service’s catalogue of sites (open sources), by a search of name or provider, to fill a station in from.
- Parameters:
query (str | None)
- Return type:
- of(asset)¶
The stations the satellite uses.
- assign(asset, stations, *, passes_days=None, light_time=None)¶
The stations the satellite uses (its passes are computed over them with each orbit), and optionally the days ahead (1 to 7) and the light time (
none,receive,transmit).
- class lunaspace.client.PassesResource¶
A satellite’s passes over its stations, made with each orbit or on request.
- get(asset, *, run=None)¶
The latest passes of the current orbit (or of
run), or None.
- request(asset)¶
Compute them again for the current orbit;
.wait()waits for them.
- class lunaspace.client.OrbitEventsResource¶
A satellite’s orbit events: its eclipses, its crossings of the equator with the beta angle, its orbits one by one and its ground track. Made with each orbit where the satellite has
orbit_events_enabled(assets.update(asset, orbit_events_enabled=True)), or on request.- get(asset, *, run=None)¶
The latest events of the current orbit (or of
run), or None.- Parameters:
- Return type:
OrbitEvents | None
- request(asset)¶
Compute them again for the current orbit;
.wait()waits for them.- Parameters:
- Return type:
- class lunaspace.client.OrbitFiles¶
A run’s orbit in another form, made on request: its ephemeris written again, or one state of it as a CCSDS OPM. (A satellite’s reconstructed orbit, which is made of several runs, is asked for with
orbits.reconstructed.)- request(run, format='oem', *, frame='GCRF', covariance=True, step_s=None, start=None, end=None, epoch=None)¶
Ask for the run’s orbit in another form;
.wait()waits for it,.download()gets the file.format“oem”: the run’s ephemeris (its fitted arc and its prediction) as a CCSDS OEM inframe(“GCRF”, or “ITRF”: the Earth-fixed frame), atstep_s(1 to 3600; None: the run’s own time tags), fromstarttoend(None: all of it), with or without its covariances.format“opm”: the state atepoch(None: the end of the run’s arc) as a CCSDS Orbit Parameter Message, with the osculating Keplerian elements (in GCRF), the spacecraft’s parameters (the mass as it is at the epoch), the covariance where the ephemeris has one there, and the run’s manoeuvres after the epoch, each with its mass change.
- list(run)¶
The orbit files asked for of the run, the latest first.
- class lunaspace.client.TleResource¶
A satellite’s TLEs and OMMs, fitted to an orbit.
- get(asset, *, run=None)¶
The latest TLE of the current orbit (or of
run), or None.
- request(asset)¶
Fit one to the current orbit, with the satellite’s identifiers;
.wait().
- class lunaspace.client.Plans¶
Manoeuvre plans from a satellite’s current orbit (advice only).
- request(asset, *, window_start=None, window_end=None, **targets)¶
Ask for burns in the window that reach the targets, each a dictionary as the API takes it:
semi_major_axis={"delta_m": 50},inclination={"value_deg": 87.35},node={...},phase={...},ground_track={...},eccentricity_vector={...}; andstrategy,elements,prediction_hours,burn_sigma_mm_s,cd_sigma.
- list(asset, *, limit=20)¶
The satellite’s plans, newest first.
- class lunaspace.client.Comparisons¶
One arc determined with several settings, set side by side.
- request(asset, arc_start, arc_end, *, settings=None, engines=None, profile=None)¶
Compare
settings(the profile’s few when none are named) over the arc.
- list(asset, *, limit=20)¶
The satellite’s comparisons, newest first.
- Parameters:
- Return type:
- wait(comparison, *, timeout=3600.0, poll=10.0, sleep=<built-in function sleep>)¶
The comparison once every setting has finished (or been skipped).
- Parameters:
- Return type:
- class lunaspace.client.Manoeuvres¶
The manoeuvres a satellite made or will make, as you report them.
- list(asset, *, limit=100)¶
The manoeuvres reported for the satellite.
- report(asset, epoch, *, radial_m_s=0.0, along_track_m_s=0.0, cross_track_m_s=0.0, sigma_m_s=None, delta_mass_kg=None, specific_impulse_s=None)¶
A burn at
epoch, its velocity change in the orbit’s axes [m/s]: estimated by the runs whose arc holds it, applied in the predictions of those before it. What it spent, in one of two ways:delta_mass_kg(the mass change, negative: the propellant as your bookkeeping has it) orspecific_impulse_s(the thruster’s: the mass change follows from the velocity change). The satellite is that much lighter from the burn on; with neither, its mass stays.
- class lunaspace.client.Webhooks¶
Addresses the service tells when a run finishes or wants a look.
- list()¶
Your organisation’s webhooks, with when an event last arrived or why the latest did not.
- create(url, *, events=None)¶
A webhook for
url(https) andevents(od.completed,od.flagged; both when none are named). Keep itssecret: it is shown once.- Parameters:
- Return type: