Plotting class for 2D (MESA) psygrids.
The 2D visualization plotting class allows to plot 2D slices of PsyGrid objects. The PsyGrid object is composed of 2D/3D/4D MESA grid run with POSYDON and post processed with the psygrid object into an h5 file.
- class posydon.visualization.plot2D.plot2D(psygrid, x_var_str, y_var_str, z_var_str=None, selected_star_history_for_z_var=1, termination_flag='termination_flag_1', grid_3D=False, slice_3D_var_str=None, slice_3D_var_range=None, grid_4D=False, slice_4D_var_str=None, slice_4D_var_range=None, extra_grid=None, slice_at_RLO=False, MARKERS_COLORS_LEGENDS=None, verbose=False, **kwargs)[source]
Bases:
object
Plotting class for 2D (MESA) grids.
Read a PsyGrid object and plot a 2D slice of x vs y.
- Parameters
psygrid (object) – PsyGrid object containing a 2D/3D/4D MESA grid.
x_var_str (str) – String of the initial value to plot on the x axis. Allowed strings are psygrid.initial_values.dtype.names.
y_var_str (str) – String of the initial value to plot on the y axis. Allowed strings are psygrid.initial_values.dtype.names.
z_var_str (str) – String of the initial value to plot on the z axis (displayed as a color). Allowed strings are psygrid.final_values.dtype.names, psygrid.history1.dtype.names or psygrid.history2.dtype.names depending on “selected_star_history_for_z_var” value, and psygrid.binary_history.dtype.names.
selected_star_history_for_z_var (int) – Accepted valuess: 1 or 2. In case z_var_str is an attribute of history1 or history2, then selected_star_history_for_z_var determines which of the two to select.
termination_flag (str) – Termination flag to display, allowed values are: “termination_flag_1”, “termination_flag_2”, “termination_flag_3”, “termination_flag_4”, “all”.
grid_3D (bool) – If True, the psygrid object is a 3D grid and needs to be sliced.
slice_3D_var_str (str) – Variable along which the 3D space will be sliced. Allowed values are psygrid.initial_values.dtype.names.
slice_3D_var_range (tuple) – Range between which you want to slice the variable slice_3D_var_str e.g., (2.5,3.).
grid_4D (bool) – If True, the psygrid object is a 4D grid and needs to be sliced.
slice_4D_var_str (str) – Variable along which the 4D space will be sliced. Allowed values are psygrid.initial_values.dtype.names.
slice_4D_var_range (tuple) – Range between which you want to slice the variable slice_4D_var_str e.g., (2.5,3.).
extra_grid (object or array of objects) – If subset of the grid was rerun a or an extention was added, one can overlay the new psygrid by passing it here.
slice_at_RLO (bool) – If True, the object plots the tracks until onset of Roche Lobe overflow.
MARKERS_COLORS_LEGENDS (dict) – Each termination flag is associated with a marker shape, size, color and label (cf. MARKERS_COLORS_LEGENDS in plot_defaults.py).
DEFAULT_LABELS (dict) – Each varaible is associated to an axis label. (cf. DEFAULT_LABELS in plot_defaults.py).
verbose (bool) – If True, the object reports by printing to standard output.
**kwargs (dict) – Dictionary containing extra visualisation options (cf. PLOT_PROPERTIES in plot_defaults.py.
- set_color_bar(scatter)[source]
Add colorbar.
- Parameters
scatters (object) – matplotlib scatter object.
- update_markers_colors_legends(termination_flag, MARKERS_COLORS_LEGENDS=None)[source]
Udpdate markers, colors and legend.
- Parameters
termination_flag (string) – Termination flag to display, allowed values are: “termination_flag_1”, “termination_flag_2”, “termination_flag_3”, “termination_flag_4”.
MARKERS_COLORS_LEGENDS (dict) – Each termination flag is associated with a marker shape, size, color and label.