posydon.visualization
posydon.visualization.VHdiagram
posydon.visualization.combine_TF
Module for combining termination flags for visualization purposes.
posydon.visualization.interpolation
Module to evaluate IFInterpolator class
- class posydon.visualization.interpolation.EvaluateIFInterpolator(interpolator, test_grid)[source]
Bases:
object
Class that is helpful for evaluating interpolation performance
Initialize the EvaluateIFInterpolator class
- Parameters:
interpolator (IFInterpolator) – Interpolator that user wants to test
test_grid (PSyGrid) – Grid object containing testing tracks
- confusion_matrix(key, params={}, save_path=None, close_fig=False)[source]
Method that plots confusion matrices to evaluate classification
posydon.visualization.plot1D
Plotting class for 1D (MESA) psygrids.
The 1D visualization plotting class allows to plot 1D tracks of PsyGrid objects. The PsyGrid object is composed of nD MESA grid run with POSYDON and post processed with the psygrid object into an h5 file.
- class posydon.visualization.plot1D.plot1D(run, x_var_str, y_var_str, z_var_str=None, history='binary_history', star_states=None, HR=False, verbose=False, **kwargs)[source]
Bases:
object
Plotting class for 1D (MESA) grids.
Read a PsyGrid object and plot a 1D track of x vs y.
- Parameters:
run (int or list of int) – Index or list of indeces of the PsyGrid object you would like to plot.
x_var_str (str) – String of values to plot on the x axis. Allowed strings are the one in psygrid.history.dtype.names where “history” needs to be chosen accordingly.
y_var_str (str or list of str) – String or list of stringvalues to plot on the y axis. Allowed strings are the one in psygrid.history.dtype.names where “history” needs to be chosen accordingly.
z_var_str (str) – String of values to plot on the z axis (displayed with a color). Allowed strings are the one in psygrid.history.dtype.names where “history” needs to be chosen accordingly.
history (str) – The x, y, z variables are read from either: “binary_history”, “history1”, “history2”.
HR (bool) – If True, an HR diagram will be plotted.
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.
posydon.visualization.plot2D
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, max_cols=3, legend_pos=(3, 3), 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 or a list of tuples) – Range between which you want to slice the variable slice_3D_var_str e.g., (2.5,3.). In case of a list of tuples, one will get a large plot with one subplot for each tuple in the list.
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 or a list of tuples) – Range between which you want to slice the variable slice_4D_var_str e.g., (2.5,3.). In case of a list of tuples, one will get a large plot with one subplot for each tuple in the list.
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).
max_cols (int) – Defines the maximum number of columns of subplots. Default: 3
legend_pos (SubplotSpec (int or tuple)) – Defines which subplots won’t contain an axis but are used to display the legend there. Default: (3, 3)
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.
- plot_panels(axs, l_ax=None, legend_idxs=[2])[source]
Plot the 2D panels.
- Parameters:
axs (array of axes) – matplotlib figure axes. Its dimensions should be stored in self.n_cols and self.n_rows.
legend_idxs (list of indices) – Tells where to place the legend instead of a plot.
- 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.
posydon.visualization.plot_defaults
Default values for plotting routines.
This file contains the default parameters of each plotting routines. PLOT_PROPERTIES:
Each default plotting variable is contained in this dictionary.
- DEFAULT_MARKERS_COLORS_LEGENDS:
Each termination condition is associated with a marker shape, size, color and label.
posydon.visualization.plot_pop
- posydon.visualization.plot_pop.plot_grb_rate_density(z, rate_density, zmax=10., channels=False, grb_components=False, Perley16=False, **kwargs)[source]
- posydon.visualization.plot_pop.plot_hist_properties(df, ax=None, df_intrinsic=None, df_observable=None, channel=None, show=True, path=None, alpha=0.5, range=None, bins=20, normalise=False, color=COLORS[0], label='', **kwargs)[source]
- posydon.visualization.plot_pop.plot_merger_efficiency(met, merger_efficiency, show=True, path=None, channels=False)[source]
- posydon.visualization.plot_pop.plot_merger_rate_density(z, rate_density, zmax=10., channels=False, GWTC3=False, label='DCO', **kwargs)[source]