@@ -322,7 +322,7 @@ def __init__(self, starid, input_folder, output_folder, datasource='ffi',
322
322
elif len (fname ) == 0 :
323
323
raise FileNotFoundError ("Target Pixel File not found" )
324
324
elif len (fname ) > 1 :
325
- raise OSError ("Multiple Target Pixel Files found matching pattern" )
325
+ raise FileNotFoundError ("Multiple Target Pixel Files found matching pattern" )
326
326
327
327
# Open the FITS file:
328
328
self .tpf = fits .open (fname , mode = 'readonly' , memmap = True )
@@ -410,7 +410,7 @@ def __init__(self, starid, input_folder, output_folder, datasource='ffi',
410
410
cursor .execute ("SELECT ra,decl,ra_J2000,decl_J2000,pm_ra,pm_decl,tmag,teff FROM catalog WHERE starid={0:d};" .format (self .starid ))
411
411
target = cursor .fetchone ()
412
412
if target is None :
413
- raise Exception ( "Star could not be found in catalog: {0 :d}" . format ( self . starid ) )
413
+ raise RuntimeError ( f "Star could not be found in catalog: { self . starid :d} " )
414
414
self .target = dict (target ) # Dictionary of all main target properties.
415
415
cursor .execute ("SELECT sector,reference_time,ticver FROM settings LIMIT 1;" )
416
416
target = cursor .fetchone ()
@@ -1336,15 +1336,15 @@ def photometry(self, *args, **kwargs):
1336
1336
1337
1337
# Check that the status has been changed:
1338
1338
if self ._status == STATUS .UNKNOWN :
1339
- raise Exception ("STATUS was not set by do_photometry" )
1339
+ raise ValueError ("STATUS was not set by do_photometry" )
1340
1340
1341
1341
# Calculate performance metrics if status was not an error:
1342
1342
if self ._status in (STATUS .OK , STATUS .WARNING ):
1343
1343
# Simple check that entire lightcurve is not NaN:
1344
1344
if allnan (self .lightcurve ['flux' ]):
1345
- raise Exception ("Final lightcurve fluxes are all NaNs" )
1345
+ raise ValueError ("Final lightcurve fluxes are all NaNs" )
1346
1346
if allnan (self .lightcurve ['flux_err' ]):
1347
- raise Exception ("Final lightcurve errors are all NaNs" )
1347
+ raise ValueError ("Final lightcurve errors are all NaNs" )
1348
1348
1349
1349
# Pick out the part of the lightcurve that has a good quality
1350
1350
# and only use this subset to calculate the diagnostic metrics:
0 commit comments