@@ -447,16 +447,19 @@ def make_images(self, evt=None):
447
447
clobber = 'yes' ,
448
448
logging_tag = str (self )
449
449
)
450
- self .ciao (
451
- 'acis_streak_map' ,
452
- infile = str (evt ).replace ('_filtered' , '' ),
453
- fovfile = fov_file ,
454
- bkgroot = outdir / (self .obsid + "_acis_streaks_bkg.fits" ),
455
- regfile = outdir / (self .obsid + "_acis_streaks.txt" ),
456
- msigma = '4' ,
457
- clobber = 'yes' ,
458
- logging_tag = str (self )
459
- )
450
+ try :
451
+ self .ciao (
452
+ 'acis_streak_map' ,
453
+ infile = str (evt ).replace ('_filtered' , '' ),
454
+ fovfile = fov_file ,
455
+ bkgroot = outdir / (self .obsid + "_acis_streaks_bkg.fits" ),
456
+ regfile = outdir / (self .obsid + "_acis_streaks.txt" ),
457
+ msigma = '4' ,
458
+ clobber = 'yes' ,
459
+ logging_tag = str (self )
460
+ )
461
+ except Exception :
462
+ logger .warning (f'{ self } acis_streak_map failed' )
460
463
461
464
@logging_call_decorator
462
465
def run_wavdetect (self , edition , skip_exist = False , scales = "1.4 2 4 8 16 32" ):
@@ -475,19 +478,27 @@ def run_wavdetect(self, edition, skip_exist=False, scales="1.4 2 4 8 16 32"):
475
478
if outfile .exists () and skip_exist :
476
479
return
477
480
478
- self .ciao (
479
- "wavdetect" ,
480
- infile = imgdir / (self .obsid + "_" + band + "_thresh.img" ),
481
- expfile = imgdir / (self .obsid + "_" + band + "_thresh.expmap" ), # exposure map
482
- psffile = imgdir / (self .obsid + "_" + band + "_thresh.psfmap" ), # PSF
483
- outfile = outfile ,
484
- scellfile = detdir / (root + ".cell" ),
485
- imagefile = detdir / (root + ".img" ),
486
- defnbkgfile = detdir / (root + ".nbkg" ),
487
- scales = scales ,
488
- clobber = 'yes' ,
489
- logging_tag = str (self )
490
- )
481
+ scales = scales .split ()
482
+ # if wavdetect fails, it tries again removing the largest two scales
483
+ for i in range (2 ):
484
+ try :
485
+ self .ciao (
486
+ "wavdetect" ,
487
+ infile = imgdir / (self .obsid + "_" + band + "_thresh.img" ),
488
+ expfile = imgdir / (self .obsid + "_" + band + "_thresh.expmap" ), # exposure map
489
+ psffile = imgdir / (self .obsid + "_" + band + "_thresh.psfmap" ), # PSF
490
+ outfile = outfile ,
491
+ scellfile = detdir / (root + ".cell" ),
492
+ imagefile = detdir / (root + ".img" ),
493
+ defnbkgfile = detdir / (root + ".nbkg" ),
494
+ scales = ' ' .join (scales ),
495
+ clobber = 'yes' ,
496
+ logging_tag = str (self )
497
+ )
498
+ except Exception :
499
+ scales = scales [:- 1 ]
500
+ if len (scales ) < 3 :
501
+ raise
491
502
492
503
@logging_call_decorator
493
504
def run_celldetect (self , snr = 3 ):
@@ -520,7 +531,7 @@ def filter_events(self, radius=180, psfratio=1): # radius in arcsec
520
531
try :
521
532
evt = list ((self .workdir / 'primary' ).glob ('*evt2.fits*' ))[0 ]
522
533
except Exception :
523
- raise Exception (f'evt2 file not found ' ) from None
534
+ raise SkippedWithWarning (f'evt2 file not found' ) from None
524
535
525
536
evt2 = str (evt ).replace ('evt2' , 'evt2_filtered' )
526
537
0 commit comments