adam_core.missions.porkchop module

adam_core.missions.porkchop.generate_saturated_colorscale(base_color: str, n_levels: int = 8, max_alpha: float = 0.8, min_alpha: float = 0.1) List[List][source]

Generate a colorscale from light to dark based on a base color with full saturation and variable transparency that increases with color intensity.

Parameters:
  • base_color (str) – Base color name (e.g., ‘red’, ‘blue’) or hex code (e.g., ‘#FF0000’)

  • n_levels (int, optional) – Number of levels in the colorscale (default: 8)

  • max_alpha (float, optional) – Maximum alpha (opacity) for darkest colors (default: 0.8)

  • min_alpha (float, optional) – Minimum alpha (opacity) for lightest colors (default: 0.1)

Returns:

Plotly colorscale format with RGBA: [[position, color], …]

Return type:

List[List]

adam_core.missions.porkchop.generate_perceptual_colorscale(base_color: str, n_levels: int = 8, min_lightness: float = 0.3, max_lightness: float = 0.9, max_alpha: float = 0.8, min_alpha: float = 0.1) List[List][source]

Generate a perceptually uniform colorscale with full saturation and variable transparency that works better for overlaying contours.

Parameters:
  • base_color (str) – Base color name (e.g., ‘red’, ‘blue’) or hex code (e.g., ‘#FF0000’)

  • n_levels (int, optional) – Number of levels in the colorscale (default: 8)

  • min_lightness (float, optional) – Minimum lightness value (0-1, default: 0.3 for good contrast)

  • max_lightness (float, optional) – Maximum lightness value (0-1, default: 0.9 for visibility with transparency)

  • max_alpha (float, optional) – Maximum alpha (opacity) for darkest colors (default: 0.8)

  • min_alpha (float, optional) – Minimum alpha (opacity) for lightest colors (default: 0.1)

Returns:

Plotly colorscale format with RGBA: [[position, color], …]

Return type:

List[List]

class adam_core.missions.porkchop.LambertSolutions(table: Table, **kwargs: int | float | str)[source]

Bases: Table

departure_body_id

A column for storing large strings (over 231 bytes long). Large string data is stored in variable-length chunks.

departure_time

A column which represents an embedded quivr table.

Parameters:
  • table_type – The type of the table to embed.

  • nullable – Whether the column can contain null values.

  • metadata – A dictionary of metadata to attach to the column.

departure_body_x

A column for storing 64-bit floating point numbers.

departure_body_y

A column for storing 64-bit floating point numbers.

departure_body_z

A column for storing 64-bit floating point numbers.

departure_body_vx

A column for storing 64-bit floating point numbers.

departure_body_vy

A column for storing 64-bit floating point numbers.

departure_body_vz

A column for storing 64-bit floating point numbers.

arrival_body_id

A column for storing large strings (over 231 bytes long). Large string data is stored in variable-length chunks.

arrival_time

A column which represents an embedded quivr table.

Parameters:
  • table_type – The type of the table to embed.

  • nullable – Whether the column can contain null values.

  • metadata – A dictionary of metadata to attach to the column.

arrival_body_x

A column for storing 64-bit floating point numbers.

arrival_body_y

A column for storing 64-bit floating point numbers.

arrival_body_z

A column for storing 64-bit floating point numbers.

arrival_body_vx

A column for storing 64-bit floating point numbers.

arrival_body_vy

A column for storing 64-bit floating point numbers.

arrival_body_vz

A column for storing 64-bit floating point numbers.

solution_departure_vx

A column for storing 64-bit floating point numbers.

solution_departure_vy

A column for storing 64-bit floating point numbers.

solution_departure_vz

A column for storing 64-bit floating point numbers.

solution_arrival_vx

A column for storing 64-bit floating point numbers.

solution_arrival_vy

A column for storing 64-bit floating point numbers.

solution_arrival_vz

A column for storing 64-bit floating point numbers.

frame

StringAttribute represents a string which is stored as UTF-8 bytes in Table metadata.

Parameters:

default – The default value for this attribute. If no default is provided, then the attribute must be set whenever constructing a table that uses it.

origin

A column which represents an embedded quivr table.

Parameters:
  • table_type – The type of the table to embed.

  • nullable – Whether the column can contain null values.

  • metadata – A dictionary of metadata to attach to the column.

departure_body_orbit() Orbits[source]

Return the departure body orbit.

arrival_body_orbit() Orbits[source]

Return the arrival body orbit.

solution_departure_orbit() Orbits[source]

Return the solution departure orbit.

solution_arrival_orbit() Orbits[source]

Return the solution arrival orbit.

c3_departure() ndarray[tuple[Any, ...], dtype[float64]][source]

Return the C3 in au^2/d^2.

c3_arrival() ndarray[tuple[Any, ...], dtype[float64]][source]

Return the C3 in au^2/d^2.

vinf_departure() ndarray[tuple[Any, ...], dtype[float64]][source]

Return the v infinity in au/d.

vinf_arrival() ndarray[tuple[Any, ...], dtype[float64]][source]

Return the v infinity in au/d.

time_of_flight() ndarray[tuple[Any, ...], dtype[float64]][source]

Return the time of flight in days.

schema: ClassVar[pa.Schema] = departure_body_id: large_string not null departure_time: struct<days: int64, nanos: int64>   child 0, days: int64   child 1, nanos: int64 departure_body_x: double not null departure_body_y: double not null departure_body_z: double not null departure_body_vx: double not null departure_body_vy: double not null departure_body_vz: double not null arrival_body_id: large_string not null arrival_time: struct<days: int64, nanos: int64>   child 0, days: int64   child 1, nanos: int64 arrival_body_x: double not null arrival_body_y: double not null arrival_body_z: double not null arrival_body_vx: double not null arrival_body_vy: double not null arrival_body_vz: double not null solution_departure_vx: double not null solution_departure_vy: double not null solution_departure_vz: double not null solution_arrival_vx: double not null solution_arrival_vy: double not null solution_arrival_vz: double not null origin: struct<code: large_string>   child 0, code: large_string
adam_core.missions.porkchop.departure_spherical_coordinates(departure_origin: OriginCodes, times: Timestamp, frame: str, vx: ndarray[tuple[Any, ...], dtype[float64]], vy: ndarray[tuple[Any, ...], dtype[float64]], vz: ndarray[tuple[Any, ...], dtype[float64]]) SphericalCoordinates[source]

Return the spherical coordinates of the departure vector.

Parameters:
  • departure_origin (OriginCodes) – The origin of the departure and also the frame of the departure vectors.

  • times (Timestamp) – The times of the departure vectors.

  • frame (str) – The frame of the departure vectors.

  • vx (npt.NDArray[np.float64]) – The x-component of the departure vectors.

  • vy (npt.NDArray[np.float64]) – The y-component of the departure vectors.

  • vz (npt.NDArray[np.float64]) – The z-component of the departure vectors.

Returns:

The spherical coordinates of the departure unit vectors. Can be used to express ra / dec of the departure direction.

Return type:

SphericalCoordinates

adam_core.missions.porkchop.lambert_worker(departure_orbits: Orbits, arrival_orbits: Orbits, propagation_origin: OriginCodes, prograde: bool = True, max_iter: int = 35, tol: float = 1e-10) LambertSolutions[source]
adam_core.missions.porkchop.prepare_and_propagate_orbits(body: Orbits | OriginCodes, start_time: Timestamp, end_time: Timestamp, propagation_origin: OriginCodes = OriginCodes.SUN, step_size: float = 1.0, propagator_class: type[Propagator] | None = None, max_processes: int | None = 1) Orbits[source]

Prepare and propagate orbits for a single body over a specified time range.

Parameters:
  • body (Union[Orbits, OriginCodes]) – The body to propagate (either an Orbits object or an OriginCode for a major body).

  • start_time (Timestamp) – The start time for propagation.

  • end_time (Timestamp) – The end time for propagation.

  • propagation_origin (OriginCodes, optional) – The origin of the propagation (default: SUN).

  • step_size (float, optional) – The step size in days (default: 1.0).

  • propagator_class (Optional[type[Propagator]], optional) – The propagator class to use for orbit propagation.

  • max_processes (Optional[int], optional) – The maximum number of processes to use.

Returns:

The propagated orbits over the specified time range.

Return type:

Orbits

adam_core.missions.porkchop.generate_porkchop_data(departure_orbits: Orbits, arrival_orbits: Orbits, propagation_origin: OriginCodes = OriginCodes.SUN, prograde: bool = True, max_iter: int = 35, tol: float = 1e-10, max_processes: int | None = 1) LambertSolutions[source]

Generate data for a porkchop plot by solving Lambert’s problem for a grid of departure and arrival times.

Parameters:
  • departure_orbits (Orbits) – The departure orbits.

  • arrival_orbits (Orbits) – The arrival orbits.

  • propagation_origin (OriginCodes) – The origin of the propagation.

  • prograde (bool, optional) – If True, assume prograde motion. If False, assume retrograde motion.

  • max_iter (int, optional) – The maximum number of iterations for Lambert’s solver.

  • tol (float, optional) – The numerical tolerance for Lambert’s solver.

  • max_processes (Optional[int], optional) – The maximum number of processes to use.

  • max_processes – The maximum number of processes to use.

Returns:

porkchop_data – The porkchop data.

Return type:

LambertOutput

adam_core.missions.porkchop.plot_porkchop_plotly(porkchop_data: LambertSolutions, width: int = 900, height: int = 700, c3_departure_min: float | None = None, c3_departure_max: float | None = None, vinf_arrival_min: float | None = None, vinf_arrival_max: float | None = None, tof_min: float | None = None, tof_max: float | None = None, c3_base_colorscale: str = 'Reds', vinf_base_colorscale: str = 'Blues', tof_line_color: str = 'black', xlim_mjd: Tuple[float, float] | None = None, ylim_mjd: Tuple[float, float] | None = None, title: str = 'Porkchop Plot', show_optimal: bool = True, show_hover: bool = False, logo: bool = True)[source]

Plot the porkchop plot from Lambert trajectory data using Plotly.

Parameters:
  • porkchop_data (LambertOutput) – The porkchop data.

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

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

  • c3_departure_min (float, optional) – The minimum C3 departure value.

  • c3_departure_max (float, optional) – The maximum C3 departure value.

  • vinf_arrival_min (float, optional) – The minimum V∞ arrival value.

  • vinf_arrival_max (float, optional) – The maximum V∞ arrival value.

  • tof_min (float, optional) – The minimum time of flight value.

  • tof_max (float, optional) – The maximum time of flight value.

  • c3_base_colorscale (str, optional) – The base colorscale for C3.

  • vinf_base_colorscale (str, optional) – The base colorscale for V∞.

  • tof_line_color (str, optional) – The color of the time of flight line.

  • xlim_mjd (tuple, optional) – The x-axis limits in MJD.

  • ylim_mjd (tuple, optional) – The y-axis limits in MJD.

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

  • show_optimal (bool, optional) – Whether to show the optimal V∞ point.

  • show_hover (bool, optional) – Whether to show the hover information.

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

Returns:

fig – The Plotly figure object.

Return type:

plotly.graph_objects.Figure