COSMICOutput¶
- class cosmic.output.COSMICOutput(bpp=None, bcm=None, initC=None, kick_info=None, file=None, label=None, file_key_suffix='')[source]¶
Bases:
objectContainer for COSMIC output data components.
Can be initialized either from data components directly or by loading from an HDF5 file.
- Parameters:
- bpppandas.DataFrame, optional
Important evolution timestep table, by default None
- bcmpandas.DataFrame, optional
User-defined timestep table, by default None
- initCpandas.DataFrame, optional
Initial conditions table, by default None
- kick_infopandas.DataFrame, optional
Natal kick information table, by default None
- filestr, optional
Filename/path to HDF5 file to load data from, by default None
- labelstr, optional
Optional label for the output instance, by default None
- file_key_suffixstr, optional
Suffix to append to dataset keys when loading from file, by default ‘’. E.g. if set to ‘_singles’, datasets ‘bpp_singles’, ‘bcm_singles’, etc. will be loaded as bpp, bcm, etc.
- Raises:
- ValueError
If neither file nor all data components are provided.
Attributes Summary
Get the final timestep for each binary from the bpp table.
Methods Summary
plot_detailed_evolution(bin_num[, show])Plot detailed evolution for a specific binary.
plot_distribution(x_col[, y_col, c_col, ...])Plot distribution of binaries in specified columns.
rerun_with_settings(new_settings[, ...])Rerun the simulation with new settings.
save(output_file)Save all data components to an HDF5 file
Attributes Documentation
- final_bpp[source]¶
Get the final timestep for each binary from the bpp table.
- Returns:
- final_bpppandas.DataFrame
DataFrame containing only the final timestep for each binary.
Methods Documentation
- plot_detailed_evolution(bin_num, show=True, **kwargs)[source]¶
Plot detailed evolution for a specific binary.
- Parameters:
- bin_numint
Index of the binary to plot.
- **kwargs
Additional keyword arguments passed to the plotting function (plotting.plot_binary_evol).
- plot_distribution(x_col, y_col=None, c_col=None, when='final', fig=None, ax=None, show=True, xlabel='auto', ylabel='auto', clabel='auto', **kwargs)[source]¶
Plot distribution of binaries in specified columns.
Plots can be histograms (if only x_col is given) or scatter plots (if both x_col and y_col are given). Optionally, colour coding can be applied using c_col.
- Parameters:
- x_colstr
Column name for x-axis.
- y_colstr, optional
Column name for y-axis. If None, a histogram will be plotted. By default None.
- c_colstr, optional
Column name for colour coding. By default None.
- whenstr, optional
When to take the values from: ‘initial’ or ‘final’. By default ‘final’.
- figmatplotlib.figure.Figure, optional
Figure to plot on. If None, a new figure is created. By default None.
- axmatplotlib.axes.Axes, optional
Axes to plot on. If None, new axes are created. By default None.
- showbool, optional
If True, display the plot immediately. By default True.
- xlabelstr, optional
Label for x-axis. If ‘auto’, uses the column name. By default ‘auto’.
- ylabelstr, optional
Label for y-axis. If ‘auto’, uses the column name or ‘Count’ for histogram. By default ‘auto’.
- clabelstr, optional
Label for colorbar. If ‘auto’, uses the column name. By default ‘auto
- **kwargs
Additional keyword arguments passed to the plotting function.
- Returns:
- figmatplotlib.figure.Figure
The figure containing the plot.
- axmatplotlib.axes.Axes
The axes containing the plot.
- rerun_with_settings(new_settings, reset_kicks=False, inplace=False)[source]¶
Rerun the simulation with new settings.
- Parameters:
- new_settingsdict
Dictionary of new settings to apply. Any setting not included will retain its original value.
- reset_kicksbool, optional
If True, reset natal kicks to be randomly sampled again. If False, retain original kicks. By default False. (You may want to reset the kicks if changing settings that affect remnant masses or kick distribution.)
- inplacebool, optional
If True, update the current instance. If False, return a new instance. By default False.
- Returns:
- new_outputCOSMICOutput
New COSMICOutput instance with updated simulation results (only if inplace is False).