opticam.plotting.plots

Functions

plot_catalogs(out_directory, stacked_images, catalogs, ...)

Plot the source catalogs.

plot_time_between_files(out_directory, camera_files, ...)

Plot the times between files. Useful for identifying gaps.

plot_backgrounds(out_directory, t_ref, show, save)

Plot the time-varying background for each camera.

plot_background_meshes(out_directory, images, ...)

Plot the background mesh on top a series of images.

plot_growth_curves(image, cat, targets, psf_params)

Plot the growth curves given a (stacked) image and corresponding source catalog.

plot_psf(catalog, source_indx, stacked_image, key, a, ...)

Plot the PSF for given source.

plot_rms_vs_median_flux(lc_dir, save_dir, phot_label)

Plot the RMS as a function of the median flux for all catalog sources.

get_lc_rms_and_flux_dict(lc_dir)

Get the RMS and median flux for a series of light curves.

plot_snrs(out_directory, files, background, ...)

Plot the S/N for each source.

plot_noise(out_directory, files, background, ...)

Plot the various noise contributions and compare them to the measured noise for a series of images.

plot_apertures(out_directory, data, cat, targets, ...)

Plot the specified aperture over each target source.

get_max_region_size(targets, photometer, data, cat, ...)

Get the maximum region size for plotting apertures.

plot_light_curves(keys, light_curves, t_ref[, y_label])

Plot a table of light curves using a dedicated subplot for each filter.

Module Contents

opticam.plotting.plots.plot_catalogs(out_directory, stacked_images, catalogs, show, save)

Plot the source catalogs.

Parameters

out_directoryPath

The path to the directory in which the resulting plot will be saved.

stacked_imagesdict[str, NDArray]

The stacked images for each filter {filter: image}.

catalogsdict[str, QTable]

The source catalogs for each filter {filter: catalog}.

showbool

Whether to show the plot.

savebool

Whether to save the plot.

Parameters:
  • out_directory (pathlib.Path)

  • stacked_images (dict[str, numpy.typing.NDArray])

  • catalogs (dict[str, astropy.table.QTable])

  • show (bool)

  • save (bool)

Return type:

None

opticam.plotting.plots.plot_time_between_files(out_directory, camera_files, bmjds, show, save)

Plot the times between files. Useful for identifying gaps.

Parameters

out_directoryPath

The directory path to which the resulting plot will be saved.

camera_filesdict[str, list[MEFSlice]]

The files separated by camera.

bmjdsdict[str, float]

The file time stamps {file path + extension: time stamp}.

showbool

Whether to show the plot.

savebool

Whether to save the plot.

Parameters:
  • out_directory (pathlib.Path)

  • camera_files (dict[str, list[opticam.mef_slice.MEFSlice]])

  • bmjds (dict[str, float])

  • show (bool)

  • save (bool)

Return type:

None

opticam.plotting.plots.plot_backgrounds(out_directory, t_ref, show, save)

Plot the time-varying background for each camera.

Parameters

out_directoryPath

The directory to which the background files, and where the resulting plot will be saved if save=True.

t_reffloat

The reference BMJD.

show: bool

Whether to display the plot.

savebool

Whether to save the plot.

Parameters:
  • out_directory (pathlib.Path)

  • t_ref (float)

  • show (bool)

  • save (bool)

Return type:

None

opticam.plotting.plots.plot_background_meshes(out_directory, images, background, show, save)

Plot the background mesh on top a series of images.

Parameters

out_directoryPath

The path to the output directory.

imagesdict[str, NDArray[np.float64]]

The images {string: image}

background: BaseBackground

The background estimator.

showbool

Whether to show the plot.

savebool

Whether to save the plot.

Parameters:
Return type:

None

opticam.plotting.plots.plot_growth_curves(image, cat, targets, psf_params)

Plot the growth curves given a (stacked) image and corresponding source catalog.

Parameters

imageNDArray

The image.

catQTable

The catalog corresponding to image.

targetsint | list[int]

The target(s) for which growth curves are to be computed.

psf_paramsdict

The PSF parameters.

Returns

Figure

The growth curve plots.

Parameters:
  • image (numpy.typing.NDArray)

  • cat (astropy.table.QTable)

  • targets (int | list[int])

  • psf_params (dict)

Return type:

matplotlib.figure.Figure

opticam.plotting.plots.plot_psf(catalog, source_indx, stacked_image, key, a, b, out_directory)

Plot the PSF for given source.

Parameters

catalogQTable

The source catalog.

source_indxint

The index of the source in the catalog.

stacked_imageNDArray

The catalog image.

keystr

The camera:filter key.

afloat

The semimajor standard deviation of the PSF.

bfloat

The semiminor standard deviation of the PSF.

out_directoryPath,

The save path.

Parameters:
  • catalog (astropy.table.QTable)

  • source_indx (int)

  • stacked_image (numpy.typing.NDArray)

  • key (str)

  • a (float)

  • b (float)

  • out_directory (pathlib.Path)

Return type:

None

opticam.plotting.plots.plot_rms_vs_median_flux(lc_dir, save_dir, phot_label, show=True)

Plot the RMS as a function of the median flux for all catalog sources.

Parameters

lc_dirPath

The light curve directory path.

save_dirPath

The output directory path.

phot_labelstr

The photometry label.

showbool, optional

Whether to show the plot, by default True.

Parameters:
  • lc_dir (pathlib.Path)

  • save_dir (pathlib.Path)

  • phot_label (str)

  • show (bool)

Return type:

None

opticam.plotting.plots.get_lc_rms_and_flux_dict(lc_dir)

Get the RMS and median flux for a series of light curves.

Parameters

lc_dirPath

The directory path to the light curves.

Returns

dict[str, dict[str, dict[str, float]]]

The median and RMS flux values for each light curve grouped by filter.

Parameters:

lc_dir (pathlib.Path)

Return type:

dict[str, dict[str, dict[str, float]]]

opticam.plotting.plots.plot_snrs(out_directory, files, background, psf_params, catalogs, instrument, bias_corrector, dark_corrector, flat_corrector, show, save)

Plot the S/N for each source.

Parameters

out_directoryPath

The output directory.

filesdict[str, MEFSlice]

The reference file for each filter.

backgroundBaseBackground | Callable

The global background estimator.

psf_paramsdict[str, dict[str, float]]

The PSF parameters for each filter {filter: psf parameters}.

catalogsdict[str, QTable]

The catalogs for each filter {filter: catalog}.

instrumentInstrument

The instrument that produced the data.

bias_correctorBiasCorrector | None

The bias corrector.

dark_correctorDarkNoiseCorrector | None

The dark noise corrector.

flat_correctorFlatFieldCorrector | None

The flat-field corrector.

showbool

Whether to show the plot.

savebool

Whether to save the plot.

Parameters:
opticam.plotting.plots.plot_noise(out_directory, files, background, psf_params, catalogs, instrument, bias_corrector, dark_corrector, flat_corrector, show, save)

Plot the various noise contributions and compare them to the measured noise for a series of images.

Parameters

out_directoryPath

The output directory.

filesdict[str, MEFSlice]

The reference files for each filter.

backgroundBaseBackground | Callable

The global background estimator.

psf_paramsdict[str, dict[str, float]]

The PSF parameters for each filter {filter: psf parameters}.

catalogsdict[str, QTable]

The catalogs for each filter {filter: catalog}.

instrumentInstrument

The instrument that produced the data.

bias_correctorBiasCorrector | None

The bias corrector.

dark_correctorDarkNoiseCorrector

The dark noise corrector.

flat_correctorFlatFieldCorrector | None

The flat-field corrector.

showbool

Whether to show the plot.

savebool

Whether to save the plot.

Parameters:
opticam.plotting.plots.plot_apertures(out_directory, data, cat, targets, photometer, psf_params, key, show, save)

Plot the specified aperture over each target source.

Parameters

out_directoryPath

The output directory. Used to save the plot if save=True.

dataNDArray

The image data.

catQTable

The source catalog.

targetslist[int] | int

The target IDs to plot apertures for.

photometerAperturePhotometer

The AperturePhotometer instance.

psf_paramsdict[str, float]

The PSF parameters.

keystr

The camera:filter key.

showbool

Whether to show the plot.

savebool

Whether to save the plot. If true, the plot is saved to out_directory/diag/apertures/fltr_apertures.pdf.

Parameters:
  • out_directory (pathlib.Path)

  • data (numpy.typing.NDArray)

  • cat (astropy.table.QTable)

  • targets (list[int] | int)

  • photometer (opticam.photometers.AperturePhotometer)

  • psf_params (dict[str, float])

  • key (str)

  • show (bool)

  • save (bool)

opticam.plotting.plots.get_max_region_size(targets, photometer, data, cat, psf_params)

Get the maximum region size for plotting apertures.

Parameters

targetslist[int]

The target source IDs.

photometerAperturePhotometer

The AperturePhotometer instance.

dataNDArray[np.float64]

The image data.

catQTable

The source catalog.

psf_paramsdict[str, float]

The PSF parameters.

Returns

int

The maximum region size.

Parameters:
Return type:

int

opticam.plotting.plots.plot_light_curves(keys, light_curves, t_ref, y_label=None)

Plot a table of light curves using a dedicated subplot for each filter.

Parameters

keyslist[str]

The light curve camera:filter keys.

light_curvesTimeSeries

The light curves.

t_refQuantity

The reference time. Light curves are plotted in seconds from this reference time.

y_labelAny, optional

The y-axis label, by default None.

Returns

Figure

The resulting figure.

Parameters:
  • keys (list[str])

  • light_curves (astropy.timeseries.TimeSeries)

  • t_ref (astropy.units.Quantity | None)

  • y_label (Any)

Return type:

matplotlib.figure.Figure