odisseo.visualization module#

odisseo.visualization.build_core_stars(scale_factor)[source]#

Return lists of point coordinates for galactic core stars.

odisseo.visualization.build_spiral_arms(b, arms_info)[source]#

Return lists of point coordinates for galactic spiral arms.

b = constant for spiral direction and “openness” arms_info = list of scale, rotation, and fuzz factors

odisseo.visualization.build_spiral_stars(b, r, rot_fac, fuz_fac)[source]#

Return list of (x,y,z) points for a logarithmic spiral.

b = constant for spiral direction and “openness” r = scale factor (galactic disc radius) rot_fac = factor to rotate each spiral arm fuz_fac = randomly shift star position; applied to ‘fuzz’ variable

odisseo.visualization.create_3d_gif(snapshots, ax_lim, code_units, plotting_units_length, plot_units_time, filename=None)[source]#

Create a 3D GIF animation from a series of snapshots.

Parameters:
  • snapshots (object) – An object containing the states and times of the snapshots to be animated.

  • ax_lim (float) – The axis limit for the 3D plot.

  • code_units (object) – An object containing the code units for length and time.

  • plotting_units_length (astropy.units.Unit) – The units for plotting the length.

  • plot_units_time (astropy.units.Unit) – The units for plotting the time.

  • filename (str, optional) – The filename to save the GIF. If None, the GIF will not be saved.

Returns:

None

odisseo.visualization.create_3d_gif_velocitycoding(snapshots, ax_lim, code_units, plotting_units_length, plot_units_time, vmin=None, vmax=None, filename=None)[source]#
odisseo.visualization.create_projection_gif(snapshots, ax_lim, code_units, plotting_units_length, plot_units_time, filename=None)[source]#

Create a GIF animation of 3D projections from simulation snapshots. This function generates a GIF animation showing the evolution of 3D projections of simulation data over time. The projections are displayed in three subplots: X-Y, X-Z, and Y-Z planes.

Parameters:
  • snapshots (object) – An object containing the simulation snapshots. It should have attributes states and times, where states is a 4D array with shape (num_frames, num_particles, 1, 3) representing the positions of particles in each frame, and times is a 1D array representing the time of each frame.

  • ax_lim (float) – The axis limit for the plots, in code units.

  • code_units (object) – An object containing the code units for length and time. It should have

  • code_time. (attributes code_length and)

  • plotting_units_length (astropy.units.Unit) – The units for plotting the lengths.

  • plot_units_time (astropy.units.Unit) – The units for plotting the time.

  • filename (str, optional) – The filename to save the GIF animation. If None, the animation is not saved.

Returns:

None

odisseo.visualization.energy_angular_momentum_plot(snapshots, code_units, filename=None)[source]#

Plots the relative change in total energy and angular momentum of the system over time.

Parameters:
  • snapshots (odisseo.Snapshots) – Snapshots object containing the simulation data.

  • code_units (odisseo.CodeUnits) – CodeUnits object containing the units of the simulation.

  • filename (str, optional) – The filename to save the plot to. If None, the plot will be displayed but not saved.

Returns:

None

odisseo.visualization.haze(scale_factor, r_mult, z_mult, density)[source]#

Generate uniform random (x,y,z) points within a disc for 2-D display.

scale_factor = galactic disc radius r_mult = scalar for radius of disc z_mult = scalar for z values density = multiplier to vary the number of stars posted

odisseo.visualization.plot_last_snapshot(snapshots, code_units, rp, plotting_units_length, filename=None)[source]#

Plots the last snapshot of the particles in 3D space.

Parameters:
  • snapshots (object) – An object containing the states of the particles at different time steps.

  • code_units (object) – An object containing the code units for length conversion.

  • plotting_units_length (object) – The units to which the lengths should be converted for plotting.

  • filename (str, optional) – The filename to save the plot. If None, the plot is not saved (default is None).

Returns:

None

odisseo.visualization.plot_orbit(snapshots, ax_lim, code_units, plotting_units_length, config, filename=None)[source]#

Plots the orbit of particles in 3D space.

Parameters:
  • snapshots (object) – An object containing the states of the particles at different time steps.

  • ax_lim (float) – The limit for the axes in code units.

  • code_units (object) – An object containing the code units for length conversion.

  • plotting_units_length (object) – The units to which the lengths should be converted for plotting.

  • config (object) – Configuration object containing the number of particles (N_particles).

  • filename (str, optional) – The filename to save the plot. If None, the plot is not saved (default is None).

Raises:

AssertionError – If the number of particles in config.N_particles is 10 or more.

Returns:

None

odisseo.visualization.plot_sky_projection(snapshots, code_units, plotting_units_length, filename=None)[source]#

Plots the sky projection of the particles in the simulation.

Parameters:
  • snapshots (odisseo.Snapshots) – Snapshots object containing the simulation data.

  • code_units (odisseo.CodeUnits) – CodeUnits object containing the units of the simulation.

  • plotting_units_length (astropy.units.Quantity) – The unit to which the lengths should be converted for plotting.

  • filename (str, optional) – The filename to save the plot to. If None, the plot will be displayed but not saved.

Returns:

None

odisseo.visualization.random() x in the interval [0, 1).#
odisseo.visualization.spherical_coords(num_pts, radius)[source]#

Return list of uniformly distributed points in a sphere.