From 6a99a0bf10be3e7c9445e86f204ce87f78da78f3 Mon Sep 17 00:00:00 2001 From: "Delorme M Dr (Physics)" <m.delorme@surrey.ac.uk> Date: Fri, 18 Jan 2019 14:03:51 +0000 Subject: [PATCH] Added background plotting --- astro_lab.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/astro_lab.py b/astro_lab.py index 3d2efcd..bd56b25 100644 --- a/astro_lab.py +++ b/astro_lab.py @@ -82,11 +82,14 @@ def plot_data(zscale=True): plt.imshow(data, cmap='Greys_r', vmin=lims[0], vmax=lims[1], origin='lower') plt.show() -def subtract_background(): +def subtract_background(plot=False): global data, error, bg_sub sigma_clip = SigmaClip(sigma=sclip) bkg_estimator = MedianBackground() bkg = Background2D(data, (bg_wsize, bg_wsize), sigma_clip=sigma_clip, bkg_estimator=bkg_estimator) + if plot: + plt.imshow(bkg.background, origin='lower', cmap='Greys_r') + plt.show() error = calc_total_error(data, bkg.background_rms, eff_gain) data = data - bkg.background bg_sub = True -- GitLab