From 0400606b55dc248bd5366734bad68201ccf42599 Mon Sep 17 00:00:00 2001 From: Sergio Pascual Date: Thu, 21 Feb 2019 13:11:58 +0100 Subject: [PATCH] Filenames with fibers have format 03d (fixes #233) --- megaradrp/recipes/calibration/modelmap.py | 8 ++++---- megaradrp/recipes/calibration/trace.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/megaradrp/recipes/calibration/modelmap.py b/megaradrp/recipes/calibration/modelmap.py index 2493e341..672598f9 100644 --- a/megaradrp/recipes/calibration/modelmap.py +++ b/megaradrp/recipes/calibration/modelmap.py @@ -197,15 +197,15 @@ def run(self, rinput): if self.intermediate_results: if dolog: self.logger.debug('saving plots') - plt.title('std %s' % fibid) + plt.title('std fib{:03d}'.format(fibid)) plt.plot(g_col, g_std, 'b*') plt.plot(g_col, interpol_std(g_col), 'r') - plt.savefig('fib_{}_std.png'.format(fibid)) + plt.savefig('fib_{:03d}_std.png'.format(fibid)) plt.close() - plt.title('mean %s' % fibid) + plt.title('mean fin{:03d}'.format(fibid)) plt.plot(g_col, g_mean, 'b*') plt.plot(g_col, interpol_mean(g_col), 'r') - plt.savefig('fib_{}_mean.png'.format(fibid)) + plt.savefig('fib_{:03d}_mean.png'.format(fibid)) plt.close() if dolog: self.logger.debug('saving plots end') diff --git a/megaradrp/recipes/calibration/trace.py b/megaradrp/recipes/calibration/trace.py index 844c5593..acb164cc 100644 --- a/megaradrp/recipes/calibration/trace.py +++ b/megaradrp/recipes/calibration/trace.py @@ -353,10 +353,10 @@ def search_traces(self, reduced, boxes, box_borders, cstart=2000, if debug_plot: plt.plot(mm[:, 0], mm[:, 1], '.') - plt.savefig('trace-xy-%d.png' % dtrace.fibid) + plt.savefig('trace-xy-{:03d}.png'.format(dtrace.fibid)) plt.close() plt.plot(mm[:, 0], mm[:, 2], '.') - plt.savefig('trace-xz-%d.png' % dtrace.fibid) + plt.savefig('trace-xz-{:03d}.png'.format(dtrace.fibid)) plt.close() if len(mm) < poldeg + 1: self.logger.warning('in fibid %d, only %d points to fit pol of degree %d', @@ -483,7 +483,7 @@ def init_traces(image, center, hs, boxes, box_borders, tol=1.5, threshold=0.37, if debug_plot: plt.plot(region) plt.plot(ipeaks_int, region[ipeaks_int], 'r*') - plt.savefig('central_cut_%d.png' % boxid) + plt.savefig('central_cut_{:02d}.png'.format(boxid)) plt.close() startid = lastid + 1