Results¶
-
class
orbitize.results.
Results
(sampler_name=None, post=None, lnlike=None, tau_ref_epoch=None, labels=None, num_secondary_bodies=None)[source]¶ A class to store accepted orbital configurations from the sampler
- Parameters
sampler_name (string) – name of sampler class that generated these results (default: None).
post (np.array of float) – MxN array of orbital parameters (posterior output from orbit-fitting process), where M is the number of orbits generated, and N is the number of varying orbital parameters in the fit (default: None).
lnlike (np.array of float) – M array of log-likelihoods corresponding to the orbits described in
post
(default: None).tau_ref_epoch (float) – date (in days, typically MJD) that tau is defined relative to
labels (list of str) – parameter labels in same order as post
num_secondary_bodies (int) – number of companions fit
The
post
array is in the following order:semimajor axis 1, eccentricity 1, inclination 1, argument of periastron 1, position angle of nodes 1, epoch of periastron passage 1, [semimajor axis 2, eccentricity 2, etc.], [parallax, masses (see docstring for orbitize.system.System)]
where 1 corresponds to the first orbiting object, 2 corresponds to the second, etc.
Written: Henry Ngo, Sarah Blunt, 2018
-
add_samples
(orbital_params, lnlikes, labels)[source]¶ Add accepted orbits and their likelihoods to the results
- Parameters
orbital_params (np.array) – add sets of orbital params (could be multiple) to results
lnlike (np.array) – add corresponding lnlike values to results
labels (list of str) – list of parameter labels specifying the order in
orbital_params
Written: Henry Ngo, 2018
-
load_results
(filename, append=False)[source]¶ Populate the
results.Results
object with data from a datafile- Parameters
filename (string) – filepath where data is saved
append (boolean) – if True, then new data is added to existing object. If False (default), new data overwrites existing object
See the
save_results()
method in this module for information on how the data is structured.Written: Henry Ngo, 2018
-
plot_corner
(param_list=None, **corner_kwargs)[source]¶ Make a corner plot of posterior on orbit fit from any sampler
- Parameters
param_list (list of strings) –
each entry is a name of a parameter to include. Valid strings:
sma1: semimajor axis ecc1: eccentricity inc1: inclination aop1: argument of periastron pan1: position angle of nodes tau1: epoch of periastron passage, expressed as fraction of orbital period [repeat for 2, 3, 4, etc if multiple objects] plx: parallax gamma: rv offset sigma: rv jitter mi: mass of individual body i, for i = 0, 1, 2, ... (only if fit_secondary_mass == True) mtot: total mass (only if fit_secondary_mass == False)
**corner_kwargs – any remaining keyword args are sent to
corner.corner
. See here. Note: default axis labels used unless overwritten by user input.
- Returns
corner plot
- Return type
matplotlib.pyplot.Figure
Note
Example: Use
param_list = ['sma1,ecc1,inc1,sma2,ecc2,inc2']
to only plot posteriors for semimajor axis, eccentricity and inclination of the first two companionsWritten: Henry Ngo, 2018
-
plot_orbits
(object_to_plot=1, start_mjd=51544.0, num_orbits_to_plot=100, num_epochs_to_plot=100, square_plot=True, show_colorbar=True, cmap=<matplotlib.colors.LinearSegmentedColormap object>, sep_pa_color='lightgrey', sep_pa_end_year=2025.0, cbar_param='epochs', mod180=False, rv_time_series=False)[source]¶ Plots one orbital period for a select number of fitted orbits for a given object, with line segments colored according to time
- Parameters
object_to_plot (int) – which object to plot (default: 1)
start_mjd (float) – MJD in which to start plotting orbits (default: 51544, the year 2000)
num_orbits_to_plot (int) – number of orbits to plot (default: 100)
num_epochs_to_plot (int) – number of points to plot per orbit (default: 100)
square_plot (Boolean) – Aspect ratio is always equal, but if square_plot is True (default), then the axes will be square, otherwise, white space padding is used
show_colorbar (Boolean) – Displays colorbar to the right of the plot [True]
cmap (matplotlib.cm.ColorMap) – color map to use for making orbit tracks (default: modified Purples_r)
sep_pa_color (string) – any valid matplotlib color string, used to set the color of the orbit tracks in the Sep/PA panels (default: ‘lightgrey’).
sep_pa_end_year (float) – decimal year specifying when to stop plotting orbit tracks in the Sep/PA panels (default: 2025.0).
cbar_param (string) – options are the following: epochs, sma1, ecc1, inc1, aop1, pan1, tau1. Number can be switched out. Default is epochs.
mod180 (Bool) – if True, PA will be plotted in range [180, 540]. Useful for plotting short arcs with PAs that cross 360 deg during observations (default: False)
rv_time_series (Boolean) – if fitting for secondary mass using MCMC for rv fitting and want to display time series, set to True.
- Returns
the orbit plot if input is valid,
None
otherwise- Return type
matplotlib.pyplot.Figure
(written): Henry Ngo, Sarah Blunt, 2018 Additions by Malena Rice, 2019
-
save_results
(filename)[source]¶ Save results.Results object to an hdf5 file
- Parameters
filename (string) – filepath to save to
Save attributes from the
results.Results
object.sampler_name
,tau_ref_epcoh
are attributes of the root group.post
,lnlike
, andparameter_labels
are datasets that are members of the root group.Written: Henry Ngo, 2018