diff --git a/drizzlepac/staticMask.py b/drizzlepac/staticMask.py index 60408bf3f..dc3f3b25e 100644 --- a/drizzlepac/staticMask.py +++ b/drizzlepac/staticMask.py @@ -27,7 +27,7 @@ log = logutil.create_logger(__name__, level=logutil.logging.NOTSET) -#this is called by the user +# this is called by the user def createMask(input=None, static_sig=4.0, group=None, editpars=False, configObj=None, **inputDict): """ The user can input a list of images if they like to create static masks as well as optional values for static_sig and inputDict. @@ -53,7 +53,7 @@ def createMask(input=None, static_sig=4.0, group=None, editpars=False, configObj if not editpars: run(configObj) -#this is called by the TEAL interface +# this is called by the TEAL interface def run(configObj): #now we really just need the imageObject list created for the dataset @@ -63,7 +63,7 @@ def run(configObj): createStaticMask(imageObjList,configObj) -#this is the workhorse function called by MultiDrizzle +# this is the workhorse function called by MultiDrizzle def createStaticMask(imageObjectList=[],configObj=None,procSteps=None): if procSteps is not None: procSteps.addStep('Static Mask') @@ -167,7 +167,7 @@ def addMember(self, imagePtr=None): if chips is None: chips = imagePtr.getExtensions() - #for chip in range(1,numchips+1,1): + # for chip in range(1,numchips+1,1): for chip in chips: chipid=imagePtr.scienceExt + ','+ str(chip) chipimage=imagePtr.getData(chipid) @@ -186,8 +186,13 @@ def addMember(self, imagePtr=None): maskname = self.masknames[s] break imagePtr[chipid].outputNames['staticMask'] = maskname - - stats = ImageStats(chipimage,nclip=3,fields='mode') + stats = ImageStats( + chipimage, + nclip=3, + fields="mode", + lower=np.nanmin(chipimage), + upper=np.nanmax(chipimage), + ) mode = stats.mode rms = stats.stddev nbins = len(stats.histogram) @@ -259,10 +264,10 @@ def saveToFile(self,imageObjectList): virtual = imageObjectList[0].inmemory for key in self.masklist.keys(): - #check to see if the file already exists on disk + # check to see if the file already exists on disk filename = self.masknames[key] - #create a new fits image with the mask array and a standard header - #open a new header and data unit + # create a new fits image with the mask array and a standard header + # open a new header and data unit newHDU = fits.PrimaryHDU() newHDU.data = self.masklist[key]