Skip to content

Commit

Permalink
Avoid unwanted plots in jupyter notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
nicocardiel committed Nov 13, 2018
1 parent 9e921ca commit 455fb93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions megaradrp/recipes/calibration/arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def calibrate_wl(self, rss, lines_catalog, poldeg, tracemap, nlines,

# save PDF file with plots in working directory
if self.intermediate_results:
from numina.array.display.matplotlib_qt import plt
from matplotlib.backends.backend_pdf import PdfPages
pdf = PdfPages('wavecal_iter1.pdf')
for dumplot in zip([plot_npeaksfound, plot_crval1, plot_cdelt1],
Expand All @@ -429,6 +430,7 @@ def calibrate_wl(self, rss, lines_catalog, poldeg, tracemap, nlines,
linestyle='', marker='.', color='C0',
show=False)
pdf.savefig()
plt.close()
for ideg in range(poldeg_initial + 1):
dumplot = [coef[ideg] for coef in plot_coeff]
ax = ximplotxy(plot_tracenumber, dumplot,
Expand All @@ -437,6 +439,7 @@ def calibrate_wl(self, rss, lines_catalog, poldeg, tracemap, nlines,
linestyle='', marker='.', color='C0',
show=False)
pdf.savefig()
plt.close()
pdf.close()

self.logger.info('Generating fwhm_image...')
Expand Down Expand Up @@ -513,6 +516,8 @@ def calibrate_wl(self, rss, lines_catalog, poldeg, tracemap, nlines,
ylogscale=True,
pdf=pdf)
if pdf is not None:
from numina.array.display.matplotlib_qt import plt
plt.close()
pdf.close()
if poly_refined != numpy.polynomial.Polynomial([0.0]):
npoints_eff = yres_summary['npoints']
Expand Down

0 comments on commit 455fb93

Please sign in to comment.