@@ -55,9 +55,9 @@ def __init__(self, input_model, **pars):
5555 try :
5656 self .algorithm = self .algorithm_dict [self .pars ['algorithm' ]]
5757
58- except :
59- log .critical (f"Algorithm name provided does not match an "
60- f"implemented algorithm!" )
58+ except KeyError :
59+ log .critical (f"Algorithm name { self . pars [ 'algorithm' ] } provided does "
60+ f"not match an implemented algorithm!" )
6161 raise Exception
6262
6363 def replace (self ):
@@ -67,10 +67,10 @@ def replace(self):
6767 to each 2D spectrum in input.
6868 """
6969 # ImageModel inputs (MIR_LRS-FIXEDSLIT)
70- if isinstance (self .input , datamodels .ImageModel ):
70+ if isinstance (self .input , ( datamodels .ImageModel , datamodels . IFUImageModel ) ):
7171 self .output = self .algorithm (self .input )
7272 n_replaced = np .sum (self .output .dq & self .REPLACED )
73- log .info (f"Input ImageModel had { n_replaced } pixels replaced." )
73+ log .info (f"Input model had { n_replaced } pixels replaced." )
7474
7575 # MultiSlitModel inputs (WFSS, NRS_FIXEDSLIT, ?)
7676 elif isinstance (self .input , datamodels .MultiSlitModel ):
@@ -86,7 +86,7 @@ def replace(self):
8686
8787 else :
8888 # This should never happen, as these would be caught in the step code.
89- log .critical (f "How did we get here?" )
89+ log .critical ("How did we get here?" )
9090 raise Exception
9191
9292 def fit_profile (self , model ):
@@ -124,8 +124,8 @@ def fit_profile(self, model):
124124 # Truncate array to region where good pixels exist
125125 good_pixels = np .where (~ model .dq & 1 )
126126 if np .any (0 in np .shape (good_pixels )):
127- log .warning (f "No good pixels in at least one dimension of "
128- f "data array - skipping pixel replacement." )
127+ log .warning ("No good pixels in at least one dimension of "
128+ "data array - skipping pixel replacement." )
129129 return model
130130 x_range = [np .min (good_pixels [0 ]), np .max (good_pixels [0 ]) + 1 ]
131131 y_range = [np .min (good_pixels [1 ]), np .max (good_pixels [1 ]) + 1 ]
0 commit comments