repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._findExtnames
def _findExtnames(self, extname=None, exclude=None): """ This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all. """ #make a list of the available exten...
python
def _findExtnames(self, extname=None, exclude=None): """ This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all. """ #make a list of the available exten...
[ "def", "_findExtnames", "(", "self", ",", "extname", "=", "None", ",", "exclude", "=", "None", ")", ":", "#make a list of the available extension names for the object", "extensions", "=", "[", "]", "if", "extname", "is", "not", "None", ":", "if", "not", "isinsta...
This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all.
[ "This", "method", "builds", "a", "list", "of", "all", "extensions", "which", "have", "EXTNAME", "==", "extname", "and", "do", "not", "include", "any", "extensions", "with", "EXTNAME", "==", "exclude", "if", "any", "are", "specified", "for", "exclusion", "at"...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L288-L317
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.findExtNum
def findExtNum(self, extname=None, extver=1): """Find the extension number of the give extname and extver.""" extnum = None extname = extname.upper() if not self._isSimpleFits: for ext in self._image: if (hasattr(ext,'_extension') and 'IMAGE' in ext._extensio...
python
def findExtNum(self, extname=None, extver=1): """Find the extension number of the give extname and extver.""" extnum = None extname = extname.upper() if not self._isSimpleFits: for ext in self._image: if (hasattr(ext,'_extension') and 'IMAGE' in ext._extensio...
[ "def", "findExtNum", "(", "self", ",", "extname", "=", "None", ",", "extver", "=", "1", ")", ":", "extnum", "=", "None", "extname", "=", "extname", ".", "upper", "(", ")", "if", "not", "self", ".", "_isSimpleFits", ":", "for", "ext", "in", "self", ...
Find the extension number of the give extname and extver.
[ "Find", "the", "extension", "number", "of", "the", "give", "extname", "and", "extver", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L319-L332
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._assignRootname
def _assignRootname(self, chip): """ Assign a unique rootname for the image based in the expname. """ extname=self._image[self.scienceExt,chip].header["EXTNAME"].lower() extver=self._image[self.scienceExt,chip].header["EXTVER"] expname = self._rootname # record extension-based n...
python
def _assignRootname(self, chip): """ Assign a unique rootname for the image based in the expname. """ extname=self._image[self.scienceExt,chip].header["EXTNAME"].lower() extver=self._image[self.scienceExt,chip].header["EXTVER"] expname = self._rootname # record extension-based n...
[ "def", "_assignRootname", "(", "self", ",", "chip", ")", ":", "extname", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", ".", "header", "[", "\"EXTNAME\"", "]", ".", "lower", "(", ")", "extver", "=", "self", ".", "_image...
Assign a unique rootname for the image based in the expname.
[ "Assign", "a", "unique", "rootname", "for", "the", "image", "based", "in", "the", "expname", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L334-L346
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._setOutputNames
def _setOutputNames(self,rootname,suffix='_drz'): """ Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file. """...
python
def _setOutputNames(self,rootname,suffix='_drz'): """ Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file. """...
[ "def", "_setOutputNames", "(", "self", ",", "rootname", ",", "suffix", "=", "'_drz'", ")", ":", "# Define FITS output filenames for intermediate products", "# Build names based on final DRIZZLE output name", "# where 'output' normally would have been created", "# by 'process_input()'...
Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file.
[ "Define", "the", "default", "output", "filenames", "for", "drizzle", "products", "these", "are", "based", "on", "the", "original", "rootname", "of", "the", "image", "filename", "should", "be", "just", "1", "filename", "so", "call", "this", "in", "a", "loop",...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L348-L389
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._initVirtualOutputs
def _initVirtualOutputs(self): """ Sets up the structure to hold all the output data arrays for this image in memory. """ self.virtualOutputs = {} for product in self.outputNames: self.virtualOutputs[product] = None
python
def _initVirtualOutputs(self): """ Sets up the structure to hold all the output data arrays for this image in memory. """ self.virtualOutputs = {} for product in self.outputNames: self.virtualOutputs[product] = None
[ "def", "_initVirtualOutputs", "(", "self", ")", ":", "self", ".", "virtualOutputs", "=", "{", "}", "for", "product", "in", "self", ".", "outputNames", ":", "self", ".", "virtualOutputs", "[", "product", "]", "=", "None" ]
Sets up the structure to hold all the output data arrays for this image in memory.
[ "Sets", "up", "the", "structure", "to", "hold", "all", "the", "output", "data", "arrays", "for", "this", "image", "in", "memory", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L417-L423
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.saveVirtualOutputs
def saveVirtualOutputs(self,outdict): """ Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'. """ if not self.inmemory: return for outname in outdict: self.virtualOutputs[outname] = outdict[outname]
python
def saveVirtualOutputs(self,outdict): """ Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'. """ if not self.inmemory: return for outname in outdict: self.virtualOutputs[outname] = outdict[outname]
[ "def", "saveVirtualOutputs", "(", "self", ",", "outdict", ")", ":", "if", "not", "self", ".", "inmemory", ":", "return", "for", "outname", "in", "outdict", ":", "self", ".", "virtualOutputs", "[", "outname", "]", "=", "outdict", "[", "outname", "]" ]
Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'.
[ "Assign", "in", "-", "memory", "versions", "of", "generated", "products", "for", "this", "imageObject", "based", "on", "dictionary", "outdict", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L425-L432
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getOutputName
def getOutputName(self,name): """ Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory. """ val = self.outputNames[name] if self.inmemory: # if inmemory was turned on... # return virtualOutput object saved w...
python
def getOutputName(self,name): """ Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory. """ val = self.outputNames[name] if self.inmemory: # if inmemory was turned on... # return virtualOutput object saved w...
[ "def", "getOutputName", "(", "self", ",", "name", ")", ":", "val", "=", "self", ".", "outputNames", "[", "name", "]", "if", "self", ".", "inmemory", ":", "# if inmemory was turned on...", "# return virtualOutput object saved with that name", "val", "=", "self", "....
Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory.
[ "Return", "the", "name", "of", "the", "file", "or", "PyFITS", "object", "associated", "with", "that", "name", "depending", "on", "the", "setting", "of", "self", ".", "inmemory", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L434-L442
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.updateOutputValues
def updateOutputValues(self,output_wcs): """ Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object. """ outputvals = self.outputValues outputvals['output'] = output_wcs.outputNames['outFinal'] outputvals['outnx'], outputval...
python
def updateOutputValues(self,output_wcs): """ Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object. """ outputvals = self.outputValues outputvals['output'] = output_wcs.outputNames['outFinal'] outputvals['outnx'], outputval...
[ "def", "updateOutputValues", "(", "self", ",", "output_wcs", ")", ":", "outputvals", "=", "self", ".", "outputValues", "outputvals", "[", "'output'", "]", "=", "output_wcs", ".", "outputNames", "[", "'outFinal'", "]", "outputvals", "[", "'outnx'", "]", ",", ...
Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object.
[ "Copy", "info", "from", "output", "WCSObject", "into", "outputnames", "for", "each", "chip", "for", "use", "in", "creating", "outputimage", "object", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L447-L468
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.updateContextImage
def updateContextImage(self, contextpar): """ Reset the name of the context image to `None` if parameter ``context`` is `False`. """ self.createContext = contextpar if not contextpar: log.info('No context image will be created for %s' % self._fil...
python
def updateContextImage(self, contextpar): """ Reset the name of the context image to `None` if parameter ``context`` is `False`. """ self.createContext = contextpar if not contextpar: log.info('No context image will be created for %s' % self._fil...
[ "def", "updateContextImage", "(", "self", ",", "contextpar", ")", ":", "self", ".", "createContext", "=", "contextpar", "if", "not", "contextpar", ":", "log", ".", "info", "(", "'No context image will be created for %s'", "%", "self", ".", "_filename", ")", "sel...
Reset the name of the context image to `None` if parameter ``context`` is `False`.
[ "Reset", "the", "name", "of", "the", "context", "image", "to", "None", "if", "parameter", "context", "is", "False", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L470-L479
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.find_DQ_extension
def find_DQ_extension(self): """ Return the suffix for the data quality extension and the name of the file which that DQ extension should be read from. """ dqfile = None dq_suffix=None if(self.maskExt is not None): for hdu in self._image: # Loo...
python
def find_DQ_extension(self): """ Return the suffix for the data quality extension and the name of the file which that DQ extension should be read from. """ dqfile = None dq_suffix=None if(self.maskExt is not None): for hdu in self._image: # Loo...
[ "def", "find_DQ_extension", "(", "self", ")", ":", "dqfile", "=", "None", "dq_suffix", "=", "None", "if", "(", "self", ".", "maskExt", "is", "not", "None", ")", ":", "for", "hdu", "in", "self", ".", "_image", ":", "# Look for DQ extension in input file", "...
Return the suffix for the data quality extension and the name of the file which that DQ extension should be read from.
[ "Return", "the", "suffix", "for", "the", "data", "quality", "extension", "and", "the", "name", "of", "the", "file", "which", "that", "DQ", "extension", "should", "be", "read", "from", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L481-L495
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getKeywordList
def getKeywordList(self, kw): """ Return lists of all attribute values for all active chips in the ``imageObject``. """ kwlist = [] for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] if sci_chip.group_member: ...
python
def getKeywordList(self, kw): """ Return lists of all attribute values for all active chips in the ``imageObject``. """ kwlist = [] for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] if sci_chip.group_member: ...
[ "def", "getKeywordList", "(", "self", ",", "kw", ")", ":", "kwlist", "=", "[", "]", "for", "chip", "in", "range", "(", "1", ",", "self", ".", "_numchips", "+", "1", ",", "1", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "...
Return lists of all attribute values for all active chips in the ``imageObject``.
[ "Return", "lists", "of", "all", "attribute", "values", "for", "all", "active", "chips", "in", "the", "imageObject", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L497-L509
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getflat
def getflat(self, chip): """ Method for retrieving a detector's flat field. Returns ------- flat: array This method will return an array the same shape as the image in **units of electrons**. """ sci_chip = self._image[self.scienceExt, ch...
python
def getflat(self, chip): """ Method for retrieving a detector's flat field. Returns ------- flat: array This method will return an array the same shape as the image in **units of electrons**. """ sci_chip = self._image[self.scienceExt, ch...
[ "def", "getflat", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "# The keyword for ACS flat fields in the primary header of the flt", "# file is pfltfile. This flat file is already in the requi...
Method for retrieving a detector's flat field. Returns ------- flat: array This method will return an array the same shape as the image in **units of electrons**.
[ "Method", "for", "retrieving", "a", "detector", "s", "flat", "field", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L514-L562
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getReadNoiseImage
def getReadNoiseImage(self, chip): """ Notes ===== Method for returning the readnoise image of a detector (in electrons). The method will return an array of the same shape as the image. :units: electrons """ sci_chip = self._image[self.scienceEx...
python
def getReadNoiseImage(self, chip): """ Notes ===== Method for returning the readnoise image of a detector (in electrons). The method will return an array of the same shape as the image. :units: electrons """ sci_chip = self._image[self.scienceEx...
[ "def", "getReadNoiseImage", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "return", "np", ".", "ones", "(", "sci_chip", ".", "image_shape", ",", "dtype", "=", "sci_chip", "...
Notes ===== Method for returning the readnoise image of a detector (in electrons). The method will return an array of the same shape as the image. :units: electrons
[ "Notes", "=====", "Method", "for", "returning", "the", "readnoise", "image", "of", "a", "detector", "(", "in", "electrons", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L564-L577
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getexptimeimg
def getexptimeimg(self,chip): """ Notes ===== Return an array representing the exposure time per pixel for the detector. This method will be overloaded for IR detectors which have their own EXP arrays, namely, WFC3/IR and NICMOS images. :units: None ...
python
def getexptimeimg(self,chip): """ Notes ===== Return an array representing the exposure time per pixel for the detector. This method will be overloaded for IR detectors which have their own EXP arrays, namely, WFC3/IR and NICMOS images. :units: None ...
[ "def", "getexptimeimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "if", "sci_chip", ".", "_wtscl_par", "==", "'expsq'", ":", "wtscl", "=", "sci_chip", ".", "_exptime", ...
Notes ===== Return an array representing the exposure time per pixel for the detector. This method will be overloaded for IR detectors which have their own EXP arrays, namely, WFC3/IR and NICMOS images. :units: None Returns ======= exptimeimg :...
[ "Notes", "=====", "Return", "an", "array", "representing", "the", "exposure", "time", "per", "pixel", "for", "the", "detector", ".", "This", "method", "will", "be", "overloaded", "for", "IR", "detectors", "which", "have", "their", "own", "EXP", "arrays", "na...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L579-L602
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getdarkimg
def getdarkimg(self,chip): """ Notes ===== Return an array representing the dark image for the detector. The method will return an array of the same shape as the image. :units: electrons """ sci_chip = self._image[self.scienceExt,chip] return np....
python
def getdarkimg(self,chip): """ Notes ===== Return an array representing the dark image for the detector. The method will return an array of the same shape as the image. :units: electrons """ sci_chip = self._image[self.scienceExt,chip] return np....
[ "def", "getdarkimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "return", "np", ".", "ones", "(", "sci_chip", ".", "image_shape", ",", "dtype", "=", "sci_chip", ".", "...
Notes ===== Return an array representing the dark image for the detector. The method will return an array of the same shape as the image. :units: electrons
[ "Notes", "=====", "Return", "an", "array", "representing", "the", "dark", "image", "for", "the", "detector", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L604-L615
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getskyimg
def getskyimg(self,chip): """ Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons """ sci_chip = self._image[s...
python
def getskyimg(self,chip): """ Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons """ sci_chip = self._image[s...
[ "def", "getskyimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "return", "np", ".", "ones", "(", "sci_chip", ".", "image_shape", ",", "dtype", "=", "sci_chip", ".", "i...
Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons
[ "Notes", "=====", "Return", "an", "array", "representing", "the", "sky", "image", "for", "the", "detector", ".", "The", "value", "of", "the", "sky", "is", "what", "would", "actually", "be", "subtracted", "from", "the", "exposure", "by", "the", "skysub", "s...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L617-L629
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getExtensions
def getExtensions(self, extname='SCI', section=None): """ Return the list of EXTVER values for extensions with name specified in extname. """ if section is None: numext = 0 section = [] for hdu in self._image: if 'extname' in hdu.heade...
python
def getExtensions(self, extname='SCI', section=None): """ Return the list of EXTVER values for extensions with name specified in extname. """ if section is None: numext = 0 section = [] for hdu in self._image: if 'extname' in hdu.heade...
[ "def", "getExtensions", "(", "self", ",", "extname", "=", "'SCI'", ",", "section", "=", "None", ")", ":", "if", "section", "is", "None", ":", "numext", "=", "0", "section", "=", "[", "]", "for", "hdu", "in", "self", ".", "_image", ":", "if", "'extn...
Return the list of EXTVER values for extensions with name specified in extname.
[ "Return", "the", "list", "of", "EXTVER", "values", "for", "extensions", "with", "name", "specified", "in", "extname", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L647-L662
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._countEXT
def _countEXT(self,extname="SCI"): """ Count the number of extensions in the file with the given name (``EXTNAME``). """ count=0 #simple fits image if (self._image['PRIMARY'].header["EXTEND"]): for i,hdu in enumerate(self._image): if i > 0: ...
python
def _countEXT(self,extname="SCI"): """ Count the number of extensions in the file with the given name (``EXTNAME``). """ count=0 #simple fits image if (self._image['PRIMARY'].header["EXTEND"]): for i,hdu in enumerate(self._image): if i > 0: ...
[ "def", "_countEXT", "(", "self", ",", "extname", "=", "\"SCI\"", ")", ":", "count", "=", "0", "#simple fits image", "if", "(", "self", ".", "_image", "[", "'PRIMARY'", "]", ".", "header", "[", "\"EXTEND\"", "]", ")", ":", "for", "i", ",", "hdu", "in"...
Count the number of extensions in the file with the given name (``EXTNAME``).
[ "Count", "the", "number", "of", "extensions", "in", "the", "file", "with", "the", "given", "name", "(", "EXTNAME", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L664-L688
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.buildMask
def buildMask(self,chip,bits=0,write=False): """ Build masks as specified in the user parameters found in the configObj object. We should overload this function in the instrument specific implementations so that we can add other stuff to the badpixel mask? Like vignettin...
python
def buildMask(self,chip,bits=0,write=False): """ Build masks as specified in the user parameters found in the configObj object. We should overload this function in the instrument specific implementations so that we can add other stuff to the badpixel mask? Like vignettin...
[ "def", "buildMask", "(", "self", ",", "chip", ",", "bits", "=", "0", ",", "write", "=", "False", ")", ":", "dqarr", "=", "self", ".", "getData", "(", "exten", "=", "self", ".", "maskExt", "+", "','", "+", "str", "(", "chip", ")", ")", "dqmask", ...
Build masks as specified in the user parameters found in the configObj object. We should overload this function in the instrument specific implementations so that we can add other stuff to the badpixel mask? Like vignetting areas and chip boundries in nicmos which are camera dep...
[ "Build", "masks", "as", "specified", "in", "the", "user", "parameters", "found", "in", "the", "configObj", "object", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L694-L720
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.buildEXPmask
def buildEXPmask(self, chip, dqarr): """ Builds a weight mask from an input DQ array and the exposure time per pixel for this chip. """ log.info("Applying EXPTIME weighting to DQ mask for chip %s" % chip) #exparr = self.getexptimeimg(chip) exparr = self._...
python
def buildEXPmask(self, chip, dqarr): """ Builds a weight mask from an input DQ array and the exposure time per pixel for this chip. """ log.info("Applying EXPTIME weighting to DQ mask for chip %s" % chip) #exparr = self.getexptimeimg(chip) exparr = self._...
[ "def", "buildEXPmask", "(", "self", ",", "chip", ",", "dqarr", ")", ":", "log", ".", "info", "(", "\"Applying EXPTIME weighting to DQ mask for chip %s\"", "%", "chip", ")", "#exparr = self.getexptimeimg(chip)", "exparr", "=", "self", ".", "_image", "[", "self", "....
Builds a weight mask from an input DQ array and the exposure time per pixel for this chip.
[ "Builds", "a", "weight", "mask", "from", "an", "input", "DQ", "array", "and", "the", "exposure", "time", "per", "pixel", "for", "this", "chip", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L722-L732
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.buildIVMmask
def buildIVMmask(self ,chip, dqarr, scale): """ Builds a weight mask from an input DQ array and either an IVM array provided by the user or a self-generated IVM array derived from the flat-field reference file associated with the input image. """ sci_chip = self._image[self.scien...
python
def buildIVMmask(self ,chip, dqarr, scale): """ Builds a weight mask from an input DQ array and either an IVM array provided by the user or a self-generated IVM array derived from the flat-field reference file associated with the input image. """ sci_chip = self._image[self.scien...
[ "def", "buildIVMmask", "(", "self", ",", "chip", ",", "dqarr", ",", "scale", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "ivmname", "=", "self", ".", "outputNames", "[", "'ivmFile'", "]", "if", ...
Builds a weight mask from an input DQ array and either an IVM array provided by the user or a self-generated IVM array derived from the flat-field reference file associated with the input image.
[ "Builds", "a", "weight", "mask", "from", "an", "input", "DQ", "array", "and", "either", "an", "IVM", "array", "provided", "by", "the", "user", "or", "a", "self", "-", "generated", "IVM", "array", "derived", "from", "the", "flat", "-", "field", "reference...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L734-L779
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.buildERRmask
def buildERRmask(self,chip,dqarr,scale): """ Builds a weight mask from an input DQ array and an ERR array associated with the input image. """ sci_chip = self._image[self.scienceExt,chip] # Set default value in case of error, or lack of ERR array errmask = dqarr ...
python
def buildERRmask(self,chip,dqarr,scale): """ Builds a weight mask from an input DQ array and an ERR array associated with the input image. """ sci_chip = self._image[self.scienceExt,chip] # Set default value in case of error, or lack of ERR array errmask = dqarr ...
[ "def", "buildERRmask", "(", "self", ",", "chip", ",", "dqarr", ",", "scale", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "# Set default value in case of error, or lack of ERR array", "errmask", "=", "dqarr"...
Builds a weight mask from an input DQ array and an ERR array associated with the input image.
[ "Builds", "a", "weight", "mask", "from", "an", "input", "DQ", "array", "and", "an", "ERR", "array", "associated", "with", "the", "input", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L781-L839
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.set_mt_wcs
def set_mt_wcs(self, image): """ Reset the WCS for this image based on the WCS information from another imageObject. """ for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] ref_chip = image._image[image.scienceExt,chip] ...
python
def set_mt_wcs(self, image): """ Reset the WCS for this image based on the WCS information from another imageObject. """ for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] ref_chip = image._image[image.scienceExt,chip] ...
[ "def", "set_mt_wcs", "(", "self", ",", "image", ")", ":", "for", "chip", "in", "range", "(", "1", ",", "self", ".", "_numchips", "+", "1", ",", "1", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]...
Reset the WCS for this image based on the WCS information from another imageObject.
[ "Reset", "the", "WCS", "for", "this", "image", "based", "on", "the", "WCS", "information", "from", "another", "imageObject", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L846-L854
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.set_wtscl
def set_wtscl(self, chip, wtscl_par): """ Sets the value of the wt_scl parameter as needed for drizzling. """ sci_chip = self._image[self.scienceExt,chip] exptime = 1 #sci_chip._exptime _parval = 'unity' if wtscl_par is not None: if type(wtscl_par) == type(''...
python
def set_wtscl(self, chip, wtscl_par): """ Sets the value of the wt_scl parameter as needed for drizzling. """ sci_chip = self._image[self.scienceExt,chip] exptime = 1 #sci_chip._exptime _parval = 'unity' if wtscl_par is not None: if type(wtscl_par) == type(''...
[ "def", "set_wtscl", "(", "self", ",", "chip", ",", "wtscl_par", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "exptime", "=", "1", "#sci_chip._exptime", "_parval", "=", "'unity'", "if", "wtscl_par", "...
Sets the value of the wt_scl parameter as needed for drizzling.
[ "Sets", "the", "value", "of", "the", "wt_scl", "parameter", "as", "needed", "for", "drizzling", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L856-L892
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getInstrParameter
def getInstrParameter(self, value, header, keyword): """ This method gets a instrument parameter from a pair of task parameters: a value, and a header keyword. The default behavior is: - if the value and header keyword are given, raise an exception. - if the ...
python
def getInstrParameter(self, value, header, keyword): """ This method gets a instrument parameter from a pair of task parameters: a value, and a header keyword. The default behavior is: - if the value and header keyword are given, raise an exception. - if the ...
[ "def", "getInstrParameter", "(", "self", ",", "value", ",", "header", ",", "keyword", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", "and", "value", "in", "[", "'None'", ",", "''", ",", "' '", ",", "'INDEF'", "]", ":", "value", "=", "...
This method gets a instrument parameter from a pair of task parameters: a value, and a header keyword. The default behavior is: - if the value and header keyword are given, raise an exception. - if the value is given, use it. - if the value is blank and...
[ "This", "method", "gets", "a", "instrument", "parameter", "from", "a", "pair", "of", "task", "parameters", ":", "a", "value", "and", "a", "header", "keyword", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L901-L927
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._averageFromHeader
def _averageFromHeader(self, header, keyword): """ Averages out values taken from header. The keywords where to read values from are passed as a comma-separated list. """ _list = '' for _kw in keyword.split(','): if _kw in header: _list = _list + '...
python
def _averageFromHeader(self, header, keyword): """ Averages out values taken from header. The keywords where to read values from are passed as a comma-separated list. """ _list = '' for _kw in keyword.split(','): if _kw in header: _list = _list + '...
[ "def", "_averageFromHeader", "(", "self", ",", "header", ",", "keyword", ")", ":", "_list", "=", "''", "for", "_kw", "in", "keyword", ".", "split", "(", "','", ")", ":", "if", "_kw", "in", "header", ":", "_list", "=", "_list", "+", "','", "+", "str...
Averages out values taken from header. The keywords where to read values from are passed as a comma-separated list.
[ "Averages", "out", "values", "taken", "from", "header", ".", "The", "keywords", "where", "to", "read", "values", "from", "are", "passed", "as", "a", "comma", "-", "separated", "list", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L929-L939
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._averageFromList
def _averageFromList(self, param): """ Averages out values passed as a comma-separated list, disregarding the zero-valued entries. """ _result = 0.0 _count = 0 for _param in param.split(','): if _param != '' and float(_param) != 0.0: _resu...
python
def _averageFromList(self, param): """ Averages out values passed as a comma-separated list, disregarding the zero-valued entries. """ _result = 0.0 _count = 0 for _param in param.split(','): if _param != '' and float(_param) != 0.0: _resu...
[ "def", "_averageFromList", "(", "self", ",", "param", ")", ":", "_result", "=", "0.0", "_count", "=", "0", "for", "_param", "in", "param", ".", "split", "(", "','", ")", ":", "if", "_param", "!=", "''", "and", "float", "(", "_param", ")", "!=", "0....
Averages out values passed as a comma-separated list, disregarding the zero-valued entries.
[ "Averages", "out", "values", "passed", "as", "a", "comma", "-", "separated", "list", "disregarding", "the", "zero", "-", "valued", "entries", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L941-L955
spacetelescope/drizzlepac
drizzlepac/imageObject.py
imageObject.compute_wcslin
def compute_wcslin(self,undistort=True): """ Compute the undistorted WCS based solely on the known distortion model information associated with the WCS. """ for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] chip_wcs = sci_ch...
python
def compute_wcslin(self,undistort=True): """ Compute the undistorted WCS based solely on the known distortion model information associated with the WCS. """ for chip in range(1,self._numchips+1,1): sci_chip = self._image[self.scienceExt,chip] chip_wcs = sci_ch...
[ "def", "compute_wcslin", "(", "self", ",", "undistort", "=", "True", ")", ":", "for", "chip", "in", "range", "(", "1", ",", "self", ".", "_numchips", "+", "1", ",", "1", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceEx...
Compute the undistorted WCS based solely on the known distortion model information associated with the WCS.
[ "Compute", "the", "undistorted", "WCS", "based", "solely", "on", "the", "known", "distortion", "model", "information", "associated", "with", "the", "WCS", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L1151-L1168
spacetelescope/drizzlepac
drizzlepac/imageObject.py
imageObject.set_units
def set_units(self,chip): """ Define units for this image. """ # Determine output value of BUNITS # and make sure it is not specified as 'ergs/cm...' sci_chip = self._image[self.scienceExt,chip] _bunit = None if 'BUNIT' in sci_chip.header and sci_chip.header['BUN...
python
def set_units(self,chip): """ Define units for this image. """ # Determine output value of BUNITS # and make sure it is not specified as 'ergs/cm...' sci_chip = self._image[self.scienceExt,chip] _bunit = None if 'BUNIT' in sci_chip.header and sci_chip.header['BUN...
[ "def", "set_units", "(", "self", ",", "chip", ")", ":", "# Determine output value of BUNITS", "# and make sure it is not specified as 'ergs/cm...'", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "_bunit", "=", "None", "if"...
Define units for this image.
[ "Define", "units", "for", "this", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L1170-L1188
spacetelescope/drizzlepac
drizzlepac/outputimage.py
getTemplates
def getTemplates(fnames, blend=True): """ Process all headers to produce a set of combined headers that follows the rules defined by each instrument. """ if not blend: newhdrs = blendheaders.getSingleTemplate(fnames[0]) newtab = None else: # apply rules to create final ...
python
def getTemplates(fnames, blend=True): """ Process all headers to produce a set of combined headers that follows the rules defined by each instrument. """ if not blend: newhdrs = blendheaders.getSingleTemplate(fnames[0]) newtab = None else: # apply rules to create final ...
[ "def", "getTemplates", "(", "fnames", ",", "blend", "=", "True", ")", ":", "if", "not", "blend", ":", "newhdrs", "=", "blendheaders", ".", "getSingleTemplate", "(", "fnames", "[", "0", "]", ")", "newtab", "=", "None", "else", ":", "# apply rules to create ...
Process all headers to produce a set of combined headers that follows the rules defined by each instrument.
[ "Process", "all", "headers", "to", "produce", "a", "set", "of", "combined", "headers", "that", "follows", "the", "rules", "defined", "by", "each", "instrument", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L680-L694
spacetelescope/drizzlepac
drizzlepac/outputimage.py
addWCSKeywords
def addWCSKeywords(wcs,hdr,blot=False,single=False,after=None): """ Update input header 'hdr' with WCS keywords. """ wname = wcs.wcs.name if not single: wname = 'DRZWCS' # Update WCS Keywords based on PyDrizzle product's value # since 'drizzle' itself doesn't update that keyword. hd...
python
def addWCSKeywords(wcs,hdr,blot=False,single=False,after=None): """ Update input header 'hdr' with WCS keywords. """ wname = wcs.wcs.name if not single: wname = 'DRZWCS' # Update WCS Keywords based on PyDrizzle product's value # since 'drizzle' itself doesn't update that keyword. hd...
[ "def", "addWCSKeywords", "(", "wcs", ",", "hdr", ",", "blot", "=", "False", ",", "single", "=", "False", ",", "after", "=", "None", ")", ":", "wname", "=", "wcs", ".", "wcs", ".", "name", "if", "not", "single", ":", "wname", "=", "'DRZWCS'", "# Upd...
Update input header 'hdr' with WCS keywords.
[ "Update", "input", "header", "hdr", "with", "WCS", "keywords", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L696-L729
spacetelescope/drizzlepac
drizzlepac/outputimage.py
writeSingleFITS
def writeSingleFITS(data,wcs,output,template,clobber=True,verbose=True): """ Write out a simple FITS file given a numpy array and the name of another FITS file to use as a template for the output image header. """ outname,outextn = fileutil.parseFilename(output) outextname,outextver = fileutil.parse...
python
def writeSingleFITS(data,wcs,output,template,clobber=True,verbose=True): """ Write out a simple FITS file given a numpy array and the name of another FITS file to use as a template for the output image header. """ outname,outextn = fileutil.parseFilename(output) outextname,outextver = fileutil.parse...
[ "def", "writeSingleFITS", "(", "data", ",", "wcs", ",", "output", ",", "template", ",", "clobber", "=", "True", ",", "verbose", "=", "True", ")", ":", "outname", ",", "outextn", "=", "fileutil", ".", "parseFilename", "(", "output", ")", "outextname", ","...
Write out a simple FITS file given a numpy array and the name of another FITS file to use as a template for the output image header.
[ "Write", "out", "a", "simple", "FITS", "file", "given", "a", "numpy", "array", "and", "the", "name", "of", "another", "FITS", "file", "to", "use", "as", "a", "template", "for", "the", "output", "image", "header", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L743-L811
spacetelescope/drizzlepac
drizzlepac/outputimage.py
writeDrizKeywords
def writeDrizKeywords(hdr,imgnum,drizdict): """ Write basic drizzle-related keywords out to image header as a record of the processing performed to create the image The dictionary 'drizdict' will contain the keywords and values to be written out to the header. """ _keyprefix = 'D%03...
python
def writeDrizKeywords(hdr,imgnum,drizdict): """ Write basic drizzle-related keywords out to image header as a record of the processing performed to create the image The dictionary 'drizdict' will contain the keywords and values to be written out to the header. """ _keyprefix = 'D%03...
[ "def", "writeDrizKeywords", "(", "hdr", ",", "imgnum", ",", "drizdict", ")", ":", "_keyprefix", "=", "'D%03d'", "%", "imgnum", "for", "key", "in", "drizdict", ":", "val", "=", "drizdict", "[", "key", "]", "[", "'value'", "]", "if", "val", "is", "None",...
Write basic drizzle-related keywords out to image header as a record of the processing performed to create the image The dictionary 'drizdict' will contain the keywords and values to be written out to the header.
[ "Write", "basic", "drizzle", "-", "related", "keywords", "out", "to", "image", "header", "as", "a", "record", "of", "the", "processing", "performed", "to", "create", "the", "image" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L813-L827
spacetelescope/drizzlepac
drizzlepac/outputimage.py
OutputImage.writeFITS
def writeFITS(self, template, sciarr, whtarr, ctxarr=None, versions=None, overwrite=yes, blend=True, virtual=False): """ Generate PyFITS objects for each output extension using the file given by 'template' for populating headers. The arrays will have the size spe...
python
def writeFITS(self, template, sciarr, whtarr, ctxarr=None, versions=None, overwrite=yes, blend=True, virtual=False): """ Generate PyFITS objects for each output extension using the file given by 'template' for populating headers. The arrays will have the size spe...
[ "def", "writeFITS", "(", "self", ",", "template", ",", "sciarr", ",", "whtarr", ",", "ctxarr", "=", "None", ",", "versions", "=", "None", ",", "overwrite", "=", "yes", ",", "blend", "=", "True", ",", "virtual", "=", "False", ")", ":", "if", "not", ...
Generate PyFITS objects for each output extension using the file given by 'template' for populating headers. The arrays will have the size specified by 'shape'.
[ "Generate", "PyFITS", "objects", "for", "each", "output", "extension", "using", "the", "file", "given", "by", "template", "for", "populating", "headers", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L173-L548
spacetelescope/drizzlepac
drizzlepac/outputimage.py
OutputImage.find_kwupdate_location
def find_kwupdate_location(self,hdr,keyword): """ Find the last keyword in the output header that comes before the new keyword in the original, full input headers. This will rely on the original ordering of keywords from the original input files in order to place the updated keyw...
python
def find_kwupdate_location(self,hdr,keyword): """ Find the last keyword in the output header that comes before the new keyword in the original, full input headers. This will rely on the original ordering of keywords from the original input files in order to place the updated keyw...
[ "def", "find_kwupdate_location", "(", "self", ",", "hdr", ",", "keyword", ")", ":", "# start by looping through the full templates", "kw_list", "=", "None", "last_kw", "=", "None", "for", "extn", "in", "self", ".", "fullhdrs", ":", "if", "keyword", "in", "extn",...
Find the last keyword in the output header that comes before the new keyword in the original, full input headers. This will rely on the original ordering of keywords from the original input files in order to place the updated keyword in the correct location in case the keyword was remove...
[ "Find", "the", "last", "keyword", "in", "the", "output", "header", "that", "comes", "before", "the", "new", "keyword", "in", "the", "original", "full", "input", "headers", ".", "This", "will", "rely", "on", "the", "original", "ordering", "of", "keywords", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L550-L582
spacetelescope/drizzlepac
drizzlepac/outputimage.py
OutputImage.addDrizKeywords
def addDrizKeywords(self,hdr,versions): """ Add drizzle parameter keywords to header. """ # Extract some global information for the keywords _geom = 'User parameters' _imgnum = 0 for pl in self.parlist: # Start by building up the keyword prefix based # ...
python
def addDrizKeywords(self,hdr,versions): """ Add drizzle parameter keywords to header. """ # Extract some global information for the keywords _geom = 'User parameters' _imgnum = 0 for pl in self.parlist: # Start by building up the keyword prefix based # ...
[ "def", "addDrizKeywords", "(", "self", ",", "hdr", ",", "versions", ")", ":", "# Extract some global information for the keywords", "_geom", "=", "'User parameters'", "_imgnum", "=", "0", "for", "pl", "in", "self", ".", "parlist", ":", "# Start by building up the keyw...
Add drizzle parameter keywords to header.
[ "Add", "drizzle", "parameter", "keywords", "to", "header", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L585-L649
spacetelescope/drizzlepac
drizzlepac/linearfit.py
iter_fit_shifts
def iter_fit_shifts(xy,uv,nclip=3,sigma=3.0): """ Perform an iterative-fit with 'nclip' iterations """ fit = fit_shifts(xy,uv) if nclip is None: nclip = 0 # define index to initially include all points for n in range(nclip): resids = compute_resids(xy,uv,fit) resids1d = np.sqrt(n...
python
def iter_fit_shifts(xy,uv,nclip=3,sigma=3.0): """ Perform an iterative-fit with 'nclip' iterations """ fit = fit_shifts(xy,uv) if nclip is None: nclip = 0 # define index to initially include all points for n in range(nclip): resids = compute_resids(xy,uv,fit) resids1d = np.sqrt(n...
[ "def", "iter_fit_shifts", "(", "xy", ",", "uv", ",", "nclip", "=", "3", ",", "sigma", "=", "3.0", ")", ":", "fit", "=", "fit_shifts", "(", "xy", ",", "uv", ")", "if", "nclip", "is", "None", ":", "nclip", "=", "0", "# define index to initially include a...
Perform an iterative-fit with 'nclip' iterations
[ "Perform", "an", "iterative", "-", "fit", "with", "nclip", "iterations" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L35-L54
spacetelescope/drizzlepac
drizzlepac/linearfit.py
fit_all
def fit_all(xy,uv,mode='rscale',center=None,verbose=True): """ Performs an 'rscale' fit between matched lists of pixel positions xy and uv""" if mode not in ['general', 'shift', 'rscale']: mode = 'rscale' if not isinstance(xy,np.ndarray): # cast input list as numpy ndarray for fitting ...
python
def fit_all(xy,uv,mode='rscale',center=None,verbose=True): """ Performs an 'rscale' fit between matched lists of pixel positions xy and uv""" if mode not in ['general', 'shift', 'rscale']: mode = 'rscale' if not isinstance(xy,np.ndarray): # cast input list as numpy ndarray for fitting ...
[ "def", "fit_all", "(", "xy", ",", "uv", ",", "mode", "=", "'rscale'", ",", "center", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "mode", "not", "in", "[", "'general'", ",", "'shift'", ",", "'rscale'", "]", ":", "mode", "=", "'rscale'"...
Performs an 'rscale' fit between matched lists of pixel positions xy and uv
[ "Performs", "an", "rscale", "fit", "between", "matched", "lists", "of", "pixel", "positions", "xy", "and", "uv" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L150-L185
spacetelescope/drizzlepac
drizzlepac/linearfit.py
fit_shifts
def fit_shifts(xy, uv): """ Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough ob...
python
def fit_shifts(xy, uv): """ Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough ob...
[ "def", "fit_shifts", "(", "xy", ",", "uv", ")", ":", "diff_pts", "=", "xy", "-", "uv", "Pcoeffs", "=", "np", ".", "array", "(", "[", "1.0", ",", "0.0", ",", "diff_pts", "[", ":", ",", "0", "]", ".", "mean", "(", "dtype", "=", "np", ".", "floa...
Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough objects are available for a fit. ...
[ "Performs", "a", "simple", "fit", "for", "the", "shift", "only", "between", "matched", "lists", "of", "positions", "xy", "and", "uv", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L188-L210
spacetelescope/drizzlepac
drizzlepac/linearfit.py
fit_general
def fit_general(xy, uv): """ Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough o...
python
def fit_general(xy, uv): """ Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough o...
[ "def", "fit_general", "(", "xy", ",", "uv", ")", ":", "# Set up products used for computing the fit", "gxy", "=", "uv", ".", "astype", "(", "ndfloat128", ")", "guv", "=", "xy", ".", "astype", "(", "ndfloat128", ")", "Sx", "=", "gxy", "[", ":", ",", "0", ...
Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough objects are available for a fit. ...
[ "Performs", "a", "simple", "fit", "for", "the", "shift", "only", "between", "matched", "lists", "of", "positions", "xy", "and", "uv", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L213-L269
spacetelescope/drizzlepac
drizzlepac/linearfit.py
fit_arrays
def fit_arrays(uv, xy): """ Performs a generalized fit between matched lists of positions given by the 2 column arrays xy and uv. This function fits for translation, rotation, and scale changes between 'xy' and 'uv', allowing for different scales and orientations for X and Y axes. ...
python
def fit_arrays(uv, xy): """ Performs a generalized fit between matched lists of positions given by the 2 column arrays xy and uv. This function fits for translation, rotation, and scale changes between 'xy' and 'uv', allowing for different scales and orientations for X and Y axes. ...
[ "def", "fit_arrays", "(", "uv", ",", "xy", ")", ":", "if", "not", "isinstance", "(", "xy", ",", "np", ".", "ndarray", ")", ":", "# cast input list as numpy ndarray for fitting", "xy", "=", "np", ".", "array", "(", "xy", ")", "if", "not", "isinstance", "(...
Performs a generalized fit between matched lists of positions given by the 2 column arrays xy and uv. This function fits for translation, rotation, and scale changes between 'xy' and 'uv', allowing for different scales and orientations for X and Y axes. ========================...
[ "Performs", "a", "generalized", "fit", "between", "matched", "lists", "of", "positions", "given", "by", "the", "2", "column", "arrays", "xy", "and", "uv", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L272-L340
spacetelescope/drizzlepac
drizzlepac/linearfit.py
apply_old_coeffs
def apply_old_coeffs(xy,coeffs): """ Apply the offset/shift/rot values from a linear fit to an array of x,y positions. """ _theta = np.deg2rad(coeffs[1]) _mrot = np.zeros(shape=(2,2),dtype=np.float64) _mrot[0] = (np.cos(_theta),np.sin(_theta)) _mrot[1] = (-np.sin(_theta),np.cos(_theta)) ...
python
def apply_old_coeffs(xy,coeffs): """ Apply the offset/shift/rot values from a linear fit to an array of x,y positions. """ _theta = np.deg2rad(coeffs[1]) _mrot = np.zeros(shape=(2,2),dtype=np.float64) _mrot[0] = (np.cos(_theta),np.sin(_theta)) _mrot[1] = (-np.sin(_theta),np.cos(_theta)) ...
[ "def", "apply_old_coeffs", "(", "xy", ",", "coeffs", ")", ":", "_theta", "=", "np", ".", "deg2rad", "(", "coeffs", "[", "1", "]", ")", "_mrot", "=", "np", ".", "zeros", "(", "shape", "=", "(", "2", ",", "2", ")", ",", "dtype", "=", "np", ".", ...
Apply the offset/shift/rot values from a linear fit to an array of x,y positions.
[ "Apply", "the", "offset", "/", "shift", "/", "rot", "values", "from", "a", "linear", "fit", "to", "an", "array", "of", "x", "y", "positions", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L434-L445
spacetelescope/drizzlepac
drizzlepac/linearfit.py
apply_fit
def apply_fit(xy,coeffs): """ Apply the coefficients from a linear fit to an array of x,y positions. The coeffs come from the 'coeffs' member of the 'fit_arrays()' output. """ x_new = coeffs[0][2] + coeffs[0][0]*xy[:,0] + coeffs[0][1]*xy[:,1] y_new = coeffs[1][2] + coeffs[1][0]*...
python
def apply_fit(xy,coeffs): """ Apply the coefficients from a linear fit to an array of x,y positions. The coeffs come from the 'coeffs' member of the 'fit_arrays()' output. """ x_new = coeffs[0][2] + coeffs[0][0]*xy[:,0] + coeffs[0][1]*xy[:,1] y_new = coeffs[1][2] + coeffs[1][0]*...
[ "def", "apply_fit", "(", "xy", ",", "coeffs", ")", ":", "x_new", "=", "coeffs", "[", "0", "]", "[", "2", "]", "+", "coeffs", "[", "0", "]", "[", "0", "]", "*", "xy", "[", ":", ",", "0", "]", "+", "coeffs", "[", "0", "]", "[", "1", "]", ...
Apply the coefficients from a linear fit to an array of x,y positions. The coeffs come from the 'coeffs' member of the 'fit_arrays()' output.
[ "Apply", "the", "coefficients", "from", "a", "linear", "fit", "to", "an", "array", "of", "x", "y", "positions", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L448-L458
spacetelescope/drizzlepac
drizzlepac/linearfit.py
compute_resids
def compute_resids(xy,uv,fit): """ Compute the residuals based on fit and input arrays to the fit """ print('FIT coeffs: ',fit['coeffs']) xn,yn = apply_fit(uv,fit['coeffs']) resids = xy - np.transpose([xn,yn]) return resids
python
def compute_resids(xy,uv,fit): """ Compute the residuals based on fit and input arrays to the fit """ print('FIT coeffs: ',fit['coeffs']) xn,yn = apply_fit(uv,fit['coeffs']) resids = xy - np.transpose([xn,yn]) return resids
[ "def", "compute_resids", "(", "xy", ",", "uv", ",", "fit", ")", ":", "print", "(", "'FIT coeffs: '", ",", "fit", "[", "'coeffs'", "]", ")", "xn", ",", "yn", "=", "apply_fit", "(", "uv", ",", "fit", "[", "'coeffs'", "]", ")", "resids", "=", "xy", ...
Compute the residuals based on fit and input arrays to the fit
[ "Compute", "the", "residuals", "based", "on", "fit", "and", "input", "arrays", "to", "the", "fit" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L461-L467
spacetelescope/drizzlepac
drizzlepac/linearfit.py
geomap_rscale
def geomap_rscale(xyin,xyref,center=None): """ Set up the products used for computing the fit derived using the code from lib/geofit.x for the function 'geo_fmagnify()'. Comparisons with results from geomap (no additional clipping) were made and produced the same results out to 5 decimal places. ...
python
def geomap_rscale(xyin,xyref,center=None): """ Set up the products used for computing the fit derived using the code from lib/geofit.x for the function 'geo_fmagnify()'. Comparisons with results from geomap (no additional clipping) were made and produced the same results out to 5 decimal places. ...
[ "def", "geomap_rscale", "(", "xyin", ",", "xyref", ",", "center", "=", "None", ")", ":", "if", "center", "is", "not", "None", ":", "xcen", "=", "center", "[", "0", "]", "ycen", "=", "center", "[", "1", "]", "else", ":", "xcen", "=", "xyref", "[",...
Set up the products used for computing the fit derived using the code from lib/geofit.x for the function 'geo_fmagnify()'. Comparisons with results from geomap (no additional clipping) were made and produced the same results out to 5 decimal places. Output ------ fit: dict Dictionary co...
[ "Set", "up", "the", "products", "used", "for", "computing", "the", "fit", "derived", "using", "the", "code", "from", "lib", "/", "geofit", ".", "x", "for", "the", "function", "geo_fmagnify", "()", ".", "Comparisons", "with", "results", "from", "geomap", "(...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L471-L563
spacetelescope/drizzlepac
drizzlepac/astrodrizzle.py
AstroDrizzle
def AstroDrizzle(input=None, mdriztab=False, editpars=False, configobj=None, wcsmap=None, **input_dict): """ AstroDrizzle command-line interface """ # Support input of filenames from command-line without a parameter name # then copy this into input_dict for merging with TEAL ConfigObj #...
python
def AstroDrizzle(input=None, mdriztab=False, editpars=False, configobj=None, wcsmap=None, **input_dict): """ AstroDrizzle command-line interface """ # Support input of filenames from command-line without a parameter name # then copy this into input_dict for merging with TEAL ConfigObj #...
[ "def", "AstroDrizzle", "(", "input", "=", "None", ",", "mdriztab", "=", "False", ",", "editpars", "=", "False", ",", "configobj", "=", "None", ",", "wcsmap", "=", "None", ",", "*", "*", "input_dict", ")", ":", "# Support input of filenames from command-line wi...
AstroDrizzle command-line interface
[ "AstroDrizzle", "command", "-", "line", "interface" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/astrodrizzle.py#L59-L118
spacetelescope/drizzlepac
drizzlepac/astrodrizzle.py
run
def run(configobj, wcsmap=None): """ Initial example by Nadia ran MD with configobj EPAR using: It can be run in one of two ways: from stsci.tools import teal 1. Passing a config object to teal teal.teal('drizzlepac/pars/astrodrizzle.cfg') 2. Passing a task name: ...
python
def run(configobj, wcsmap=None): """ Initial example by Nadia ran MD with configobj EPAR using: It can be run in one of two ways: from stsci.tools import teal 1. Passing a config object to teal teal.teal('drizzlepac/pars/astrodrizzle.cfg') 2. Passing a task name: ...
[ "def", "run", "(", "configobj", ",", "wcsmap", "=", "None", ")", ":", "# turn on logging, redirecting stdout/stderr messages to a log file", "# while also printing them out to stdout as well", "# also, initialize timing of processing steps", "#", "# We need to define a default logfile na...
Initial example by Nadia ran MD with configobj EPAR using: It can be run in one of two ways: from stsci.tools import teal 1. Passing a config object to teal teal.teal('drizzlepac/pars/astrodrizzle.cfg') 2. Passing a task name: teal.teal('astrodrizzle') The exa...
[ "Initial", "example", "by", "Nadia", "ran", "MD", "with", "configobj", "EPAR", "using", ":", "It", "can", "be", "run", "in", "one", "of", "two", "ways", ":" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/astrodrizzle.py#L124-L248
spacetelescope/drizzlepac
drizzlepac/astrodrizzle.py
_dbg_dump_virtual_outputs
def _dbg_dump_virtual_outputs(imgObjList): """ dump some helpful information. strictly for debugging """ global _fidx tag = 'virtual' log.info((tag+' ')*7) for iii in imgObjList: log.info('-'*80) log.info(tag+' orig nm: '+iii._original_file_name) log.info(tag+' names.data...
python
def _dbg_dump_virtual_outputs(imgObjList): """ dump some helpful information. strictly for debugging """ global _fidx tag = 'virtual' log.info((tag+' ')*7) for iii in imgObjList: log.info('-'*80) log.info(tag+' orig nm: '+iii._original_file_name) log.info(tag+' names.data...
[ "def", "_dbg_dump_virtual_outputs", "(", "imgObjList", ")", ":", "global", "_fidx", "tag", "=", "'virtual'", "log", ".", "info", "(", "(", "tag", "+", "' '", ")", "*", "7", ")", "for", "iii", "in", "imgObjList", ":", "log", ".", "info", "(", "'-'", ...
dump some helpful information. strictly for debugging
[ "dump", "some", "helpful", "information", ".", "strictly", "for", "debugging" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/astrodrizzle.py#L303-L341
spacetelescope/drizzlepac
drizzlepac/wfc3Data.py
WFC3UVISInputImage.getdarkcurrent
def getdarkcurrent(self,chip): """ Return the dark current for the WFC3 UVIS detector. This value will be contained within an instrument specific keyword. Returns ------- darkcurrent: float The dark current value with **units of electrons**. """ ...
python
def getdarkcurrent(self,chip): """ Return the dark current for the WFC3 UVIS detector. This value will be contained within an instrument specific keyword. Returns ------- darkcurrent: float The dark current value with **units of electrons**. """ ...
[ "def", "getdarkcurrent", "(", "self", ",", "chip", ")", ":", "darkcurrent", "=", "0.", "try", ":", "darkcurrent", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", ".", "header", "[", "'MEANDARK'", "]", "except", ":", "msg",...
Return the dark current for the WFC3 UVIS detector. This value will be contained within an instrument specific keyword. Returns ------- darkcurrent: float The dark current value with **units of electrons**.
[ "Return", "the", "dark", "current", "for", "the", "WFC3", "UVIS", "detector", ".", "This", "value", "will", "be", "contained", "within", "an", "instrument", "specific", "keyword", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L112-L141
spacetelescope/drizzlepac
drizzlepac/wfc3Data.py
WFC3IRInputImage.doUnitConversions
def doUnitConversions(self): """WF3 IR data come out in electrons, and I imagine the photometry keywords will be calculated as such, so no image manipulation needs be done between native and electrons """ # Image information _handle = fileutil.openImage(self._filename, mode='...
python
def doUnitConversions(self): """WF3 IR data come out in electrons, and I imagine the photometry keywords will be calculated as such, so no image manipulation needs be done between native and electrons """ # Image information _handle = fileutil.openImage(self._filename, mode='...
[ "def", "doUnitConversions", "(", "self", ")", ":", "# Image information", "_handle", "=", "fileutil", ".", "openImage", "(", "self", ".", "_filename", ",", "mode", "=", "'readonly'", ",", "memmap", "=", "False", ")", "for", "chip", "in", "self", ".", "retu...
WF3 IR data come out in electrons, and I imagine the photometry keywords will be calculated as such, so no image manipulation needs be done between native and electrons
[ "WF3", "IR", "data", "come", "out", "in", "electrons", "and", "I", "imagine", "the", "photometry", "keywords", "will", "be", "calculated", "as", "such", "so", "no", "image", "manipulation", "needs", "be", "done", "between", "native", "and", "electrons" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L165-L184
spacetelescope/drizzlepac
drizzlepac/wfc3Data.py
WFC3IRInputImage.getdarkimg
def getdarkimg(self,chip): """ Return an array representing the dark image for the detector. Returns ------- dark: array Dark image array in the same shape as the input image with **units of cps** """ sci_chip = self._image[self.scienceExt,chip] ...
python
def getdarkimg(self,chip): """ Return an array representing the dark image for the detector. Returns ------- dark: array Dark image array in the same shape as the input image with **units of cps** """ sci_chip = self._image[self.scienceExt,chip] ...
[ "def", "getdarkimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "# First attempt to get the dark image specified by the \"DARKFILE\"", "# keyword in the primary keyword of the science data.",...
Return an array representing the dark image for the detector. Returns ------- dark: array Dark image array in the same shape as the input image with **units of cps**
[ "Return", "an", "array", "representing", "the", "dark", "image", "for", "the", "detector", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L240-L267
spacetelescope/drizzlepac
drizzlepac/wfc3Data.py
WFC3IRInputImage.getskyimg
def getskyimg(self,chip): """ Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons """ sci_chip = self._image[s...
python
def getskyimg(self,chip): """ Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons """ sci_chip = self._image[s...
[ "def", "getskyimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "skyimg", "=", "np", ".", "ones", "(", "sci_chip", ".", "image_shape", ",", "dtype", "=", "sci_chip", "....
Notes ===== Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step. :units: electrons
[ "Notes", "=====", "Return", "an", "array", "representing", "the", "sky", "image", "for", "the", "detector", ".", "The", "value", "of", "the", "sky", "is", "what", "would", "actually", "be", "subtracted", "from", "the", "exposure", "by", "the", "skysub", "s...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L269-L284
spacetelescope/drizzlepac
drizzlepac/acsData.py
ACSInputImage.getdarkcurrent
def getdarkcurrent(self,extver): """ Return the dark current for the ACS detector. This value will be contained within an instrument specific keyword. The value in the image header will be converted to units of electrons. Returns ------- darkcurrent: flo...
python
def getdarkcurrent(self,extver): """ Return the dark current for the ACS detector. This value will be contained within an instrument specific keyword. The value in the image header will be converted to units of electrons. Returns ------- darkcurrent: flo...
[ "def", "getdarkcurrent", "(", "self", ",", "extver", ")", ":", "darkcurrent", "=", "0.", "try", ":", "darkcurrent", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "extver", "]", ".", "header", "[", "'MEANDARK'", "]", "except", ":", "s...
Return the dark current for the ACS detector. This value will be contained within an instrument specific keyword. The value in the image header will be converted to units of electrons. Returns ------- darkcurrent: float Dark current value for the ACS detecto...
[ "Return", "the", "dark", "current", "for", "the", "ACS", "detector", ".", "This", "value", "will", "be", "contained", "within", "an", "instrument", "specific", "keyword", ".", "The", "value", "in", "the", "image", "header", "will", "be", "converted", "to", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/acsData.py#L58-L88
spacetelescope/drizzlepac
drizzlepac/acsData.py
SBCInputImage.setInstrumentParameters
def setInstrumentParameters(self,instrpars): """ Sets the instrument parameters. """ pri_header = self._image[0].header if self._isNotValid (instrpars['gain'], instrpars['gnkeyword']): instrpars['gnkeyword'] = None if self._isNotValid (instrpars['rdnoise'], instrpars...
python
def setInstrumentParameters(self,instrpars): """ Sets the instrument parameters. """ pri_header = self._image[0].header if self._isNotValid (instrpars['gain'], instrpars['gnkeyword']): instrpars['gnkeyword'] = None if self._isNotValid (instrpars['rdnoise'], instrpars...
[ "def", "setInstrumentParameters", "(", "self", ",", "instrpars", ")", ":", "pri_header", "=", "self", ".", "_image", "[", "0", "]", ".", "header", "if", "self", ".", "_isNotValid", "(", "instrpars", "[", "'gain'", "]", ",", "instrpars", "[", "'gnkeyword'",...
Sets the instrument parameters.
[ "Sets", "the", "instrument", "parameters", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/acsData.py#L232-L278
spacetelescope/drizzlepac
drizzlepac/minmed.py
min_med
def min_med(images, weight_images, readnoise_list, exptime_list, background_values, weight_masks=None, combine_grow=1, combine_nsigma1=4, combine_nsigma2=3, fillval=False): """ Create a median array, rejecting the highest pixel and computing the lowest valid pixel after mask application....
python
def min_med(images, weight_images, readnoise_list, exptime_list, background_values, weight_masks=None, combine_grow=1, combine_nsigma1=4, combine_nsigma2=3, fillval=False): """ Create a median array, rejecting the highest pixel and computing the lowest valid pixel after mask application....
[ "def", "min_med", "(", "images", ",", "weight_images", ",", "readnoise_list", ",", "exptime_list", ",", "background_values", ",", "weight_masks", "=", "None", ",", "combine_grow", "=", "1", ",", "combine_nsigma1", "=", "4", ",", "combine_nsigma2", "=", "3", ",...
Create a median array, rejecting the highest pixel and computing the lowest valid pixel after mask application. .. note:: In this version of the mimmed algorithm we assume that the units of all input data is electons. Parameters ---------- images : list of numpy.ndarray Lis...
[ "Create", "a", "median", "array", "rejecting", "the", "highest", "pixel", "and", "computing", "the", "lowest", "valid", "pixel", "after", "mask", "application", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/minmed.py#L349-L633
spacetelescope/drizzlepac
drizzlepac/minmed.py
minmed._sumImages
def _sumImages(self,numarrayObjectList): """ Sum a list of numarray objects. """ if numarrayObjectList in [None, []]: return None tsum = np.zeros(numarrayObjectList[0].shape, dtype=numarrayObjectList[0].dtype) for image in numarrayObjectList: tsum += image ...
python
def _sumImages(self,numarrayObjectList): """ Sum a list of numarray objects. """ if numarrayObjectList in [None, []]: return None tsum = np.zeros(numarrayObjectList[0].shape, dtype=numarrayObjectList[0].dtype) for image in numarrayObjectList: tsum += image ...
[ "def", "_sumImages", "(", "self", ",", "numarrayObjectList", ")", ":", "if", "numarrayObjectList", "in", "[", "None", ",", "[", "]", "]", ":", "return", "None", "tsum", "=", "np", ".", "zeros", "(", "numarrayObjectList", "[", "0", "]", ".", "shape", ",...
Sum a list of numarray objects.
[ "Sum", "a", "list", "of", "numarray", "objects", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/minmed.py#L336-L346
spacetelescope/drizzlepac
drizzlepac/findobj.py
gaussian1
def gaussian1(height, x0, y0, a, b, c): """ height - the amplitude of the gaussian x0, y0, - center of the gaussian a, b, c - ellipse parameters (coefficients in the quadratic form) """ return lambda x, y: height * np.exp(-0.5* (a*(x-x0)**2 + b*(x-x0)*(y-y0) + c*(y-y0)**2))
python
def gaussian1(height, x0, y0, a, b, c): """ height - the amplitude of the gaussian x0, y0, - center of the gaussian a, b, c - ellipse parameters (coefficients in the quadratic form) """ return lambda x, y: height * np.exp(-0.5* (a*(x-x0)**2 + b*(x-x0)*(y-y0) + c*(y-y0)**2))
[ "def", "gaussian1", "(", "height", ",", "x0", ",", "y0", ",", "a", ",", "b", ",", "c", ")", ":", "return", "lambda", "x", ",", "y", ":", "height", "*", "np", ".", "exp", "(", "-", "0.5", "*", "(", "a", "*", "(", "x", "-", "x0", ")", "**",...
height - the amplitude of the gaussian x0, y0, - center of the gaussian a, b, c - ellipse parameters (coefficients in the quadratic form)
[ "height", "-", "the", "amplitude", "of", "the", "gaussian", "x0", "y0", "-", "center", "of", "the", "gaussian", "a", "b", "c", "-", "ellipse", "parameters", "(", "coefficients", "in", "the", "quadratic", "form", ")" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L32-L39
spacetelescope/drizzlepac
drizzlepac/findobj.py
gausspars
def gausspars(fwhm, nsigma=1.5, ratio=1, theta=0.): """ height - the amplitude of the gaussian x0, y0, - center of the gaussian fwhm - full width at half maximum of the observation nsigma - cut the gaussian at nsigma ratio = ratio of xsigma/ysigma theta - angle of pos...
python
def gausspars(fwhm, nsigma=1.5, ratio=1, theta=0.): """ height - the amplitude of the gaussian x0, y0, - center of the gaussian fwhm - full width at half maximum of the observation nsigma - cut the gaussian at nsigma ratio = ratio of xsigma/ysigma theta - angle of pos...
[ "def", "gausspars", "(", "fwhm", ",", "nsigma", "=", "1.5", ",", "ratio", "=", "1", ",", "theta", "=", "0.", ")", ":", "xsigma", "=", "fwhm", "/", "FWHM2SIG", "ysigma", "=", "ratio", "*", "xsigma", "f", "=", "nsigma", "**", "2", "/", "2.", "theta...
height - the amplitude of the gaussian x0, y0, - center of the gaussian fwhm - full width at half maximum of the observation nsigma - cut the gaussian at nsigma ratio = ratio of xsigma/ysigma theta - angle of position angle of the major axis measured counter-clockwise fro...
[ "height", "-", "the", "amplitude", "of", "the", "gaussian", "x0", "y0", "-", "center", "of", "the", "gaussian", "fwhm", "-", "full", "width", "at", "half", "maximum", "of", "the", "observation", "nsigma", "-", "cut", "the", "gaussian", "at", "nsigma", "r...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L42-L99
spacetelescope/drizzlepac
drizzlepac/findobj.py
moments
def moments(data,cntr): """ Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moments. """ total = data.sum() #X, Y = np.indices(data.shape) #x = (X*data).sum()/total #y = (Y*data).sum()/total x,y = cntr xi = int(x) ...
python
def moments(data,cntr): """ Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moments. """ total = data.sum() #X, Y = np.indices(data.shape) #x = (X*data).sum()/total #y = (Y*data).sum()/total x,y = cntr xi = int(x) ...
[ "def", "moments", "(", "data", ",", "cntr", ")", ":", "total", "=", "data", ".", "sum", "(", ")", "#X, Y = np.indices(data.shape)", "#x = (X*data).sum()/total", "#y = (Y*data).sum()/total", "x", ",", "y", "=", "cntr", "xi", "=", "int", "(", "x", ")", "yi", ...
Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moments.
[ "Returns", "(", "height", "x", "y", "width_x", "width_y", ")", "the", "gaussian", "parameters", "of", "a", "2D", "distribution", "by", "calculating", "its", "moments", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L110-L131
spacetelescope/drizzlepac
drizzlepac/findobj.py
apply_nsigma_separation
def apply_nsigma_separation(fitind,fluxes,separation,niter=10): """ Remove sources which are within nsigma*fwhm/2 pixels of each other, leaving only a single valid source in that region. This algorithm only works for sources which end up sequentially next to each other based on Y position and remov...
python
def apply_nsigma_separation(fitind,fluxes,separation,niter=10): """ Remove sources which are within nsigma*fwhm/2 pixels of each other, leaving only a single valid source in that region. This algorithm only works for sources which end up sequentially next to each other based on Y position and remov...
[ "def", "apply_nsigma_separation", "(", "fitind", ",", "fluxes", ",", "separation", ",", "niter", "=", "10", ")", ":", "for", "n", "in", "range", "(", "niter", ")", ":", "if", "len", "(", "fitind", ")", "<", "1", ":", "break", "fitarr", "=", "np", "...
Remove sources which are within nsigma*fwhm/2 pixels of each other, leaving only a single valid source in that region. This algorithm only works for sources which end up sequentially next to each other based on Y position and removes enough duplicates to make the final source list more managable. It s...
[ "Remove", "sources", "which", "are", "within", "nsigma", "*", "fwhm", "/", "2", "pixels", "of", "each", "other", "leaving", "only", "a", "single", "valid", "source", "in", "that", "region", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L296-L327
spacetelescope/drizzlepac
drizzlepac/findobj.py
xy_round
def xy_round(data,x0,y0,skymode,ker2d,xsigsq,ysigsq,datamin=None,datamax=None): """ Compute center of source Original code from IRAF.noao.digiphot.daofind.apfind ap_xy_round() """ nyk,nxk = ker2d.shape if datamin is None: datamin = data.min() if datamax is None: datamax = data.ma...
python
def xy_round(data,x0,y0,skymode,ker2d,xsigsq,ysigsq,datamin=None,datamax=None): """ Compute center of source Original code from IRAF.noao.digiphot.daofind.apfind ap_xy_round() """ nyk,nxk = ker2d.shape if datamin is None: datamin = data.min() if datamax is None: datamax = data.ma...
[ "def", "xy_round", "(", "data", ",", "x0", ",", "y0", ",", "skymode", ",", "ker2d", ",", "xsigsq", ",", "ysigsq", ",", "datamin", "=", "None", ",", "datamax", "=", "None", ")", ":", "nyk", ",", "nxk", "=", "ker2d", ".", "shape", "if", "datamin", ...
Compute center of source Original code from IRAF.noao.digiphot.daofind.apfind ap_xy_round()
[ "Compute", "center", "of", "source", "Original", "code", "from", "IRAF", ".", "noao", ".", "digiphot", ".", "daofind", ".", "apfind", "ap_xy_round", "()" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L329-L350
spacetelescope/drizzlepac
drizzlepac/findobj.py
precompute_sharp_round
def precompute_sharp_round(nxk, nyk, xc, yc): """ Pre-computes mask arrays to be used by the 'sharp_round' function for roundness computations based on two- and four-fold symmetries. """ # Create arrays for the two- and four-fold symmetry computations: s4m = np.ones((nyk,nxk),dtype=np.int16) ...
python
def precompute_sharp_round(nxk, nyk, xc, yc): """ Pre-computes mask arrays to be used by the 'sharp_round' function for roundness computations based on two- and four-fold symmetries. """ # Create arrays for the two- and four-fold symmetry computations: s4m = np.ones((nyk,nxk),dtype=np.int16) ...
[ "def", "precompute_sharp_round", "(", "nxk", ",", "nyk", ",", "xc", ",", "yc", ")", ":", "# Create arrays for the two- and four-fold symmetry computations:", "s4m", "=", "np", ".", "ones", "(", "(", "nyk", ",", "nxk", ")", ",", "dtype", "=", "np", ".", "int1...
Pre-computes mask arrays to be used by the 'sharp_round' function for roundness computations based on two- and four-fold symmetries.
[ "Pre", "-", "computes", "mask", "arrays", "to", "be", "used", "by", "the", "sharp_round", "function", "for", "roundness", "computations", "based", "on", "two", "-", "and", "four", "-", "fold", "symmetries", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L353-L368
spacetelescope/drizzlepac
drizzlepac/findobj.py
sharp_round
def sharp_round(data, density, kskip, xc, yc, s2m, s4m, nxk, nyk, datamin, datamax): """ sharp_round -- Compute first estimate of the roundness and sharpness of the detected objects. A Python translation of the AP_SHARP_ROUND IRAF/DAOFIND function. """ # Compute the first estim...
python
def sharp_round(data, density, kskip, xc, yc, s2m, s4m, nxk, nyk, datamin, datamax): """ sharp_round -- Compute first estimate of the roundness and sharpness of the detected objects. A Python translation of the AP_SHARP_ROUND IRAF/DAOFIND function. """ # Compute the first estim...
[ "def", "sharp_round", "(", "data", ",", "density", ",", "kskip", ",", "xc", ",", "yc", ",", "s2m", ",", "s4m", ",", "nxk", ",", "nyk", ",", "datamin", ",", "datamax", ")", ":", "# Compute the first estimate of roundness:", "sum2", "=", "np", ".", "sum", ...
sharp_round -- Compute first estimate of the roundness and sharpness of the detected objects. A Python translation of the AP_SHARP_ROUND IRAF/DAOFIND function.
[ "sharp_round", "--", "Compute", "first", "estimate", "of", "the", "roundness", "and", "sharpness", "of", "the", "detected", "objects", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L371-L417
spacetelescope/drizzlepac
drizzlepac/findobj.py
roundness
def roundness(im): """ from astropy.io import fits as pyfits data=pyfits.getdata('j94f05bgq_flt.fits',ext=1) star0=data[403:412,423:432] star=data[396:432,3522:3558] In [53]: findobj.roundness(star0) Out[53]: 0.99401955054989544 In [54]: findobj.roundness(star) Out[54]: 0.83091919980...
python
def roundness(im): """ from astropy.io import fits as pyfits data=pyfits.getdata('j94f05bgq_flt.fits',ext=1) star0=data[403:412,423:432] star=data[396:432,3522:3558] In [53]: findobj.roundness(star0) Out[53]: 0.99401955054989544 In [54]: findobj.roundness(star) Out[54]: 0.83091919980...
[ "def", "roundness", "(", "im", ")", ":", "perimeter", "=", "im", ".", "shape", "[", "0", "]", "*", "2", "+", "im", ".", "shape", "[", "1", "]", "*", "2", "-", "4", "area", "=", "im", ".", "size", "return", "4", "*", "np", ".", "pi", "*", ...
from astropy.io import fits as pyfits data=pyfits.getdata('j94f05bgq_flt.fits',ext=1) star0=data[403:412,423:432] star=data[396:432,3522:3558] In [53]: findobj.roundness(star0) Out[53]: 0.99401955054989544 In [54]: findobj.roundness(star) Out[54]: 0.83091919980660645
[ "from", "astropy", ".", "io", "import", "fits", "as", "pyfits", "data", "=", "pyfits", ".", "getdata", "(", "j94f05bgq_flt", ".", "fits", "ext", "=", "1", ")", "star0", "=", "data", "[", "403", ":", "412", "423", ":", "432", "]", "star", "=", "data...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L420-L434
spacetelescope/drizzlepac
drizzlepac/findobj.py
immoments
def immoments(im, p,q): x = list(range(im.shape[1])) y = list(range(im.shape[0])) #coord=np.array([x.flatten(),y.flatten()]).T """ moment = 0 momentx = 0 for i in x.flatten(): moment+=momentx sumx=0 for j in y.flatten(): sumx+=i**0*j**0*star0[i,j] """ ...
python
def immoments(im, p,q): x = list(range(im.shape[1])) y = list(range(im.shape[0])) #coord=np.array([x.flatten(),y.flatten()]).T """ moment = 0 momentx = 0 for i in x.flatten(): moment+=momentx sumx=0 for j in y.flatten(): sumx+=i**0*j**0*star0[i,j] """ ...
[ "def", "immoments", "(", "im", ",", "p", ",", "q", ")", ":", "x", "=", "list", "(", "range", "(", "im", ".", "shape", "[", "1", "]", ")", ")", "y", "=", "list", "(", "range", "(", "im", ".", "shape", "[", "0", "]", ")", ")", "#coord=np.arra...
moment = 0 momentx = 0 for i in x.flatten(): moment+=momentx sumx=0 for j in y.flatten(): sumx+=i**0*j**0*star0[i,j]
[ "moment", "=", "0", "momentx", "=", "0", "for", "i", "in", "x", ".", "flatten", "()", ":", "moment", "+", "=", "momentx", "sumx", "=", "0", "for", "j", "in", "y", ".", "flatten", "()", ":", "sumx", "+", "=", "i", "**", "0", "*", "j", "**", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L436-L450
spacetelescope/drizzlepac
drizzlepac/findobj.py
centroid
def centroid(im): """ Computes the centroid of an image using the image moments: centroid = {m10/m00, m01/m00} These calls point to Python version of moments function m00 = immoments(im,0,0) m10 = immoments(im, 1,0) m01 = immoments(im,0,1) """ # These calls point to Python version...
python
def centroid(im): """ Computes the centroid of an image using the image moments: centroid = {m10/m00, m01/m00} These calls point to Python version of moments function m00 = immoments(im,0,0) m10 = immoments(im, 1,0) m01 = immoments(im,0,1) """ # These calls point to Python version...
[ "def", "centroid", "(", "im", ")", ":", "# These calls point to Python version of moments function", "m00", "=", "cdriz", ".", "arrmoments", "(", "im", ",", "0", ",", "0", ")", "m10", "=", "cdriz", ".", "arrmoments", "(", "im", ",", "1", ",", "0", ")", "...
Computes the centroid of an image using the image moments: centroid = {m10/m00, m01/m00} These calls point to Python version of moments function m00 = immoments(im,0,0) m10 = immoments(im, 1,0) m01 = immoments(im,0,1)
[ "Computes", "the", "centroid", "of", "an", "image", "using", "the", "image", "moments", ":" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L457-L476
spacetelescope/drizzlepac
drizzlepac/mdzhandler.py
getMdriztabParameters
def getMdriztabParameters(files): """ Gets entry in MDRIZTAB where task parameters live. This method returns a record array mapping the selected row. """ # Get the MDRIZTAB table file name from the primary header. # It is gotten from the first file in the input list. No # consistenc...
python
def getMdriztabParameters(files): """ Gets entry in MDRIZTAB where task parameters live. This method returns a record array mapping the selected row. """ # Get the MDRIZTAB table file name from the primary header. # It is gotten from the first file in the input list. No # consistenc...
[ "def", "getMdriztabParameters", "(", "files", ")", ":", "# Get the MDRIZTAB table file name from the primary header.", "# It is gotten from the first file in the input list. No", "# consistency checks are performed.", "_fileName", "=", "files", "[", "0", "]", "_header", "=", "fileu...
Gets entry in MDRIZTAB where task parameters live. This method returns a record array mapping the selected row.
[ "Gets", "entry", "in", "MDRIZTAB", "where", "task", "parameters", "live", ".", "This", "method", "returns", "a", "record", "array", "mapping", "the", "selected", "row", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mdzhandler.py#L17-L76
spacetelescope/drizzlepac
drizzlepac/mdzhandler.py
_interpretMdriztabPars
def _interpretMdriztabPars(rec): """ Collect task parameters from the MDRIZTAB record and update the master parameters list with those values Note that parameters read from the MDRIZTAB record must be cleaned up in a similar way that parameters read from the user interface are. """ tabd...
python
def _interpretMdriztabPars(rec): """ Collect task parameters from the MDRIZTAB record and update the master parameters list with those values Note that parameters read from the MDRIZTAB record must be cleaned up in a similar way that parameters read from the user interface are. """ tabd...
[ "def", "_interpretMdriztabPars", "(", "rec", ")", ":", "tabdict", "=", "{", "}", "# for each entry in the record...", "for", "indx", "in", "range", "(", "len", "(", "rec", ".", "array", ".", "names", ")", ")", ":", "# ... get the name, format, and value.", "_nam...
Collect task parameters from the MDRIZTAB record and update the master parameters list with those values Note that parameters read from the MDRIZTAB record must be cleaned up in a similar way that parameters read from the user interface are.
[ "Collect", "task", "parameters", "from", "the", "MDRIZTAB", "record", "and", "update", "the", "master", "parameters", "list", "with", "those", "values" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mdzhandler.py#L86-L158
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
run
def run(configObj,wcsmap=None): """ Interpret parameters from TEAL/configObj interface as set interactively by the user and build the new WCS instance """ distortion_pars = configObj['Distortion Model'] outwcs = build(configObj['outwcs'], configObj['wcsname'], configObj['refimage']...
python
def run(configObj,wcsmap=None): """ Interpret parameters from TEAL/configObj interface as set interactively by the user and build the new WCS instance """ distortion_pars = configObj['Distortion Model'] outwcs = build(configObj['outwcs'], configObj['wcsname'], configObj['refimage']...
[ "def", "run", "(", "configObj", ",", "wcsmap", "=", "None", ")", ":", "distortion_pars", "=", "configObj", "[", "'Distortion Model'", "]", "outwcs", "=", "build", "(", "configObj", "[", "'outwcs'", "]", ",", "configObj", "[", "'wcsname'", "]", ",", "config...
Interpret parameters from TEAL/configObj interface as set interactively by the user and build the new WCS instance
[ "Interpret", "parameters", "from", "TEAL", "/", "configObj", "interface", "as", "set", "interactively", "by", "the", "user", "and", "build", "the", "new", "WCS", "instance" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L59-L69
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
build
def build(outname, wcsname, refimage, undistort=False, applycoeffs=False, coeffsfile=None, **wcspars): """ Core functionality to create a WCS instance from a reference image WCS, user supplied parameters or user adjusted reference WCS. The distortion information can either be read in as pa...
python
def build(outname, wcsname, refimage, undistort=False, applycoeffs=False, coeffsfile=None, **wcspars): """ Core functionality to create a WCS instance from a reference image WCS, user supplied parameters or user adjusted reference WCS. The distortion information can either be read in as pa...
[ "def", "build", "(", "outname", ",", "wcsname", ",", "refimage", ",", "undistort", "=", "False", ",", "applycoeffs", "=", "False", ",", "coeffsfile", "=", "None", ",", "*", "*", "wcspars", ")", ":", "# Insure that the User WCS parameters have values for all the pa...
Core functionality to create a WCS instance from a reference image WCS, user supplied parameters or user adjusted reference WCS. The distortion information can either be read in as part of the reference image WCS or given in 'coeffsfile'. Parameters ---------- outname ...
[ "Core", "functionality", "to", "create", "a", "WCS", "instance", "from", "a", "reference", "image", "WCS", "user", "supplied", "parameters", "or", "user", "adjusted", "reference", "WCS", ".", "The", "distortion", "information", "can", "either", "be", "read", "...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L75-L219
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
create_WCSname
def create_WCSname(wcsname): """ Verify that a valid WCSNAME has been provided, and if not, create a default WCSNAME based on current date. """ if util.is_blank(wcsname): ptime = fileutil.getDate() wcsname = "User_"+ptime return wcsname
python
def create_WCSname(wcsname): """ Verify that a valid WCSNAME has been provided, and if not, create a default WCSNAME based on current date. """ if util.is_blank(wcsname): ptime = fileutil.getDate() wcsname = "User_"+ptime return wcsname
[ "def", "create_WCSname", "(", "wcsname", ")", ":", "if", "util", ".", "is_blank", "(", "wcsname", ")", ":", "ptime", "=", "fileutil", ".", "getDate", "(", ")", "wcsname", "=", "\"User_\"", "+", "ptime", "return", "wcsname" ]
Verify that a valid WCSNAME has been provided, and if not, create a default WCSNAME based on current date.
[ "Verify", "that", "a", "valid", "WCSNAME", "has", "been", "provided", "and", "if", "not", "create", "a", "default", "WCSNAME", "based", "on", "current", "date", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L221-L229
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
convert_user_pars
def convert_user_pars(wcspars): """ Convert the parameters provided by the configObj into the corresponding parameters from an HSTWCS object """ default_pars = default_user_wcs.copy() for kw in user_hstwcs_pars: default_pars[user_hstwcs_pars[kw]] = wcspars[kw] return default_pars
python
def convert_user_pars(wcspars): """ Convert the parameters provided by the configObj into the corresponding parameters from an HSTWCS object """ default_pars = default_user_wcs.copy() for kw in user_hstwcs_pars: default_pars[user_hstwcs_pars[kw]] = wcspars[kw] return default_pars
[ "def", "convert_user_pars", "(", "wcspars", ")", ":", "default_pars", "=", "default_user_wcs", ".", "copy", "(", ")", "for", "kw", "in", "user_hstwcs_pars", ":", "default_pars", "[", "user_hstwcs_pars", "[", "kw", "]", "]", "=", "wcspars", "[", "kw", "]", ...
Convert the parameters provided by the configObj into the corresponding parameters from an HSTWCS object
[ "Convert", "the", "parameters", "provided", "by", "the", "configObj", "into", "the", "corresponding", "parameters", "from", "an", "HSTWCS", "object" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L231-L238
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
mergewcs
def mergewcs(outwcs, customwcs, wcspars): """ Merge the WCS keywords from user specified values into a full HSTWCS object This function will essentially follow the same algorithm as used by updatehdr only it will use direct calls to updatewcs.Makewcs methods instead of using 'updatewcs' as a...
python
def mergewcs(outwcs, customwcs, wcspars): """ Merge the WCS keywords from user specified values into a full HSTWCS object This function will essentially follow the same algorithm as used by updatehdr only it will use direct calls to updatewcs.Makewcs methods instead of using 'updatewcs' as a...
[ "def", "mergewcs", "(", "outwcs", ",", "customwcs", ",", "wcspars", ")", ":", "# start by working on a copy of the refwcs", "if", "outwcs", ".", "sip", "is", "not", "None", ":", "wcslin", "=", "stwcs", ".", "distortion", ".", "utils", ".", "undistortWCS", "(",...
Merge the WCS keywords from user specified values into a full HSTWCS object This function will essentially follow the same algorithm as used by updatehdr only it will use direct calls to updatewcs.Makewcs methods instead of using 'updatewcs' as a whole
[ "Merge", "the", "WCS", "keywords", "from", "user", "specified", "values", "into", "a", "full", "HSTWCS", "object", "This", "function", "will", "essentially", "follow", "the", "same", "algorithm", "as", "used", "by", "updatehdr", "only", "it", "will", "use", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L240-L282
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
add_model
def add_model(refwcs, newcoeffs): """ Add (new?) distortion model to existing HSTWCS object """ # Update refwcs with distortion model for kw in model_attrs: if newcoeffs.__dict__[key] is not None: refwcs.__dict__[key] = newcoeffs.__dict__[key]
python
def add_model(refwcs, newcoeffs): """ Add (new?) distortion model to existing HSTWCS object """ # Update refwcs with distortion model for kw in model_attrs: if newcoeffs.__dict__[key] is not None: refwcs.__dict__[key] = newcoeffs.__dict__[key]
[ "def", "add_model", "(", "refwcs", ",", "newcoeffs", ")", ":", "# Update refwcs with distortion model", "for", "kw", "in", "model_attrs", ":", "if", "newcoeffs", ".", "__dict__", "[", "key", "]", "is", "not", "None", ":", "refwcs", ".", "__dict__", "[", "key...
Add (new?) distortion model to existing HSTWCS object
[ "Add", "(", "new?", ")", "distortion", "model", "to", "existing", "HSTWCS", "object" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L284-L290
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
apply_model
def apply_model(refwcs): """ Apply distortion model to WCS, including modifying CD with linear distortion terms """ # apply distortion model to CD matrix if 'ocx10' in refwcs.__dict__ and refwcs.ocx10 is not None: linmat = np.array([[refwcs.ocx11,refwcs.ocx10],[refwcs.ocy11,refwcs.ocy10...
python
def apply_model(refwcs): """ Apply distortion model to WCS, including modifying CD with linear distortion terms """ # apply distortion model to CD matrix if 'ocx10' in refwcs.__dict__ and refwcs.ocx10 is not None: linmat = np.array([[refwcs.ocx11,refwcs.ocx10],[refwcs.ocy11,refwcs.ocy10...
[ "def", "apply_model", "(", "refwcs", ")", ":", "# apply distortion model to CD matrix", "if", "'ocx10'", "in", "refwcs", ".", "__dict__", "and", "refwcs", ".", "ocx10", "is", "not", "None", ":", "linmat", "=", "np", ".", "array", "(", "[", "[", "refwcs", "...
Apply distortion model to WCS, including modifying CD with linear distortion terms
[ "Apply", "distortion", "model", "to", "WCS", "including", "modifying", "CD", "with", "linear", "distortion", "terms" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L292-L304
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
replace_model
def replace_model(refwcs, newcoeffs): """ Replace the distortion model in a current WCS with a new model Start by creating linear WCS, then run """ print('WARNING:') print(' Replacing existing distortion model with one') print(' not necessarily matched to the observation!') # creat...
python
def replace_model(refwcs, newcoeffs): """ Replace the distortion model in a current WCS with a new model Start by creating linear WCS, then run """ print('WARNING:') print(' Replacing existing distortion model with one') print(' not necessarily matched to the observation!') # creat...
[ "def", "replace_model", "(", "refwcs", ",", "newcoeffs", ")", ":", "print", "(", "'WARNING:'", ")", "print", "(", "' Replacing existing distortion model with one'", ")", "print", "(", "' not necessarily matched to the observation!'", ")", "# create linear version of WCS...
Replace the distortion model in a current WCS with a new model Start by creating linear WCS, then run
[ "Replace", "the", "distortion", "model", "in", "a", "current", "WCS", "with", "a", "new", "model", "Start", "by", "creating", "linear", "WCS", "then", "run" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L306-L326
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
undistortWCS
def undistortWCS(refwcs): """ Generate an undistorted HSTWCS from an HSTWCS object with a distortion model """ wcslin = stwcs.distortion.utils.output_wcs([refwcs]) outwcs = stwcs.wcsutil.HSTWCS() outwcs.wcs = wcslin.wcs outwcs.wcs.set() outwcs.setPscale() outwcs.setOrient() outwcs.s...
python
def undistortWCS(refwcs): """ Generate an undistorted HSTWCS from an HSTWCS object with a distortion model """ wcslin = stwcs.distortion.utils.output_wcs([refwcs]) outwcs = stwcs.wcsutil.HSTWCS() outwcs.wcs = wcslin.wcs outwcs.wcs.set() outwcs.setPscale() outwcs.setOrient() outwcs.s...
[ "def", "undistortWCS", "(", "refwcs", ")", ":", "wcslin", "=", "stwcs", ".", "distortion", ".", "utils", ".", "output_wcs", "(", "[", "refwcs", "]", ")", "outwcs", "=", "stwcs", ".", "wcsutil", ".", "HSTWCS", "(", ")", "outwcs", ".", "wcs", "=", "wcs...
Generate an undistorted HSTWCS from an HSTWCS object with a distortion model
[ "Generate", "an", "undistorted", "HSTWCS", "from", "an", "HSTWCS", "object", "with", "a", "distortion", "model" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L328-L346
spacetelescope/drizzlepac
drizzlepac/buildwcs.py
generate_headerlet
def generate_headerlet(outwcs,template,wcsname,outname=None): """ Create a headerlet based on the updated HSTWCS object This function uses 'template' as the basis for the headerlet. This file can either be the original wcspars['refimage'] or wcspars['coeffsfile'], in this order of preferenc...
python
def generate_headerlet(outwcs,template,wcsname,outname=None): """ Create a headerlet based on the updated HSTWCS object This function uses 'template' as the basis for the headerlet. This file can either be the original wcspars['refimage'] or wcspars['coeffsfile'], in this order of preferenc...
[ "def", "generate_headerlet", "(", "outwcs", ",", "template", ",", "wcsname", ",", "outname", "=", "None", ")", ":", "# Create header object from HSTWCS object", "siphdr", "=", "True", "if", "outwcs", ".", "sip", "is", "None", ":", "siphdr", "=", "False", "outw...
Create a headerlet based on the updated HSTWCS object This function uses 'template' as the basis for the headerlet. This file can either be the original wcspars['refimage'] or wcspars['coeffsfile'], in this order of preference. If 'template' is None, then a simple Headerlet will be ...
[ "Create", "a", "headerlet", "based", "on", "the", "updated", "HSTWCS", "object" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L348-L394
spacetelescope/drizzlepac
drizzlepac/quickDeriv.py
qderiv
def qderiv(array): # TAKE THE ABSOLUTE DERIVATIVE OF A NUMARRY OBJECT """Take the absolute derivate of an image in memory.""" #Create 2 empty arrays in memory of the same dimensions as 'array' tmpArray = np.zeros(array.shape,dtype=np.float64) outArray = np.zeros(array.shape, dtype=np.float64) # Ge...
python
def qderiv(array): # TAKE THE ABSOLUTE DERIVATIVE OF A NUMARRY OBJECT """Take the absolute derivate of an image in memory.""" #Create 2 empty arrays in memory of the same dimensions as 'array' tmpArray = np.zeros(array.shape,dtype=np.float64) outArray = np.zeros(array.shape, dtype=np.float64) # Ge...
[ "def", "qderiv", "(", "array", ")", ":", "# TAKE THE ABSOLUTE DERIVATIVE OF A NUMARRY OBJECT", "#Create 2 empty arrays in memory of the same dimensions as 'array'", "tmpArray", "=", "np", ".", "zeros", "(", "array", ".", "shape", ",", "dtype", "=", "np", ".", "float64", ...
Take the absolute derivate of an image in memory.
[ "Take", "the", "absolute", "derivate", "of", "an", "image", "in", "memory", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/quickDeriv.py#L18-L58
spacetelescope/drizzlepac
drizzlepac/hlautils/catalog_utils.py
randomSelectFromCSV
def randomSelectFromCSV(tableName, numEntries, seedValue): """Function to extract random entries (lines) from a CSV file Parameters ========== tableName: str Filename of the input master CSV file containing individual images or association names, as well as observational informa...
python
def randomSelectFromCSV(tableName, numEntries, seedValue): """Function to extract random entries (lines) from a CSV file Parameters ========== tableName: str Filename of the input master CSV file containing individual images or association names, as well as observational informa...
[ "def", "randomSelectFromCSV", "(", "tableName", ",", "numEntries", ",", "seedValue", ")", ":", "# Initialize the random number generator", "seed", "(", "seedValue", ")", "# Get the contents of the table", "dataTable", "=", "Table", ".", "read", "(", "tableName", ",", ...
Function to extract random entries (lines) from a CSV file Parameters ========== tableName: str Filename of the input master CSV file containing individual images or association names, as well as observational information regarding the images numEntries : int Number of ...
[ "Function", "to", "extract", "random", "entries", "(", "lines", ")", "from", "a", "CSV", "file" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/catalog_utils.py#L20-L60
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
get_hstwcs
def get_hstwcs(filename,hdulist,extnum): """ Return the HSTWCS object for a given chip. """ hdrwcs = wcsutil.HSTWCS(hdulist,ext=extnum) hdrwcs.filename = filename hdrwcs.expname = hdulist[extnum].header['expname'] hdrwcs.extver = hdulist[extnum].header['extver'] return hdrwcs
python
def get_hstwcs(filename,hdulist,extnum): """ Return the HSTWCS object for a given chip. """ hdrwcs = wcsutil.HSTWCS(hdulist,ext=extnum) hdrwcs.filename = filename hdrwcs.expname = hdulist[extnum].header['expname'] hdrwcs.extver = hdulist[extnum].header['extver'] return hdrwcs
[ "def", "get_hstwcs", "(", "filename", ",", "hdulist", ",", "extnum", ")", ":", "hdrwcs", "=", "wcsutil", ".", "HSTWCS", "(", "hdulist", ",", "ext", "=", "extnum", ")", "hdrwcs", ".", "filename", "=", "filename", "hdrwcs", ".", "expname", "=", "hdulist", ...
Return the HSTWCS object for a given chip.
[ "Return", "the", "HSTWCS", "object", "for", "a", "given", "chip", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L125-L132
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
update_linCD
def update_linCD(cdmat, delta_rot=0.0, delta_scale=1.0, cx=[0.0,1.0], cy=[1.0,0.0]): """ Modify an existing linear CD matrix with rotation and/or scale changes and return a new CD matrix. If 'cx' and 'cy' are specified, it will return a distorted CD matrix. Only those terms which are varyi...
python
def update_linCD(cdmat, delta_rot=0.0, delta_scale=1.0, cx=[0.0,1.0], cy=[1.0,0.0]): """ Modify an existing linear CD matrix with rotation and/or scale changes and return a new CD matrix. If 'cx' and 'cy' are specified, it will return a distorted CD matrix. Only those terms which are varyi...
[ "def", "update_linCD", "(", "cdmat", ",", "delta_rot", "=", "0.0", ",", "delta_scale", "=", "1.0", ",", "cx", "=", "[", "0.0", ",", "1.0", "]", ",", "cy", "=", "[", "1.0", ",", "0.0", "]", ")", ":", "rotmat", "=", "fileutil", ".", "buildRotMatrix",...
Modify an existing linear CD matrix with rotation and/or scale changes and return a new CD matrix. If 'cx' and 'cy' are specified, it will return a distorted CD matrix. Only those terms which are varying need to be specified on input.
[ "Modify", "an", "existing", "linear", "CD", "matrix", "with", "rotation", "and", "/", "or", "scale", "changes", "and", "return", "a", "new", "CD", "matrix", ".", "If", "cx", "and", "cy", "are", "specified", "it", "will", "return", "a", "distorted", "CD",...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L154-L167
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
create_CD
def create_CD(orient, scale, cx=None, cy=None): """ Create a (un?)distorted CD matrix from the basic inputs. The 'cx' and 'cy' parameters, if given, provide the X and Y coefficients of the distortion as returned by reading the IDCTAB. Only the first 2 elements are used and should correspond to the 'OC...
python
def create_CD(orient, scale, cx=None, cy=None): """ Create a (un?)distorted CD matrix from the basic inputs. The 'cx' and 'cy' parameters, if given, provide the X and Y coefficients of the distortion as returned by reading the IDCTAB. Only the first 2 elements are used and should correspond to the 'OC...
[ "def", "create_CD", "(", "orient", ",", "scale", ",", "cx", "=", "None", ",", "cy", "=", "None", ")", ":", "cxymat", "=", "np", ".", "array", "(", "[", "[", "cx", "[", "1", "]", ",", "cx", "[", "0", "]", "]", ",", "[", "cy", "[", "1", "]"...
Create a (un?)distorted CD matrix from the basic inputs. The 'cx' and 'cy' parameters, if given, provide the X and Y coefficients of the distortion as returned by reading the IDCTAB. Only the first 2 elements are used and should correspond to the 'OC[X/Y]10' and 'OC[X/Y]11' terms in that order as read...
[ "Create", "a", "(", "un?", ")", "distorted", "CD", "matrix", "from", "the", "basic", "inputs", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L170-L186
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
ddtohms
def ddtohms(xsky,ysky,verbose=False,precision=6): """ Convert sky position(s) from decimal degrees to HMS format. """ xskyh = xsky /15. xskym = (xskyh - np.floor(xskyh)) * 60. xskys = (xskym - np.floor(xskym)) * 60. yskym = (np.abs(ysky) - np.floor(np.abs(ysky))) * 60. yskys = (yskym - np.floor(...
python
def ddtohms(xsky,ysky,verbose=False,precision=6): """ Convert sky position(s) from decimal degrees to HMS format. """ xskyh = xsky /15. xskym = (xskyh - np.floor(xskyh)) * 60. xskys = (xskym - np.floor(xskym)) * 60. yskym = (np.abs(ysky) - np.floor(np.abs(ysky))) * 60. yskys = (yskym - np.floor(...
[ "def", "ddtohms", "(", "xsky", ",", "ysky", ",", "verbose", "=", "False", ",", "precision", "=", "6", ")", ":", "xskyh", "=", "xsky", "/", "15.", "xskym", "=", "(", "xskyh", "-", "np", ".", "floor", "(", "xskyh", ")", ")", "*", "60.", "xskys", ...
Convert sky position(s) from decimal degrees to HMS format.
[ "Convert", "sky", "position", "(", "s", ")", "from", "decimal", "degrees", "to", "HMS", "format", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L188-L214
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
make_outputwcs
def make_outputwcs(imageObjectList, output, configObj=None, perfect=False): """ Computes the full output WCS based on the set of input imageObjects provided as input, along with the pre-determined output name from process_input. The user specified output parameters are then used to modify t...
python
def make_outputwcs(imageObjectList, output, configObj=None, perfect=False): """ Computes the full output WCS based on the set of input imageObjects provided as input, along with the pre-determined output name from process_input. The user specified output parameters are then used to modify t...
[ "def", "make_outputwcs", "(", "imageObjectList", ",", "output", ",", "configObj", "=", "None", ",", "perfect", "=", "False", ")", ":", "if", "not", "isinstance", "(", "imageObjectList", ",", "list", ")", ":", "imageObjectList", "=", "[", "imageObjectList", "...
Computes the full output WCS based on the set of input imageObjects provided as input, along with the pre-determined output name from process_input. The user specified output parameters are then used to modify the default WCS to produce the final desired output frame. The input imageObj...
[ "Computes", "the", "full", "output", "WCS", "based", "on", "the", "set", "of", "input", "imageObjects", "provided", "as", "input", "along", "with", "the", "pre", "-", "determined", "output", "name", "from", "process_input", ".", "The", "user", "specified", "...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L258-L352
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
make_perfect_cd
def make_perfect_cd(wcs): """ Create a perfect (square, orthogonal, undistorted) CD matrix from the input WCS. """ def_scale = (wcs.pscale) / 3600. def_orientat = np.deg2rad(wcs.orientat) perfect_cd = def_scale * np.array( [[-np.cos(def_orientat),np.sin(def_orientat)], [np.s...
python
def make_perfect_cd(wcs): """ Create a perfect (square, orthogonal, undistorted) CD matrix from the input WCS. """ def_scale = (wcs.pscale) / 3600. def_orientat = np.deg2rad(wcs.orientat) perfect_cd = def_scale * np.array( [[-np.cos(def_orientat),np.sin(def_orientat)], [np.s...
[ "def", "make_perfect_cd", "(", "wcs", ")", ":", "def_scale", "=", "(", "wcs", ".", "pscale", ")", "/", "3600.", "def_orientat", "=", "np", ".", "deg2rad", "(", "wcs", ".", "orientat", ")", "perfect_cd", "=", "def_scale", "*", "np", ".", "array", "(", ...
Create a perfect (square, orthogonal, undistorted) CD matrix from the input WCS.
[ "Create", "a", "perfect", "(", "square", "orthogonal", "undistorted", ")", "CD", "matrix", "from", "the", "input", "WCS", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L355-L365
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
calcNewEdges
def calcNewEdges(wcs, shape): """ This method will compute sky coordinates for all the pixels around the edge of an image AFTER applying the geometry model. Parameters ---------- wcs : obj HSTWCS object for image shape : tuple numpy shape tuple for size of image Return...
python
def calcNewEdges(wcs, shape): """ This method will compute sky coordinates for all the pixels around the edge of an image AFTER applying the geometry model. Parameters ---------- wcs : obj HSTWCS object for image shape : tuple numpy shape tuple for size of image Return...
[ "def", "calcNewEdges", "(", "wcs", ",", "shape", ")", ":", "naxis1", "=", "shape", "[", "1", "]", "naxis2", "=", "shape", "[", "0", "]", "# build up arrays for pixel positions for the edges", "# These arrays need to be: array([(x,y),(x1,y1),...])", "numpix", "=", "nax...
This method will compute sky coordinates for all the pixels around the edge of an image AFTER applying the geometry model. Parameters ---------- wcs : obj HSTWCS object for image shape : tuple numpy shape tuple for size of image Returns ------- border : arr arr...
[ "This", "method", "will", "compute", "sky", "coordinates", "for", "all", "the", "pixels", "around", "the", "edge", "of", "an", "image", "AFTER", "applying", "the", "geometry", "model", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L368-L433
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
createWCSObject
def createWCSObject(output,default_wcs,imageObjectList): """Converts a PyWCS WCS object into a WCSObject(baseImageObject) instance.""" from . import imageObject outwcs = imageObject.WCSObject(output) outwcs.default_wcs = default_wcs outwcs.wcs = default_wcs.copy() outwcs.final_wcs = default_wcs....
python
def createWCSObject(output,default_wcs,imageObjectList): """Converts a PyWCS WCS object into a WCSObject(baseImageObject) instance.""" from . import imageObject outwcs = imageObject.WCSObject(output) outwcs.default_wcs = default_wcs outwcs.wcs = default_wcs.copy() outwcs.final_wcs = default_wcs....
[ "def", "createWCSObject", "(", "output", ",", "default_wcs", ",", "imageObjectList", ")", ":", "from", ".", "import", "imageObject", "outwcs", "=", "imageObject", ".", "WCSObject", "(", "output", ")", "outwcs", ".", "default_wcs", "=", "default_wcs", "outwcs", ...
Converts a PyWCS WCS object into a WCSObject(baseImageObject) instance.
[ "Converts", "a", "PyWCS", "WCS", "object", "into", "a", "WCSObject", "(", "baseImageObject", ")", "instance", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L451-L469
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
removeAllAltWCS
def removeAllAltWCS(hdulist,extlist): """ Removes all alternate WCS solutions from the header """ original_logging_level = log.level log.setLevel(logutil.logging.WARNING) try: hdr = hdulist[extlist[0]].header wkeys = altwcs.wcskeys(hdr) if ' ' in wkeys: wkeys...
python
def removeAllAltWCS(hdulist,extlist): """ Removes all alternate WCS solutions from the header """ original_logging_level = log.level log.setLevel(logutil.logging.WARNING) try: hdr = hdulist[extlist[0]].header wkeys = altwcs.wcskeys(hdr) if ' ' in wkeys: wkeys...
[ "def", "removeAllAltWCS", "(", "hdulist", ",", "extlist", ")", ":", "original_logging_level", "=", "log", ".", "level", "log", ".", "setLevel", "(", "logutil", ".", "logging", ".", "WARNING", ")", "try", ":", "hdr", "=", "hdulist", "[", "extlist", "[", "...
Removes all alternate WCS solutions from the header
[ "Removes", "all", "alternate", "WCS", "solutions", "from", "the", "header" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L471-L505
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
restoreDefaultWCS
def restoreDefaultWCS(imageObjectList, output_wcs): """ Restore WCS information to default values, and update imageObject accordingly. """ if not isinstance(imageObjectList,list): imageObjectList = [imageObjectList] output_wcs.restoreWCS() updateImageWCS(imageObjectList, output_wcs...
python
def restoreDefaultWCS(imageObjectList, output_wcs): """ Restore WCS information to default values, and update imageObject accordingly. """ if not isinstance(imageObjectList,list): imageObjectList = [imageObjectList] output_wcs.restoreWCS() updateImageWCS(imageObjectList, output_wcs...
[ "def", "restoreDefaultWCS", "(", "imageObjectList", ",", "output_wcs", ")", ":", "if", "not", "isinstance", "(", "imageObjectList", ",", "list", ")", ":", "imageObjectList", "=", "[", "imageObjectList", "]", "output_wcs", ".", "restoreWCS", "(", ")", "updateImag...
Restore WCS information to default values, and update imageObject accordingly.
[ "Restore", "WCS", "information", "to", "default", "values", "and", "update", "imageObject", "accordingly", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L515-L524
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
_py2round
def _py2round(x): """ This function returns a rounded up value of the argument, similar to Python 2. """ if hasattr(x, '__iter__'): rx = np.empty_like(x) m = x >= 0.0 rx[m] = np.floor(x[m] + 0.5) m = np.logical_not(m) rx[m] = np.ceil(x[m] - 0.5) return...
python
def _py2round(x): """ This function returns a rounded up value of the argument, similar to Python 2. """ if hasattr(x, '__iter__'): rx = np.empty_like(x) m = x >= 0.0 rx[m] = np.floor(x[m] + 0.5) m = np.logical_not(m) rx[m] = np.ceil(x[m] - 0.5) return...
[ "def", "_py2round", "(", "x", ")", ":", "if", "hasattr", "(", "x", ",", "'__iter__'", ")", ":", "rx", "=", "np", ".", "empty_like", "(", "x", ")", "m", "=", "x", ">=", "0.0", "rx", "[", "m", "]", "=", "np", ".", "floor", "(", "x", "[", "m",...
This function returns a rounded up value of the argument, similar to Python 2.
[ "This", "function", "returns", "a", "rounded", "up", "value", "of", "the", "argument", "similar", "to", "Python", "2", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L537-L554
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
mergeWCS
def mergeWCS(default_wcs, user_pars): """ Merges the user specified WCS values given as dictionary derived from the input configObj object with the output PyWCS object computed using distortion.output_wcs(). The user_pars dictionary needs to have the following set of keys:: use...
python
def mergeWCS(default_wcs, user_pars): """ Merges the user specified WCS values given as dictionary derived from the input configObj object with the output PyWCS object computed using distortion.output_wcs(). The user_pars dictionary needs to have the following set of keys:: use...
[ "def", "mergeWCS", "(", "default_wcs", ",", "user_pars", ")", ":", "#", "# Start by making a copy of the input WCS...", "#", "outwcs", "=", "default_wcs", ".", "deepcopy", "(", ")", "# If there are no user set parameters, just return a copy of", "# the original WCS:", "if", ...
Merges the user specified WCS values given as dictionary derived from the input configObj object with the output PyWCS object computed using distortion.output_wcs(). The user_pars dictionary needs to have the following set of keys:: user_pars = {'ra':None,'dec':None,'scale':None,'r...
[ "Merges", "the", "user", "specified", "WCS", "values", "given", "as", "dictionary", "derived", "from", "the", "input", "configObj", "object", "with", "the", "output", "PyWCS", "object", "computed", "using", "distortion", ".", "output_wcs", "()", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L580-L708
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
convertWCS
def convertWCS(inwcs,drizwcs): """ Copy WCSObject WCS into Drizzle compatible array.""" drizwcs[0] = inwcs.crpix[0] drizwcs[1] = inwcs.crval[0] drizwcs[2] = inwcs.crpix[1] drizwcs[3] = inwcs.crval[1] drizwcs[4] = inwcs.cd[0][0] drizwcs[5] = inwcs.cd[1][0] drizwcs[6] = inwcs.cd[0][1] ...
python
def convertWCS(inwcs,drizwcs): """ Copy WCSObject WCS into Drizzle compatible array.""" drizwcs[0] = inwcs.crpix[0] drizwcs[1] = inwcs.crval[0] drizwcs[2] = inwcs.crpix[1] drizwcs[3] = inwcs.crval[1] drizwcs[4] = inwcs.cd[0][0] drizwcs[5] = inwcs.cd[1][0] drizwcs[6] = inwcs.cd[0][1] ...
[ "def", "convertWCS", "(", "inwcs", ",", "drizwcs", ")", ":", "drizwcs", "[", "0", "]", "=", "inwcs", ".", "crpix", "[", "0", "]", "drizwcs", "[", "1", "]", "=", "inwcs", ".", "crval", "[", "0", "]", "drizwcs", "[", "2", "]", "=", "inwcs", ".", ...
Copy WCSObject WCS into Drizzle compatible array.
[ "Copy", "WCSObject", "WCS", "into", "Drizzle", "compatible", "array", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L711-L722
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
updateWCS
def updateWCS(drizwcs,inwcs): """ Copy output WCS array from Drizzle into WCSObject.""" crpix = np.array([drizwcs[0],drizwcs[2]], dtype=np.float64) crval = np.array([drizwcs[1],drizwcs[3]], dtype=np.float64) cd = np.array([[drizwcs[4],drizwcs[6]],[drizwcs[5],drizwcs[7]]], dtype=np.float64) inwcs.cd ...
python
def updateWCS(drizwcs,inwcs): """ Copy output WCS array from Drizzle into WCSObject.""" crpix = np.array([drizwcs[0],drizwcs[2]], dtype=np.float64) crval = np.array([drizwcs[1],drizwcs[3]], dtype=np.float64) cd = np.array([[drizwcs[4],drizwcs[6]],[drizwcs[5],drizwcs[7]]], dtype=np.float64) inwcs.cd ...
[ "def", "updateWCS", "(", "drizwcs", ",", "inwcs", ")", ":", "crpix", "=", "np", ".", "array", "(", "[", "drizwcs", "[", "0", "]", ",", "drizwcs", "[", "2", "]", "]", ",", "dtype", "=", "np", ".", "float64", ")", "crval", "=", "np", ".", "array"...
Copy output WCS array from Drizzle into WCSObject.
[ "Copy", "output", "WCS", "array", "from", "Drizzle", "into", "WCSObject", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L724-L733
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
wcsfit
def wcsfit(img_wcs, ref_wcs): """ Perform a linear fit between 2 WCS for shift, rotation and scale. Based on the WCSLIN function from 'drutil.f'(Drizzle V2.9) and modified to allow for differences in reference positions assumed by PyDrizzle's distortion model and the coeffs used by 'drizzle'. P...
python
def wcsfit(img_wcs, ref_wcs): """ Perform a linear fit between 2 WCS for shift, rotation and scale. Based on the WCSLIN function from 'drutil.f'(Drizzle V2.9) and modified to allow for differences in reference positions assumed by PyDrizzle's distortion model and the coeffs used by 'drizzle'. P...
[ "def", "wcsfit", "(", "img_wcs", ",", "ref_wcs", ")", ":", "# Define objects that we need to use for the fit...", "#in_refpix = img_geom.model.refpix", "wmap", "=", "WCSMap", "(", "img_wcs", ",", "ref_wcs", ")", "cx", ",", "cy", "=", "coeff_converter", ".", "sip2idc",...
Perform a linear fit between 2 WCS for shift, rotation and scale. Based on the WCSLIN function from 'drutil.f'(Drizzle V2.9) and modified to allow for differences in reference positions assumed by PyDrizzle's distortion model and the coeffs used by 'drizzle'. Parameters ---------- img : obj ...
[ "Perform", "a", "linear", "fit", "between", "2", "WCS", "for", "shift", "rotation", "and", "scale", ".", "Based", "on", "the", "WCSLIN", "function", "from", "drutil", ".", "f", "(", "Drizzle", "V2", ".", "9", ")", "and", "modified", "to", "allow", "for...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L736-L803
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
fitlin
def fitlin(imgarr,refarr): """ Compute the least-squares fit between two arrays. A Python translation of 'FITLIN' from 'drutil.f' (Drizzle V2.9). """ # Initialize variables _mat = np.zeros((3,3),dtype=np.float64) _xorg = imgarr[0][0] _yorg = imgarr[0][1] _xoorg = refarr[0][0] _yo...
python
def fitlin(imgarr,refarr): """ Compute the least-squares fit between two arrays. A Python translation of 'FITLIN' from 'drutil.f' (Drizzle V2.9). """ # Initialize variables _mat = np.zeros((3,3),dtype=np.float64) _xorg = imgarr[0][0] _yorg = imgarr[0][1] _xoorg = refarr[0][0] _yo...
[ "def", "fitlin", "(", "imgarr", ",", "refarr", ")", ":", "# Initialize variables", "_mat", "=", "np", ".", "zeros", "(", "(", "3", ",", "3", ")", ",", "dtype", "=", "np", ".", "float64", ")", "_xorg", "=", "imgarr", "[", "0", "]", "[", "0", "]", ...
Compute the least-squares fit between two arrays. A Python translation of 'FITLIN' from 'drutil.f' (Drizzle V2.9).
[ "Compute", "the", "least", "-", "squares", "fit", "between", "two", "arrays", ".", "A", "Python", "translation", "of", "FITLIN", "from", "drutil", ".", "f", "(", "Drizzle", "V2", ".", "9", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L806-L858
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
fitlin_rscale
def fitlin_rscale(xy,uv,verbose=False): """ Performs a linear, orthogonal fit between matched lists of positions 'xy' (input) and 'uv' (output). Output: (same as for fit_arrays_general) """ mu = uv[:,0].mean() mv = uv[:,1].mean() mx = xy[:,0].mean() my = xy[:,1].mean() u = ...
python
def fitlin_rscale(xy,uv,verbose=False): """ Performs a linear, orthogonal fit between matched lists of positions 'xy' (input) and 'uv' (output). Output: (same as for fit_arrays_general) """ mu = uv[:,0].mean() mv = uv[:,1].mean() mx = xy[:,0].mean() my = xy[:,1].mean() u = ...
[ "def", "fitlin_rscale", "(", "xy", ",", "uv", ",", "verbose", "=", "False", ")", ":", "mu", "=", "uv", "[", ":", ",", "0", "]", ".", "mean", "(", ")", "mv", "=", "uv", "[", ":", ",", "1", "]", ".", "mean", "(", ")", "mx", "=", "xy", "[", ...
Performs a linear, orthogonal fit between matched lists of positions 'xy' (input) and 'uv' (output). Output: (same as for fit_arrays_general)
[ "Performs", "a", "linear", "orthogonal", "fit", "between", "matched", "lists", "of", "positions", "xy", "(", "input", ")", "and", "uv", "(", "output", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L861-L903
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
fitlin_clipped
def fitlin_clipped(xy,uv,verbose=False,mode='rscale',nclip=3,reject=3): """ Perform a clipped fit based on the number of iterations and rejection limit (in sigma) specified by the user. This will more closely replicate the results obtained by 'geomap' using 'maxiter' and 'reject' parameters. """...
python
def fitlin_clipped(xy,uv,verbose=False,mode='rscale',nclip=3,reject=3): """ Perform a clipped fit based on the number of iterations and rejection limit (in sigma) specified by the user. This will more closely replicate the results obtained by 'geomap' using 'maxiter' and 'reject' parameters. """...
[ "def", "fitlin_clipped", "(", "xy", ",", "uv", ",", "verbose", "=", "False", ",", "mode", "=", "'rscale'", ",", "nclip", "=", "3", ",", "reject", "=", "3", ")", ":", "fitting_funcs", "=", "{", "'rscale'", ":", "fitlin_rscale", ",", "'general'", ":", ...
Perform a clipped fit based on the number of iterations and rejection limit (in sigma) specified by the user. This will more closely replicate the results obtained by 'geomap' using 'maxiter' and 'reject' parameters.
[ "Perform", "a", "clipped", "fit", "based", "on", "the", "number", "of", "iterations", "and", "rejection", "limit", "(", "in", "sigma", ")", "specified", "by", "the", "user", ".", "This", "will", "more", "closely", "replicate", "the", "results", "obtained", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L905-L980
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
readAltWCS
def readAltWCS(fobj, ext, wcskey=' ', verbose=False): """ Reads in alternate primary WCS from specified extension. Parameters ---------- fobj : str, `astropy.io.fits.HDUList` fits filename or fits file object containing alternate/primary WCS(s) to be converted wcskey : str ...
python
def readAltWCS(fobj, ext, wcskey=' ', verbose=False): """ Reads in alternate primary WCS from specified extension. Parameters ---------- fobj : str, `astropy.io.fits.HDUList` fits filename or fits file object containing alternate/primary WCS(s) to be converted wcskey : str ...
[ "def", "readAltWCS", "(", "fobj", ",", "ext", ",", "wcskey", "=", "' '", ",", "verbose", "=", "False", ")", ":", "if", "isinstance", "(", "fobj", ",", "str", ")", ":", "fobj", "=", "fits", ".", "open", "(", "fobj", ",", "memmap", "=", "False", ")...
Reads in alternate primary WCS from specified extension. Parameters ---------- fobj : str, `astropy.io.fits.HDUList` fits filename or fits file object containing alternate/primary WCS(s) to be converted wcskey : str [" ",A-Z] alternate/primary WCS key that will be replac...
[ "Reads", "in", "alternate", "primary", "WCS", "from", "specified", "extension", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L995-L1036
spacetelescope/drizzlepac
drizzlepac/wcs_functions.py
WCSMap.forward
def forward(self,pixx,pixy): """ Transform the input pixx,pixy positions in the input frame to pixel positions in the output frame. This method gets passed to the drizzle algorithm. """ # This matches WTRAXY results to better than 1e-4 pixels. skyx,skyy = self.in...
python
def forward(self,pixx,pixy): """ Transform the input pixx,pixy positions in the input frame to pixel positions in the output frame. This method gets passed to the drizzle algorithm. """ # This matches WTRAXY results to better than 1e-4 pixels. skyx,skyy = self.in...
[ "def", "forward", "(", "self", ",", "pixx", ",", "pixy", ")", ":", "# This matches WTRAXY results to better than 1e-4 pixels.", "skyx", ",", "skyy", "=", "self", ".", "input", ".", "all_pix2world", "(", "pixx", ",", "pixy", ",", "self", ".", "origin", ")", "...
Transform the input pixx,pixy positions in the input frame to pixel positions in the output frame. This method gets passed to the drizzle algorithm.
[ "Transform", "the", "input", "pixx", "pixy", "positions", "in", "the", "input", "frame", "to", "pixel", "positions", "in", "the", "output", "frame", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L53-L62