adam_core.dynamics.plots module

adam_core.dynamics.plots.prepare_propagated_variants(propagated_variants: Orbits, impacts: CollisionEvent) dict[Literal['Non-Impacting', 'EARTH', 'MOON'], Orbits][source]

Sets variants propagated after their impact time to their impact coordinates on the surface of the colliding body. If the colliding body is the Earth, the variants are set to the impact coordinates on the surface of the Earth. If the colliding body is the Moon, the variants are set to the impact coordinates in the lunarcentric frame (but not fixed to the surface of the Moon).

Note: Due to the nature of the impact detection code, some of the variants may already be inside the sphere of the Earth when the impact is detected. In these cases, the variants’ distance from the geocenter is set to the radius of the Earth. The results of this function should not be used for high-fidelity impact predictions but instead for visualizations of the approximate impact corridor.

Parameters:
  • propagated_variants (Orbits) – The propagated variants to cleanse.

  • impacts (CollisionEvent) – The impacts detected within the variants.

Returns:

A dictionary containing the prepared variants, with keys:
  • ”Non-Impacting”: Variants that don’t impact any body

  • ”EARTH”: Variants that impact Earth (if any)

  • ”MOON”: Variants that impact the Moon (if any)

Only bodies that appear in the impacts will be included as keys.

Return type:

dict[Literal[“Non-Impacting”, “EARTH”, “MOON”], Orbits]

adam_core.dynamics.plots.generate_impact_visualization_data(orbit: Orbits, variant_orbits: VariantOrbits, impacts: CollisionEvent, propagator: Propagator, time_step: float = 5, time_range: float = 60, max_processes: int | None = None) Tuple[Timestamp, Orbits, dict[str, Orbits]][source]

Generates the data for the impact visualization animation. The user should be careful to only send in collision events that correspond to an impact with a planetary body or moon. Non-impacting collisions such as close approaches have not been tested for this function.

CollisionEvents visualizations are currently supported for the Earth and Moon.

Parameters:
  • orbit (Orbits) – The nominal best-fit orbit to propagate.

  • variant_orbits (VariantOrbits) – The variants to propagate.

  • impacts (CollisionEvent) – The impacts detected within the variants.

  • propagator (Propagator) – The propagator to use to propagate the orbit.

  • time_step (float) – The time step to use for the propagation.

  • time_range (float) – The time range to use for the propagation.

  • max_processes (Optional[int]) – The maximum number of processes to use for the propagation.

Returns:

The propagation times, the propagated nominal best-fit orbit and the propagated variants.

Return type:

Tuple[Timestamp, Orbits, dict[str, Orbits]]

adam_core.dynamics.plots.create_sphere(radius, offset=None)[source]

Create a set of points that form a sphere.

Parameters:
  • radius (float) – The radius of the sphere.

  • offset (array-like, optional) – The offset of the sphere from the origin.

adam_core.dynamics.plots.add_earth(time, coastlines: bool = True, origin: OriginCodes = OriginCodes.EARTH, frame: str = 'ecliptic', show: bool = True) Tuple[Surface, List[Scatter3d]][source]

Add the Earth to the plot.

Parameters:
  • time (Timestamp) – The time of the plot.

  • coastlines (bool, optional) – Whether to add the coastlines to the plot.

  • origin (Origin, optional) – The origin of the plot.

  • frame (str, optional) – The frame of the plot.

  • show (bool, optional) – Whether to show the Earth by default.

Returns:

The Earth rendered as a sphere and the traces for the coastlines.

Return type:

Tuple[go.Surface, List[go.Scatter3d]]

adam_core.dynamics.plots.add_moon(time: Timestamp, origin: OriginCodes = OriginCodes.EARTH, frame: Literal['ecliptic', 'equatorial', 'itrf93'] = 'ecliptic', show: bool = True) Surface[source]

Add the Moon to the plot.

Parameters:
  • time (Timestamp) – The time of the snapshot.

  • origin (OriginCodes) – The origin of the plot.

  • frame (Literal["ecliptic", "equatorial", "itrf93"]) – The frame of the plot.

Returns:

The Moon rendered as a sphere.

Return type:

go.Surface

adam_core.dynamics.plots.plot_impact_simulation(propagation_times: Timestamp, propagated_best_fit_orbit: Orbits, propagated_variants: dict[str, Orbits], impacts: CollisionEvent, grid: bool = True, title: str = None, logo: bool = True, show_impacting: bool = True, show_non_impacting: bool = True, show_best_fit: bool = True, show_earth: bool = True, show_moon: bool = True, sample_impactors: float | None = None, sample_non_impactors: float | None = None, height: int | None = None, width: int | None = None) Figure[source]

Plot the impact simulation.

Parameters:
  • propagated_best_fit_orbit (Orbits) – The propagated best-fit orbit.

  • propagated_variants (Orbits) – The propagated variants.

  • impacts (CollisionEvent) – The impacts detected within the variants.

  • grid (bool, optional) – Whether to add the grid to the plot.

  • title (str, optional) – The title of the plot.

  • logo (bool, optional) – Whether to add the Asteroid Institute logo to the plot.

  • show_impacting (bool, optional) – Whether to show the impacting variants.

  • show_non_impacting (bool, optional) – Whether to show the non-impacting variants.

  • show_best_fit (bool, optional) – Whether to show the best-fit orbit.

  • show_earth (bool, optional) – Whether to show the Earth.

  • show_moon (bool, optional) – Whether to show the Moon.

  • sample_impactors (Optional[float], optional) – Randomly sample the impactors for plotting. Should be between 0 and 1.

  • sample_non_impactors (Optional[float], optional) – Randomly sample the non-impactors for plotting. Should be between 0 and 1.

  • height (int, optional) – The height of the plot.

  • width (int, optional) – The width of the plot.

Returns:

The impact simulation plot.

Return type:

go.Figure

adam_core.dynamics.plots.plot_risk_corridor(impacts: CollisionEvent, title: str | None = None, logo: bool = True, height: int | None = None, width: int | None = None, map_style: Literal['carto-positron', 'open-street-map', 'white-bg'] = 'carto-positron') Figure[source]

Plot the risk corridor with toggleable globe/map views. Points colored by time with a linear scale and animated sequence.

Parameters:
  • impacts (Impact data containing coordinates)

  • title (str, optional) – Plot title

  • logo (bool, optional) – Whether to add the Asteroid Institute logo to the plot.

  • height (int, optional) – The height of the plot.

  • width (int, optional) – The width of the plot.

  • map_style ({"carto-positron", "open-street-map", "white-bg"}, optional) – Basemap style used by Plotly map tiles. Defaults to "carto-positron" to avoid OpenStreetMap tile-rate errors in shared/public viewing contexts.

Returns:

The risk corridor plot.

Return type:

go.Figure