Plotting

Every result object can draw itself. SimulatedField and PhotometryResult carry .plot_* methods, each taking ax=None and returning the axes it drew on:

field = simulate_field(150.1, 2.2, shape=(1024, 1024), seed=1)
field.plot(catalog=True, satmask=True)      # a new figure in the house style
field.plot_cutout(star=0, half_width=120)   # log stretch around catalog row 0
field.plot_psf_profile()                    # Airy core, scatter halo, render

result = run_photometry(frames, target=source_id)
result.plot()                               # the relative light curve
result.plot_field(frames[0])                # the apertures on the first frame

Pass an axes to draw into a figure of your own; the returned axes can then be titled or re-limited like any other:

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
field.plot(ax=ax1, which="clean")
field.plot_satmask(ax=ax2)
ax1.set_title("noiseless expectation")

What is available

Object

Method

Shows

SimulatedField

plot(which="adu", catalog=False, satmask=False)

The image ("adu", "e" or "clean") on an asinh stretch; full frames are block-max reduced for display with the axes kept in native pixels.

plot_cutout(star=0, half_width=300, which="clean")

A log-stretched cutout around one catalog row, floor at the sky level.

plot_psf_profile(star=0)

The radial profile split into Airy core, scattered-light halo and total, against the rendered image (see Scattered light).

plot_satmask()

The saturation mask.

psf_report(path)

The one-page PSF report as PDF and PNG (wcc_sim.psfreport.make_psf_report()).

PhotometryResult

plot() / plot_lightcurve(**errorbar_kw)

The normalised relative light curve; extra keywords go to errorbar so two results can share one axes.

plot_field(frame)

The frame cropped to the selected stars, apertures at the median centroids.

plot_binned_rms(), plot_raw_fluxes(), plot_rms_vs_mag()

The noise diagnostics of the report.

plot_centroids(coord="x"), plot_background()

Centroid drift about each star’s median; annulus background per frame.

report(path, frame=None)

The one-page photometry report as PDF and PNG (wcc_phot.report.make_report()).

The functions behind the methods are public too, and the ones in wcc_sim.plotting take plain arrays, so an image read back from a FITS file can be shown the same way:

from wcc_sim.plotting import plot_image, plot_stamp, plot_radial_profile

plot_image(hdul["SCI"].data, satmask=hdul["SATMASK"].data.astype(bool))
plot_stamp(field.models["stamp"], half_width=40, plate_scale_mas=16.87)
plot_radial_profile(field.image_clean, xc, yc, bg=sky_level, log=True)

radial_profile() and encircled_energy() return the numbers the last two draw.

The house style

Figures the methods create for themselves use the packaged style src/wcc_sim/data/plot_default.mplstyle (STIX serif, inward ticks, a light grid, and the teal/red/amber palette exposed as wcc_sim.plotting.TEAL etc.). An axes you pass in keeps your own rcParams. To apply the style to a whole session:

from wcc_sim.plotting import use_style
use_style()

The report writers (make_psf_report, make_report) draw on a pyplot-free figure under the same style, so they run headless.

The tutorial Plotting: every .plot_* method in one place shows every method once.