@@ -288,7 +288,8 @@ def compute_mean_residuals(residual_dict, min_spectra=20):
288
288
return residual_mean
289
289
290
290
291
- def plot_residuals (residual_dict , residual_mean , outdir , ymin = None , ymax = None ):
291
+ def plot_residuals (residual_dict , residual_mean , outdir ,
292
+ ymin = None , ymax = None , runid = None ):
292
293
"""
293
294
Plot residuals.
294
295
@@ -306,6 +307,9 @@ def plot_residuals(residual_dict, residual_mean, outdir, ymin=None, ymax=None):
306
307
ymax : float
307
308
Upper limit of Y axis
308
309
(default: None)
310
+ runid : str
311
+ Run ID, to be shown in title
312
+ (default: None)
309
313
"""
310
314
for spec_mean in residual_mean :
311
315
stat_id = spec_mean .id
@@ -320,7 +324,11 @@ def plot_residuals(residual_dict, residual_mean, outdir, ymin=None, ymax=None):
320
324
True , which = 'both' , linestyle = 'solid' , color = '#DDDDDD' , zorder = 0 )
321
325
ax .set_xlabel ('frequency (Hz)' )
322
326
ax .set_ylabel ('residual amplitude (obs - synth) in magnitude units' )
323
- ax .set_title (f'residuals: { stat_id } – { len (res )} records' )
327
+ if runid :
328
+ title = f'{ stat_id } – run_id: { runid } - { len (res )} records'
329
+ else :
330
+ title = f'{ stat_id } – { len (res )} records'
331
+ ax .set_title (title )
324
332
fig .savefig (figurefile , bbox_inches = 'tight' )
325
333
plt .close (fig )
326
334
print (f'Residual plot saved to: { figurefile } ' )
@@ -356,7 +364,7 @@ def main():
356
364
ymin , ymax = args .yrange
357
365
plot_residuals (
358
366
residual_dict , residual_mean , outdir ,
359
- ymin = ymin , ymax = ymax
367
+ ymin = ymin , ymax = ymax , runid = runid
360
368
)
361
369
362
370
# write the mean residuals (the stations corrections)
0 commit comments