gcfit.analysis.SampledVisualizer#

class gcfit.analysis.SampledVisualizer(sampledmodel, thin=1)#

Some visualizations of a sampled model.

Provides a few simple plotting methods useful for visualizing a sampled (multimass) model. This basic class provides only a few rudimentary plotting functions designed to allow for a quick examination of a sampled model.

Parameters:
sampledmodelgcfit.SampledModel

Sampled model instance to be plotted.

thinint, optional

Optional thinning parameter which will reduce the amount of stars plotted by [::thin] each time. Can be useful at plotting models with very high N.

Methods

__init__(sampledmodel[, thin])

plot_positions([fig, ax, type_, galactic, ...])

Plot the positions of each sampled star.

plot_simulation(phot_system, r_band, g_band, ...)

Plot a simulated (RGB) photometric observation of the model.

plot_velocities([fig, ax, type_, galactic, ...])

Plot the velocities of each sampled star.

plot_positions(fig=None, ax=None, type_='all', galactic=False, projection=None, **kwargs)#

Plot the positions of each sampled star.

Creates a scatter plot of the positions of all sampled stars in the model (after the self.thin thinning). Optionally show these in the cartesian cluster-centred frame, or in the projected galactic coordinates (if the model has been projected).

Parameters:
figNone or matplotlib.figure.Figure, optional

Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _ClusterVisualizer._setup_artist for more details.

axNone or matplotlib.axes.Axes, optional

An axes instance on which to plot the positions. Should be a part of the given fig.

type_{“all”, “MS”, “WD”, “BH”}, optional

Optionally restrict to plotting only the stars of a given star type. Defaults to all types.

galacticbool, optional

If True, will plot the positions in the galactic frame (e.g. lon, lat, dist). If the sampled model was not projected at initialization, this will raise an error.

projection{None, “3d”, “polar”}

Optionally plot the positions in a 3-dimensional or polar frame. Defaults to simply a 2D cartesian frame. “polar” cannot be combined with the galactic frame.

**kwargsdict

All other arguments are passed to ax.scatter.

Returns:
matplotlib.figure.Figure

The corresponding figure, containing all axes and plot artists.

plot_simulation(phot_system, r_band, g_band, b_band, pixel_scale, FWHM, fig=None, ax=None, *, source_kw=None, ideal_imager=False, exptime=3600, imager_kw=None, psf_kw=None, observe_kw=None, rgb_kw=None, show_kw=None)#

Plot a simulated (RGB) photometric observation of the model.

This method provides a barebones skeleton of the necessary steps required to create and plot a simulated observation (i.e. RGB image) of the sampled cluster, using the artpop package. This method relies on the artpop.Source object created by the SampledModel.to_artpop method.

The source is passed through a PSF, artificial imager, and is observed in the three given “RGB” bands, each of which is combined using the astropy make_lupton_rgb function.

This is a very simple method which follows the bare requirements set out by the artpop tutorial. If finer, more manual control is required, the artpop.Source object from SampledModel.to_artpop should be used directly in creating your own artpop-based imagery.

artpop may require the isochrones for a given photometric system be already present, and may automatically start downloading them.

Parameters:
phot_systemstr

Name of the photometric system to simulate stellar magnitudes within. Must be supported by artpop.

r_band, g_band, b_bandstr

The names of the red, green and blue filters to use. Will be passed to artpop.ArtImager.observe, and must be valid for the given `phot_system.

pixel_scalefloat or u.Quantity

The pixel scale of the mock image. If a float is given, the units will be assumed to be arcsec / pixels.

FWHMfloat or u.Quantity

Full width at half maximum of the psf. If a float is given, the units will be assumed to be arcsec. The units can be angular or in pixels. Passed to artpop.moffat_psf.

figNone or matplotlib.figure.Figure, optional

Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _ClusterVisualizer._setup_artist for more details.

axNone or matplotlib.axes.Axes, optional

An axes instance on which to place the simulated image. Should be a part of the given fig.

source_kwdict, optional

Optional arguments passed to SampledModel.to_artpop.

ideal_imagerbool, optional

Whether to use the imager class artpop.IdealImager or artpop.ArtImager (default).

exptimefloat, optional

Exposure time. If float is given, the units are assumed to be seconds. Passed to artpop.ArtImager.observe.

imager_kw, psf_kw, observe_kw, rgb_kw, show_kwdict, optional

Optional arguments passed to artpop.ArtImager, artpop.moffat_psf, artpop.ArtImager.observe, make_lupton_rgb, and artpop.show_image, respectively.

Returns:
matplotlib.figure.Figure

The corresponding figure, containing all axes and plot artists.

plot_velocities(fig=None, ax=None, type_='all', galactic=False, projection=None, **kwargs)#

Plot the velocities of each sampled star.

Creates a scatter plot of the value of the velocities of all sampled stars in the model (after the self.thin thinning). Optionally show these in the cartesian cluster-centred frame, or in the projected galactic coordinates (if the model has been projected).

Parameters:
figNone or matplotlib.figure.Figure, optional

Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _ClusterVisualizer._setup_artist for more details.

axNone or matplotlib.axes.Axes, optional

An axes instance on which to plot the velocities. Should be a part of the given fig.

type_{“all”, “MS”, “WD”, “BH”}, optional

Optionally restrict to plotting only the stars of a given star type. Defaults to all types.

galacticbool, optional

If True, will plot the velocities in the galactic frame (e.g. pm_l_cosb, pm_b, v_los). If the sampled model was not projected at initialization, this will raise an error.

projection{None, “3d”, “polar”}

Optionally plot the positions in a 3-dimensional or polar frame. Defaults to simply a 2D cartesian frame. “polar” cannot be combined with the galactic frame.

**kwargsdict

All other arguments are passed to ax.scatter.

Returns:
matplotlib.figure.Figure

The corresponding figure, containing all axes and plot artists.