streamobs.plotting module#
Plotting functions.
- streamobs.plotting.draw_stream(phi1, phi2)[source]#
Create 2d histogram and draw stellar distribution.
- Parameters:
phi1 (coordinates of stars (deg))
phi2 (coordinates of stars (deg))
- Returns:
num, xedges, yedges, im
- Return type:
output of imshow
- streamobs.plotting.plot_healpix_counts(ra, dec, nside=64, ax=None, title='', cmap='viridis', nest=False, colorbar_label='Counts / pixel', **kwargs)[source]#
Plot a HEALPix object-count density map from (ra, dec) coordinates.
Bins the supplied coordinates into a HEALPix map and displays it using
skyproj. Empty pixels are set toNaNso they render as white / transparent rather than zero.- Parameters:
ra (array-like) – ICRS sky coordinates in degrees.
dec (array-like) – ICRS sky coordinates in degrees.
nside (int, optional) – HEALPix resolution. Default
64.ax (matplotlib.axes.Axes, optional) – Axes to draw into. A new figure + axes is created when
None.title (str, optional) – Plot title.
cmap (str, optional) – Matplotlib colormap name. Default
'viridis'.nest (bool, optional) – HEALPix pixel ordering —
False(RING) by default.colorbar_label (str, optional) – Label for the colorbar.
**kwargs –
vmin/vmaxare forwarded todraw_hpxmap; everything else is ignored.
- Returns:
sp
- Return type:
skyproj projection object
- streamobs.plotting.plot_inject(data, survey, bands=None, range=None, **kwargs)[source]#
Plot injection results showing observed vs unobserved stars.
Creates three panels: - Left: Injected stars in the survey footprint (using magnitude limit map) - Center: HR diagram using true magnitudes - Right: HR diagram using measured magnitudes with photometric errors
- Parameters:
data (pandas.DataFrame or dict-like) – Data containing the injected stream, with columns namespaced by the survey’s
namespace({name}_{release}, e.g.lsst_yr5). Must have: - ‘ra’, ‘dec’: Sky coordinates in degrees - ‘<namespace>_flag_observed’: Boolean flag for detected stars - ‘<namespace>_<band>_true’: True magnitudes for each band - ‘<namespace>_<band>_obs’: Observed magnitudes for each bandsurvey (Survey) – Survey object; supplies the column namespace and the magnitude-limit maps.
bands (list of str, optional) – Bands to use for HR diagram. Default is [‘g’, ‘r’]. Will use first two bands if more are provided.
**kwargs (dict) – Additional keyword arguments: - save : bool, if True saves the figure - folder : str, path to save folder (default: ../data/outputs/) - survey_name : str, survey name for filename (default: uses survey object)
- Returns:
fig, ax – The matplotlib figure and axes array.
- Return type:
tuple
Examples
>>> fig, ax = plot_inject(observed_data, survey, bands=['g', 'r'], save=True)
- streamobs.plotting.plot_stream(phi1, phi2)[source]#
Plot binned histogram of stream.
- Parameters:
phi1 (coordinates of stars (deg))
phi2 (coordinates of stars (deg))
- Returns:
fig, ax
- Return type:
the figure and axis
- streamobs.plotting.plot_stream_in_mask(ra, dec, mask, nest=False, output_folder=None)[source]#
Plot stream in mask using healpy and skyproj.
- Parameters:
ra (coordinates of stars (deg))
dec (coordinates of stars (deg))
mask (boolean array, True for masked points)
- Returns:
fig, ax
- Return type:
the figure and axis