Skip to content

Latest commit

 

History

History
322 lines (285 loc) · 14.4 KB

File metadata and controls

322 lines (285 loc) · 14.4 KB




Module Plotter [source]

This module contains several methods to plot the results of some class

  + a fit by a Fitter.
  + a fit by a Sampler.
  + a fit to a StellarOrbit
  + iteration samples from NestedSampler(s)
  + 3D plot of a stellar orbit
  + Eclipsing stars

The fits are invoked when Fitter.fit() or Sampler.sample() are called with plot=True.

plotFit( x, data=None, yfit=None, model=None, fitter=None, show=True, residuals=False, xlabel=None, ylabel=None, title=None, figsize=[7,5], xlim=None, ylim=None, filename=None, transparent=False ) [source]

Plot the data of a fit.

Parameters

  • x : array_like
         xdata of the problem
  • data : array_like
         ydata of the problem
  • yfit : array_like
         fit of the data to the model
  • model : Model
         the model the data are fitted to at x
  • fitter : BaseFitter
         the fitter being used
         If set it displays a confidence region for the fit
  • show : bool
         display the plot
  • residuals : bool
         plot the residuals in a separate panel
  • xlabel : None or str
         use as xlabel
  • ylabel : None or str
         use as ylabel
  • title : None or str
         use as title
  • xlim : None or list of 2 floats
         limits on x-axis
  • ylim : None or list of 2 floats
         limits on y-axis
  • figsize : list of 2 floats
         size of the figure
  • filename : None or str
         name of png file; otherwise show
  • transparent : bool
         make the png file transparent

plotSampleList( sl, xdata, ydata, problem=None, errors=None, npt=10000, residuals=False, xlabel=None, ylabel=None, title=None, period=None, figsize=[7,5], xlim=None, ylim=None, filename=None, transparent=False, show=True ) [source]
Plot the posterior as npt points from the SampleList.

Parameters

  • sl : SampleList
         the samplelist containing samples from the posterior
  • xdata : arraylike
         the xdata values; plotted for comparison
  • ydata : arraylike
         the ydata values; plotted for comparison
  • problem : Problem
         the problem at hand
  • errors : None of arraylike
         (No) errors on the ydata are displayed
  • npt : int
         number of points from the sample (10000)
  • residuals : bool
         plot the residuals in a lower panel (False)
  • xlabel : None or str
         use as xlabel
  • ylabel : None or str
         use as ylabel
  • title : None or str
         use as title
  • xlim : None or list of 2 floats
         limits on x-axis
  • ylim : None or list of 2 floats
         limits on y-axis
  • period : float or int
         fold over period
         if int the period is taken from sl.parameters[period]
  • figsize : list of 2 floats
         size of the figure
  • filename : None or str
         name of png file; otherwise show
  • transparent : bool
         make the png file transparent
  • show : bool
         show the plot (or not, for testing)

plotWalker( walker, iter, show=False ) [source]
Plot the results for a walker in an iteration plot.

Parameters

  • walker : Walker
         the walker to plot
  • iter : int
         iteration number
  • show : bool
         show the plot (or not, for testing)

plotIter( xdata, ydata, model, param, iter, show=False ) [source]
Plot the data and the fit-results in an iteration plot.

Parameters

  • xdata : array
         x data points
  • ydata : array
         y data points
  • model : Model
         the model
  • param : array
         the parameters
  • iter : int
         iteration number
  • show : bool
         show the plot (or not, for testing)

plotOrbit( som, par, npoint=361, xdata=None, ydata=None, show=True, plot=None, color='k', ls='-', northEast=True ) [source]
Plot the orbit of a StellarOrbitModel in N points, a forward pointing arrow at T = 0, the line to the periastron and an extended line of nodes.

if ydata is present, plot the datapoints. If also xdata is present, plot the connecting lines too.

Parameters

  • som : StellarOrbitModel with spherical=False
         the orbit to plot
  • par : array
         parameter of the model
  • npoint : int
         number of points in the orbit
  • xdata : array
         array of times at which the data are measured
  • ydata : 2d array
         array of [x,y] pairs representing the data
  • show : bool
         show the plot (or not, for testing)
  • plot : None or pyplot
         None make a self standing plot and show it
         pyplot operate within thid plot; do not show
  • color, ls : color and linestyle
         for the plot
  • northEast : bool
         plot North-East pointers

lineOfNodes( x, y, n2n, scale=1.0, indices=False ) [source]
Calculate the line of nodes

Parameters

  • x : array
         x-values along the orbit
  • y : array
         y-values along the orbit
  • n2n : float
         angle from North to Line-of-nodes
  • scale : float (1.0)
         extension beyond the orbit
  • indices : bool
         return indices in (x,y)

Returns

  • ( ndx, ndy ) : tuple to 2 lists
         tuple of x-values and y-values of the nodes

plotOrbit3D( som, par, npoint=361, xdata=None, ydata=None, show=True, plot=None, color='k', ls='-', northEast=True ) [source]
Three dimensional plot of the orbit of a StellarOrbitModel in N points, a forward pointing arrow at T = 0, the line to the periastron and an extended line of nodes.

if ydata is present, plot the datapoints. If also xdata is present, plot the connecting lines too.

Parameters

  • som : StellarOrbitModel with spherical=False
         the orbit to plot
  • par : array
         parameter of the model
  • npoint : int
         number of points in the orbit
  • xdata : array
         array of times at which the data are measured
  • ydata : 2d array
         array of [x,y] pairs representing the data
  • show : bool
         show the plot (or not, for testing)
  • plot : None or pyplot
         None make a self standing plot and show it
         pyplot operate within this plot; do not show
                 needs to have .add_subplot( projection='3d' )
  • color, ls : color and linestyle
         for the plot
  • northEast : bool
         plot North-East pointers

plotEclipsingStar( esm, pars, xdata=None, ydata=None, toMags=False, starpos=None, figsize=[9,6], grid=None, show=True, filename=None ) [source]
plot of eclipsing stars seen from above. The orientation is irrelevant.

Parameters

  • esm : EclipsingStarModel
         containing the stars
  • pars : array
         for esm
  • xdata : None or array
         of (measured) data points.
  • ydata : None or array
         of (measured) data points.
  • toMags : bool or float
         true produce plot in magnitudes (ydata is in mags)
         float true and use number to scale the fluxes
  • starpos : (small) array
         times of star positions to display
  • figsize : list of 2 floats
         size of the plot
  • grid : GridSpec
         GridSpec where to plot the orbit in
  • show : bool
         to show the plot (or not)
  • filename : str
         write to filename

plotEsmSideView( esm, pars, times=None, starpos=None, axin=None, figsize=[9,6], show=False ) [source]
Plot an EclipsingStarModel in sideways view.

Parameters

  • esm : EclipsingStarModel
         containing the stars
  • pars : array
         for esm
  • times : None or array
         to plot
  • starpos : (small) array
         times of star positions to display
  • axin : Axes (None)
         to plot in
  • figsize : list of 2 floats ([9,6])
         size of the plot
  • show : bool (False)
         to show the plot

starColors( L1, L2, L3 ) [source]
Return colors for star 1, star 2 dark side and star 2 spot.

Parameters

  • L1, L2, L3 : floats
         luminosities for star 1, 2 and spot

plotEsmEclipseView( esm, pars, times=None, starpos=None, axin=None, figsize=[9,6], show=False ) [source]
Plot an EclipsingStarModel in eclipsing view.

Parameters

  • esm : EclipsingStarModel
         containing the stars
  • pars : array
         for esm
  • times : None or array
         to plot
  • starpos : (small) array
         times of star positions to display
  • axin : Axes (None)
         to plot in
  • figsize : list of 2 floats ([9,6])
         size of the plot
  • show : bool (False)
         to show the plot