repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L470-L479 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L497-L509 | train |
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",
"]",
"filename",
"=",
"fileutil",
".",
"osfn",
"(",
"self",
".",
"_image",
"[",
"\"PRIMARY\"",
"]",
".",
"heade... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L514-L562 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L647-L662 | train |
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",
".",
"_image",
"[",
"self",
".",
"scienceExt",
",",
"chip",
"]... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L722-L732 | train |
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... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L734-L779 | train |
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",
"]",
"errmask",
"=",
"dqarr",
"if",
"self",
".",
"errExt",
"is",
"not",
"None"... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L781-L839 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L846-L854 | train |
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",
"_parval",
"=",
"'unity'",
"if",
"wtscl_par",
"is",
"not",
"None",
... | Sets the value of the wt_scl parameter as needed for drizzling. | [
"Sets",
"the",
"value",
"of",
"the",
"wt_scl",
"parameter",
"as",
"needed",
"for",
"drizzling",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L856-L892 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L929-L939 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L941-L955 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L1151-L1168 | train |
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",
")",
":",
"sci_chip",
"=",
"self",
".",
"_image",
"[",
"self",
".",
"scienceExt",
",",
"chip",
"]",
"_bunit",
"=",
"None",
"if",
"'BUNIT'",
"in",
"sci_chip",
".",
"header",
"and",
"sci_chip",
".",
"header",... | Define units for this image. | [
"Define",
"units",
"for",
"this",
"image",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L1170-L1188 | train |
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",
":",
"newhdrs",
",",
"newt... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L680-L694 | train |
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'",
"hdr",... | Update input header 'hdr' with WCS keywords. | [
"Update",
"input",
"header",
"hdr",
"with",
"WCS",
"keywords",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L696-L729 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L743-L811 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L813-L827 | train |
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",
")",
":",
"kw_list",
"=",
"None",
"last_kw",
"=",
"None",
"for",
"extn",
"in",
"self",
".",
"fullhdrs",
":",
"if",
"keyword",
"in",
"extn",
":",
"indx",
"=",
"extn",
".",
"index"... | 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",
... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L550-L582 | train |
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",
")",
":",
"_geom",
"=",
"'User parameters'",
"_imgnum",
"=",
"0",
"for",
"pl",
"in",
"self",
".",
"parlist",
":",
"_imgnum",
"+=",
"1",
"drizdict",
"=",
"DRIZ_KEYWORDS",
".",
"copy",
"("... | Add drizzle parameter keywords to header. | [
"Add",
"drizzle",
"parameter",
"keywords",
"to",
"header",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/outputimage.py#L585-L649 | train |
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",
"for",
"n",
"in",
"range",
"("... | Perform an iterative-fit with 'nclip' iterations | [
"Perform",
"an",
"iterative",
"-",
"fit",
"with",
"nclip",
"iterations"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L35-L54 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L150-L185 | train |
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",
")",
":",
"xy",
"=",
"np",
".",
"array",
"(",
"xy",
")",
"if",
"not",
"isinstance",
"(",
"uv",
",",
"np",
".",
"ndarray",
")",... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L272-L340 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L448-L458 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L461-L467 | train |
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",
")",
":",
"if",
"isinstance",
"(",
"configobj",
",",
"("... | AstroDrizzle command-line interface | [
"AstroDrizzle",
"command",
"-",
"line",
"interface"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/astrodrizzle.py#L59-L118 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/astrodrizzle.py#L303-L341 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L112-L141 | train |
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",
")",
":",
"_handle",
"=",
"fileutil",
".",
"openImage",
"(",
"self",
".",
"_filename",
",",
"mode",
"=",
"'readonly'",
",",
"memmap",
"=",
"False",
")",
"for",
"chip",
"in",
"self",
".",
"returnAllChips",
"(",
"ex... | 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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wfc3Data.py#L165-L184 | train |
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",
... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/acsData.py#L58-L88 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/acsData.py#L232-L278 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/minmed.py#L336-L346 | train |
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",
")",
":",
"s4m",
"=",
"np",
".",
"ones",
"(",
"(",
"nyk",
",",
"nxk",
")",
",",
"dtype",
"=",
"np",
".",
"int16",
")",
"s4m",
"[",
"yc",
",",
"xc",
"]",
"=",
"0",
... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/findobj.py#L353-L368 | train |
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",
")",
":",
"_fileName",
"=",
"files",
"[",
"0",
"]",
"_header",
"=",
"fileutil",
".",
"getHeader",
"(",
"_fileName",
")",
"if",
"'MDRIZTAB'",
"in",
"_header",
":",
"_tableName",
"=",
"_header",
"[",
"'MDRIZTAB'",
... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mdzhandler.py#L17-L76 | train |
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",
"indx",
"in",
"range",
"(",
"len",
"(",
"rec",
".",
"array",
".",
"names",
")",
")",
":",
"_name",
"=",
"rec",
".",
"array",
".",
"names",
"[",
"indx",
"]",
"... | 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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mdzhandler.py#L86-L158 | train |
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",
")",
":",
"user_wcs_pars",
"=",
"convert_user_pars",
"(",
"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 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",
"... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L75-L219 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L221-L229 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L231-L238 | train |
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",
")",
":",
"if",
"outwcs",
".",
"sip",
"is",
"not",
"None",
":",
"wcslin",
"=",
"stwcs",
".",
"distortion",
".",
"utils",
".",
"undistortWCS",
"(",
"outwcs",
")",
"outwcs",
".",
"wcs",
... | 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",
... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L240-L282 | train |
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",
")",
":",
"if",
"'ocx10'",
"in",
"refwcs",
".",
"__dict__",
"and",
"refwcs",
".",
"ocx10",
"is",
"not",
"None",
":",
"linmat",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"refwcs",
".",
"ocx11",
",",
"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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L292-L304 | train |
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!'",
")",
"wcslin",
"=",
"stwcs",
"... | 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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L306-L326 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L328-L346 | train |
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",
")",
":",
"siphdr",
"=",
"True",
"if",
"outwcs",
".",
"sip",
"is",
"None",
":",
"siphdr",
"=",
"False",
"outwcs_hdr",
"=",
"outwcs",
".",
"wcs2heade... | 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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildwcs.py#L348-L394 | train |
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",
")",
":",
"tmpArray",
"=",
"np",
".",
"zeros",
"(",
"array",
".",
"shape",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"outArray",
"=",
"np",
".",
"zeros",
"(",
"array",
".",
"shape",
",",
"dtype",
"=",
"np",
".",... | Take the absolute derivate of an image in memory. | [
"Take",
"the",
"absolute",
"derivate",
"of",
"an",
"image",
"in",
"memory",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/quickDeriv.py#L18-L58 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L125-L132 | train |
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",
"]",
"numpix",
"=",
"naxis1",
"*",
"2",
"+",
"naxis2",
"*",
"2",
"border",
"=",
"np",
".",
"zeros",
"(",
"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
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L368-L433 | train |
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"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L471-L505 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L515-L524 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L537-L554 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L711-L722 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L724-L733 | train |
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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L995-L1036 | train |
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",
")",
":",
"skyx",
",",
"skyy",
"=",
"self",
".",
"input",
".",
"all_pix2world",
"(",
"pixx",
",",
"pixy",
",",
"self",
".",
"origin",
")",
"result",
"=",
"self",
".",
"output",
".",
"wcs_worl... | 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",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L53-L62 | train |
spacetelescope/drizzlepac | drizzlepac/wcs_functions.py | WCSMap.backward | def backward(self,pixx,pixy):
""" Transform pixx,pixy positions from the output frame back onto their
original positions in the input frame.
"""
skyx,skyy = self.output.wcs_pix2world(pixx,pixy,self.origin)
result = self.input.all_world2pix(skyx,skyy,self.origin)
retur... | python | def backward(self,pixx,pixy):
""" Transform pixx,pixy positions from the output frame back onto their
original positions in the input frame.
"""
skyx,skyy = self.output.wcs_pix2world(pixx,pixy,self.origin)
result = self.input.all_world2pix(skyx,skyy,self.origin)
retur... | [
"def",
"backward",
"(",
"self",
",",
"pixx",
",",
"pixy",
")",
":",
"skyx",
",",
"skyy",
"=",
"self",
".",
"output",
".",
"wcs_pix2world",
"(",
"pixx",
",",
"pixy",
",",
"self",
".",
"origin",
")",
"result",
"=",
"self",
".",
"input",
".",
"all_wor... | Transform pixx,pixy positions from the output frame back onto their
original positions in the input frame. | [
"Transform",
"pixx",
"pixy",
"positions",
"from",
"the",
"output",
"frame",
"back",
"onto",
"their",
"original",
"positions",
"in",
"the",
"input",
"frame",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/wcs_functions.py#L64-L70 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | createMask | def createMask(input=None, static_sig=4.0, group=None, editpars=False, configObj=None, **inputDict):
""" The user can input a list of images if they like to create static masks
as well as optional values for static_sig and inputDict.
The configObj.cfg file will set the defaults and then override th... | python | def createMask(input=None, static_sig=4.0, group=None, editpars=False, configObj=None, **inputDict):
""" The user can input a list of images if they like to create static masks
as well as optional values for static_sig and inputDict.
The configObj.cfg file will set the defaults and then override th... | [
"def",
"createMask",
"(",
"input",
"=",
"None",
",",
"static_sig",
"=",
"4.0",
",",
"group",
"=",
"None",
",",
"editpars",
"=",
"False",
",",
"configObj",
"=",
"None",
",",
"**",
"inputDict",
")",
":",
"if",
"input",
"is",
"not",
"None",
":",
"inputD... | The user can input a list of images if they like to create static masks
as well as optional values for static_sig and inputDict.
The configObj.cfg file will set the defaults and then override them
with the user options. | [
"The",
"user",
"can",
"input",
"a",
"list",
"of",
"images",
"if",
"they",
"like",
"to",
"create",
"static",
"masks",
"as",
"well",
"as",
"optional",
"values",
"for",
"static_sig",
"and",
"inputDict",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L32-L55 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.addMember | def addMember(self, imagePtr=None):
"""
Combines the input image with the static mask that
has the same signature.
Parameters
----------
imagePtr : object
An imageObject reference
Notes
-----
The signature parameter consists of the tu... | python | def addMember(self, imagePtr=None):
"""
Combines the input image with the static mask that
has the same signature.
Parameters
----------
imagePtr : object
An imageObject reference
Notes
-----
The signature parameter consists of the tu... | [
"def",
"addMember",
"(",
"self",
",",
"imagePtr",
"=",
"None",
")",
":",
"numchips",
"=",
"imagePtr",
".",
"_numchips",
"log",
".",
"info",
"(",
"\"Computing static mask:\\n\"",
")",
"chips",
"=",
"imagePtr",
".",
"group",
"if",
"chips",
"is",
"None",
":",... | Combines the input image with the static mask that
has the same signature.
Parameters
----------
imagePtr : object
An imageObject reference
Notes
-----
The signature parameter consists of the tuple::
(instrument/detector, (nx,ny), chip_i... | [
"Combines",
"the",
"input",
"image",
"with",
"the",
"static",
"mask",
"that",
"has",
"the",
"same",
"signature",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L145-L205 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.getMaskArray | def getMaskArray(self, signature):
""" Returns the appropriate StaticMask array for the image. """
if signature in self.masklist:
mask = self.masklist[signature]
else:
mask = None
return mask | python | def getMaskArray(self, signature):
""" Returns the appropriate StaticMask array for the image. """
if signature in self.masklist:
mask = self.masklist[signature]
else:
mask = None
return mask | [
"def",
"getMaskArray",
"(",
"self",
",",
"signature",
")",
":",
"if",
"signature",
"in",
"self",
".",
"masklist",
":",
"mask",
"=",
"self",
".",
"masklist",
"[",
"signature",
"]",
"else",
":",
"mask",
"=",
"None",
"return",
"mask"
] | Returns the appropriate StaticMask array for the image. | [
"Returns",
"the",
"appropriate",
"StaticMask",
"array",
"for",
"the",
"image",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L211-L217 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.getFilename | def getFilename(self,signature):
"""Returns the name of the output mask file that
should reside on disk for the given signature. """
filename=constructFilename(signature)
if(fileutil.checkFileExists(filename)):
return filename
else:
print("\nmMask file f... | python | def getFilename(self,signature):
"""Returns the name of the output mask file that
should reside on disk for the given signature. """
filename=constructFilename(signature)
if(fileutil.checkFileExists(filename)):
return filename
else:
print("\nmMask file f... | [
"def",
"getFilename",
"(",
"self",
",",
"signature",
")",
":",
"filename",
"=",
"constructFilename",
"(",
"signature",
")",
"if",
"(",
"fileutil",
".",
"checkFileExists",
"(",
"filename",
")",
")",
":",
"return",
"filename",
"else",
":",
"print",
"(",
"\"\... | Returns the name of the output mask file that
should reside on disk for the given signature. | [
"Returns",
"the",
"name",
"of",
"the",
"output",
"mask",
"file",
"that",
"should",
"reside",
"on",
"disk",
"for",
"the",
"given",
"signature",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L219-L229 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.close | def close(self):
""" Deletes all static mask objects. """
for key in self.masklist.keys():
self.masklist[key] = None
self.masklist = {} | python | def close(self):
""" Deletes all static mask objects. """
for key in self.masklist.keys():
self.masklist[key] = None
self.masklist = {} | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"masklist",
".",
"keys",
"(",
")",
":",
"self",
".",
"masklist",
"[",
"key",
"]",
"=",
"None",
"self",
".",
"masklist",
"=",
"{",
"}"
] | Deletes all static mask objects. | [
"Deletes",
"all",
"static",
"mask",
"objects",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L241-L246 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.deleteMask | def deleteMask(self,signature):
""" Delete just the mask that matches the signature given."""
if signature in self.masklist:
self.masklist[signature] = None
else:
log.warning("No matching mask") | python | def deleteMask(self,signature):
""" Delete just the mask that matches the signature given."""
if signature in self.masklist:
self.masklist[signature] = None
else:
log.warning("No matching mask") | [
"def",
"deleteMask",
"(",
"self",
",",
"signature",
")",
":",
"if",
"signature",
"in",
"self",
".",
"masklist",
":",
"self",
".",
"masklist",
"[",
"signature",
"]",
"=",
"None",
"else",
":",
"log",
".",
"warning",
"(",
"\"No matching mask\"",
")"
] | Delete just the mask that matches the signature given. | [
"Delete",
"just",
"the",
"mask",
"that",
"matches",
"the",
"signature",
"given",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L248-L253 | train |
spacetelescope/drizzlepac | drizzlepac/staticMask.py | staticMask.saveToFile | def saveToFile(self,imageObjectList):
""" Saves the static mask to a file
it uses the signatures associated with each
mask to contruct the filename for the output mask image.
"""
virtual = imageObjectList[0].inmemory
for key in self.masklist.keys():
#... | python | def saveToFile(self,imageObjectList):
""" Saves the static mask to a file
it uses the signatures associated with each
mask to contruct the filename for the output mask image.
"""
virtual = imageObjectList[0].inmemory
for key in self.masklist.keys():
#... | [
"def",
"saveToFile",
"(",
"self",
",",
"imageObjectList",
")",
":",
"virtual",
"=",
"imageObjectList",
"[",
"0",
"]",
".",
"inmemory",
"for",
"key",
"in",
"self",
".",
"masklist",
".",
"keys",
"(",
")",
":",
"filename",
"=",
"self",
".",
"masknames",
"... | Saves the static mask to a file
it uses the signatures associated with each
mask to contruct the filename for the output mask image. | [
"Saves",
"the",
"static",
"mask",
"to",
"a",
"file",
"it",
"uses",
"the",
"signatures",
"associated",
"with",
"each",
"mask",
"to",
"contruct",
"the",
"filename",
"for",
"the",
"output",
"mask",
"image",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L255-L282 | train |
spacetelescope/drizzlepac | drizzlepac/stisData.py | expand_image | def expand_image(image, shape):
""" Expand image from original shape to requested shape. Output shape
must be an integer multiple of input image shape for each axis. """
if (shape[0] % image.shape[0]) or (shape[1] % image.shape[1]):
raise ValueError("Output shape must be an integer multiple of input... | python | def expand_image(image, shape):
""" Expand image from original shape to requested shape. Output shape
must be an integer multiple of input image shape for each axis. """
if (shape[0] % image.shape[0]) or (shape[1] % image.shape[1]):
raise ValueError("Output shape must be an integer multiple of input... | [
"def",
"expand_image",
"(",
"image",
",",
"shape",
")",
":",
"if",
"(",
"shape",
"[",
"0",
"]",
"%",
"image",
".",
"shape",
"[",
"0",
"]",
")",
"or",
"(",
"shape",
"[",
"1",
"]",
"%",
"image",
".",
"shape",
"[",
"1",
"]",
")",
":",
"raise",
... | Expand image from original shape to requested shape. Output shape
must be an integer multiple of input image shape for each axis. | [
"Expand",
"image",
"from",
"original",
"shape",
"to",
"requested",
"shape",
".",
"Output",
"shape",
"must",
"be",
"an",
"integer",
"multiple",
"of",
"input",
"image",
"shape",
"for",
"each",
"axis",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/stisData.py#L415-L433 | train |
spacetelescope/drizzlepac | drizzlepac/stisData.py | bilinear_interp | def bilinear_interp(data, x, y):
""" Interpolate input ``data`` at "pixel" coordinates ``x`` and ``y``. """
x = np.asarray(x)
y = np.asarray(y)
if x.shape != y.shape:
raise ValueError("X- and Y-coordinates must have identical shapes.")
out_shape = x.shape
out_size = x.size
x = x.rav... | python | def bilinear_interp(data, x, y):
""" Interpolate input ``data`` at "pixel" coordinates ``x`` and ``y``. """
x = np.asarray(x)
y = np.asarray(y)
if x.shape != y.shape:
raise ValueError("X- and Y-coordinates must have identical shapes.")
out_shape = x.shape
out_size = x.size
x = x.rav... | [
"def",
"bilinear_interp",
"(",
"data",
",",
"x",
",",
"y",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"y",
"=",
"np",
".",
"asarray",
"(",
"y",
")",
"if",
"x",
".",
"shape",
"!=",
"y",
".",
"shape",
":",
"raise",
"ValueError",
"... | Interpolate input ``data`` at "pixel" coordinates ``x`` and ``y``. | [
"Interpolate",
"input",
"data",
"at",
"pixel",
"coordinates",
"x",
"and",
"y",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/stisData.py#L436-L467 | train |
spacetelescope/drizzlepac | drizzlepac/stisData.py | STISInputImage.getflat | def getflat(self, chip):
"""
Method for retrieving a detector's flat field. For STIS there are three.
This method will return an array the same shape as the image.
"""
sci_chip = self._image[self.scienceExt,chip]
exten = self.errExt+','+str(chip)
# The keyword f... | python | def getflat(self, chip):
"""
Method for retrieving a detector's flat field. For STIS there are three.
This method will return an array the same shape as the image.
"""
sci_chip = self._image[self.scienceExt,chip]
exten = self.errExt+','+str(chip)
# The keyword f... | [
"def",
"getflat",
"(",
"self",
",",
"chip",
")",
":",
"sci_chip",
"=",
"self",
".",
"_image",
"[",
"self",
".",
"scienceExt",
",",
"chip",
"]",
"exten",
"=",
"self",
".",
"errExt",
"+",
"','",
"+",
"str",
"(",
"chip",
")",
"lflatfile",
"=",
"fileut... | Method for retrieving a detector's flat field. For STIS there are three.
This method will return an array the same shape as the image. | [
"Method",
"for",
"retrieving",
"a",
"detector",
"s",
"flat",
"field",
".",
"For",
"STIS",
"there",
"are",
"three",
".",
"This",
"method",
"will",
"return",
"an",
"array",
"the",
"same",
"shape",
"as",
"the",
"image",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/stisData.py#L28-L66 | train |
spacetelescope/drizzlepac | drizzlepac/stisData.py | STISInputImage._assignSignature | def _assignSignature(self, chip):
"""Assign a unique signature for the image based
on the instrument, detector, chip, and size
this will be used to uniquely identify the appropriate
static mask for the image.
This also records the filename for the static mask to the... | python | def _assignSignature(self, chip):
"""Assign a unique signature for the image based
on the instrument, detector, chip, and size
this will be used to uniquely identify the appropriate
static mask for the image.
This also records the filename for the static mask to the... | [
"def",
"_assignSignature",
"(",
"self",
",",
"chip",
")",
":",
"sci_chip",
"=",
"self",
".",
"_image",
"[",
"self",
".",
"scienceExt",
",",
"chip",
"]",
"ny",
"=",
"sci_chip",
".",
"_naxis1",
"nx",
"=",
"sci_chip",
".",
"_naxis2",
"detnum",
"=",
"sci_c... | Assign a unique signature for the image based
on the instrument, detector, chip, and size
this will be used to uniquely identify the appropriate
static mask for the image.
This also records the filename for the static mask to the outputNames dictionary. | [
"Assign",
"a",
"unique",
"signature",
"for",
"the",
"image",
"based",
"on",
"the",
"instrument",
"detector",
"chip",
"and",
"size",
"this",
"will",
"be",
"used",
"to",
"uniquely",
"identify",
"the",
"appropriate",
"static",
"mask",
"for",
"the",
"image",
"."... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/stisData.py#L97-L113 | train |
spacetelescope/drizzlepac | drizzlepac/stisData.py | NUVInputImage.doUnitConversions | def doUnitConversions(self):
"""Convert the data to electrons.
This converts all science data extensions and saves
the results back to disk. We need to make sure
the data inside the chips already in memory is altered as well.
"""
for det in range(1,self._numchips+1,1):
... | python | def doUnitConversions(self):
"""Convert the data to electrons.
This converts all science data extensions and saves
the results back to disk. We need to make sure
the data inside the chips already in memory is altered as well.
"""
for det in range(1,self._numchips+1,1):
... | [
"def",
"doUnitConversions",
"(",
"self",
")",
":",
"for",
"det",
"in",
"range",
"(",
"1",
",",
"self",
".",
"_numchips",
"+",
"1",
",",
"1",
")",
":",
"chip",
"=",
"self",
".",
"_image",
"[",
"self",
".",
"scienceExt",
",",
"det",
"]",
"conversionF... | Convert the data to electrons.
This converts all science data extensions and saves
the results back to disk. We need to make sure
the data inside the chips already in memory is altered as well. | [
"Convert",
"the",
"data",
"to",
"electrons",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/stisData.py#L286-L301 | train |
spacetelescope/drizzlepac | drizzlepac/drizCR.py | drizCR | def drizCR(input=None, configObj=None, editpars=False, **inputDict):
""" Look for cosmic rays. """
log.debug(inputDict)
inputDict["input"] = input
configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict,
loadOnly=(not editpars))
if configObj i... | python | def drizCR(input=None, configObj=None, editpars=False, **inputDict):
""" Look for cosmic rays. """
log.debug(inputDict)
inputDict["input"] = input
configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict,
loadOnly=(not editpars))
if configObj i... | [
"def",
"drizCR",
"(",
"input",
"=",
"None",
",",
"configObj",
"=",
"None",
",",
"editpars",
"=",
"False",
",",
"**",
"inputDict",
")",
":",
"log",
".",
"debug",
"(",
"inputDict",
")",
"inputDict",
"[",
"\"input\"",
"]",
"=",
"input",
"configObj",
"=",
... | Look for cosmic rays. | [
"Look",
"for",
"cosmic",
"rays",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/drizCR.py#L34-L44 | train |
spacetelescope/drizzlepac | drizzlepac/drizCR.py | createCorrFile | def createCorrFile(outfile, arrlist, template):
"""
Create a _cor file with the same format as the original input image.
The DQ array will be replaced with the mask array used to create the _cor
file.
"""
# Remove the existing cor file if it exists
if os.path.isfile(outfile):
os.rem... | python | def createCorrFile(outfile, arrlist, template):
"""
Create a _cor file with the same format as the original input image.
The DQ array will be replaced with the mask array used to create the _cor
file.
"""
# Remove the existing cor file if it exists
if os.path.isfile(outfile):
os.rem... | [
"def",
"createCorrFile",
"(",
"outfile",
",",
"arrlist",
",",
"template",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"outfile",
")",
":",
"os",
".",
"remove",
"(",
"outfile",
")",
"print",
"(",
"\"Removing old corr file: '{:s}'\"",
".",
"format... | Create a _cor file with the same format as the original input image.
The DQ array will be replaced with the mask array used to create the _cor
file. | [
"Create",
"a",
"_cor",
"file",
"with",
"the",
"same",
"format",
"as",
"the",
"original",
"input",
"image",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/drizCR.py#L300-L318 | train |
spacetelescope/drizzlepac | drizzlepac/drizCR.py | setDefaults | def setDefaults(configObj={}):
""" Return a dictionary of the default parameters
which also been updated with the user overrides.
"""
paramDict = {
'gain': 7, # Detector gain, e-/ADU
'grow': 1, # Radius around CR pixel to mask [default=1 for
... | python | def setDefaults(configObj={}):
""" Return a dictionary of the default parameters
which also been updated with the user overrides.
"""
paramDict = {
'gain': 7, # Detector gain, e-/ADU
'grow': 1, # Radius around CR pixel to mask [default=1 for
... | [
"def",
"setDefaults",
"(",
"configObj",
"=",
"{",
"}",
")",
":",
"paramDict",
"=",
"{",
"'gain'",
":",
"7",
",",
"'grow'",
":",
"1",
",",
"'ctegrow'",
":",
"0",
",",
"'rn'",
":",
"5",
",",
"'snr'",
":",
"'4.0 3.0'",
",",
"'scale'",
":",
"'0.5 0.4'"... | Return a dictionary of the default parameters
which also been updated with the user overrides. | [
"Return",
"a",
"dictionary",
"of",
"the",
"default",
"parameters",
"which",
"also",
"been",
"updated",
"with",
"the",
"user",
"overrides",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/drizCR.py#L321-L341 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | getMdriztabPars | def getMdriztabPars(input):
""" High-level function for getting the parameters from MDRIZTAB
Used primarily for TEAL interface.
"""
filelist,output,ivmlist,oldasndict=processFilenames(input,None)
try:
mdrizdict = mdzhandler.getMdriztabParameters(filelist)
except KeyError:
print... | python | def getMdriztabPars(input):
""" High-level function for getting the parameters from MDRIZTAB
Used primarily for TEAL interface.
"""
filelist,output,ivmlist,oldasndict=processFilenames(input,None)
try:
mdrizdict = mdzhandler.getMdriztabParameters(filelist)
except KeyError:
print... | [
"def",
"getMdriztabPars",
"(",
"input",
")",
":",
"filelist",
",",
"output",
",",
"ivmlist",
",",
"oldasndict",
"=",
"processFilenames",
"(",
"input",
",",
"None",
")",
"try",
":",
"mdrizdict",
"=",
"mdzhandler",
".",
"getMdriztabParameters",
"(",
"filelist",
... | High-level function for getting the parameters from MDRIZTAB
Used primarily for TEAL interface. | [
"High",
"-",
"level",
"function",
"for",
"getting",
"the",
"parameters",
"from",
"MDRIZTAB"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L298-L311 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | addIVMInputs | def addIVMInputs(imageObjectList,ivmlist):
""" Add IVM filenames provided by user to outputNames dictionary for each input imageObject.
"""
if ivmlist is None:
return
for img,ivmname in zip(imageObjectList,ivmlist):
img.updateIVMName(ivmname) | python | def addIVMInputs(imageObjectList,ivmlist):
""" Add IVM filenames provided by user to outputNames dictionary for each input imageObject.
"""
if ivmlist is None:
return
for img,ivmname in zip(imageObjectList,ivmlist):
img.updateIVMName(ivmname) | [
"def",
"addIVMInputs",
"(",
"imageObjectList",
",",
"ivmlist",
")",
":",
"if",
"ivmlist",
"is",
"None",
":",
"return",
"for",
"img",
",",
"ivmname",
"in",
"zip",
"(",
"imageObjectList",
",",
"ivmlist",
")",
":",
"img",
".",
"updateIVMName",
"(",
"ivmname",... | Add IVM filenames provided by user to outputNames dictionary for each input imageObject. | [
"Add",
"IVM",
"filenames",
"provided",
"by",
"user",
"to",
"outputNames",
"dictionary",
"for",
"each",
"input",
"imageObject",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L313-L320 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | checkMultipleFiles | def checkMultipleFiles(input):
""" Evaluates the input to determine whether there is 1 or more than 1 valid input file.
"""
f,i,o,a=buildFileList(input)
return len(f) > 1 | python | def checkMultipleFiles(input):
""" Evaluates the input to determine whether there is 1 or more than 1 valid input file.
"""
f,i,o,a=buildFileList(input)
return len(f) > 1 | [
"def",
"checkMultipleFiles",
"(",
"input",
")",
":",
"f",
",",
"i",
",",
"o",
",",
"a",
"=",
"buildFileList",
"(",
"input",
")",
"return",
"len",
"(",
"f",
")",
">",
"1"
] | Evaluates the input to determine whether there is 1 or more than 1 valid input file. | [
"Evaluates",
"the",
"input",
"to",
"determine",
"whether",
"there",
"is",
"1",
"or",
"more",
"than",
"1",
"valid",
"input",
"file",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L322-L326 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | createImageObjectList | def createImageObjectList(files,instrpars,group=None,
undistort=True, inmemory=False):
""" Returns a list of imageObject instances, 1 for each input image in the list of input filenames.
"""
imageObjList = []
mtflag = False
mt_refimg = None
for img in files:
i... | python | def createImageObjectList(files,instrpars,group=None,
undistort=True, inmemory=False):
""" Returns a list of imageObject instances, 1 for each input image in the list of input filenames.
"""
imageObjList = []
mtflag = False
mt_refimg = None
for img in files:
i... | [
"def",
"createImageObjectList",
"(",
"files",
",",
"instrpars",
",",
"group",
"=",
"None",
",",
"undistort",
"=",
"True",
",",
"inmemory",
"=",
"False",
")",
":",
"imageObjList",
"=",
"[",
"]",
"mtflag",
"=",
"False",
"mt_refimg",
"=",
"None",
"for",
"im... | Returns a list of imageObject instances, 1 for each input image in the list of input filenames. | [
"Returns",
"a",
"list",
"of",
"imageObject",
"instances",
"1",
"for",
"each",
"input",
"image",
"in",
"the",
"list",
"of",
"input",
"filenames",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L328-L362 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | _getInputImage | def _getInputImage (input,group=None):
""" Factory function to return appropriate imageObject class instance"""
# extract primary header and SCI,1 header from input image
sci_ext = 'SCI'
if group in [None,'']:
exten = '[sci,1]'
phdu = fits.getheader(input, memmap=False)
else:
... | python | def _getInputImage (input,group=None):
""" Factory function to return appropriate imageObject class instance"""
# extract primary header and SCI,1 header from input image
sci_ext = 'SCI'
if group in [None,'']:
exten = '[sci,1]'
phdu = fits.getheader(input, memmap=False)
else:
... | [
"def",
"_getInputImage",
"(",
"input",
",",
"group",
"=",
"None",
")",
":",
"sci_ext",
"=",
"'SCI'",
"if",
"group",
"in",
"[",
"None",
",",
"''",
"]",
":",
"exten",
"=",
"'[sci,1]'",
"phdu",
"=",
"fits",
".",
"getheader",
"(",
"input",
",",
"memmap",... | Factory function to return appropriate imageObject class instance | [
"Factory",
"function",
"to",
"return",
"appropriate",
"imageObject",
"class",
"instance"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L371-L449 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | processFilenames | def processFilenames(input=None,output=None,infilesOnly=False):
"""Process the input string which contains the input file information and
return a filelist,output
"""
ivmlist = None
oldasndict = None
if input is None:
print("No input files provided to processInput")
raise Val... | python | def processFilenames(input=None,output=None,infilesOnly=False):
"""Process the input string which contains the input file information and
return a filelist,output
"""
ivmlist = None
oldasndict = None
if input is None:
print("No input files provided to processInput")
raise Val... | [
"def",
"processFilenames",
"(",
"input",
"=",
"None",
",",
"output",
"=",
"None",
",",
"infilesOnly",
"=",
"False",
")",
":",
"ivmlist",
"=",
"None",
"oldasndict",
"=",
"None",
"if",
"input",
"is",
"None",
":",
"print",
"(",
"\"No input files provided to pro... | Process the input string which contains the input file information and
return a filelist,output | [
"Process",
"the",
"input",
"string",
"which",
"contains",
"the",
"input",
"file",
"information",
"and",
"return",
"a",
"filelist",
"output"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L452-L518 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | process_input | def process_input(input, output=None, ivmlist=None, updatewcs=True,
prodonly=False, wcskey=None, **workinplace):
"""
Create the full input list of filenames after verifying and converting
files as needed.
"""
newfilelist, ivmlist, output, oldasndict, origflist = buildFileListOrig... | python | def process_input(input, output=None, ivmlist=None, updatewcs=True,
prodonly=False, wcskey=None, **workinplace):
"""
Create the full input list of filenames after verifying and converting
files as needed.
"""
newfilelist, ivmlist, output, oldasndict, origflist = buildFileListOrig... | [
"def",
"process_input",
"(",
"input",
",",
"output",
"=",
"None",
",",
"ivmlist",
"=",
"None",
",",
"updatewcs",
"=",
"True",
",",
"prodonly",
"=",
"False",
",",
"wcskey",
"=",
"None",
",",
"**",
"workinplace",
")",
":",
"newfilelist",
",",
"ivmlist",
... | Create the full input list of filenames after verifying and converting
files as needed. | [
"Create",
"the",
"full",
"input",
"list",
"of",
"filenames",
"after",
"verifying",
"and",
"converting",
"files",
"as",
"needed",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L521-L569 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | _process_input_wcs_single | def _process_input_wcs_single(fname, wcskey, updatewcs):
"""
See docs for _process_input_wcs.
This is separated to be spawned in parallel.
"""
if wcskey in ['', ' ', 'INDEF', None]:
if updatewcs:
uw.updatewcs(fname, checkfiles=False)
else:
numext = fileutil.countExtn(... | python | def _process_input_wcs_single(fname, wcskey, updatewcs):
"""
See docs for _process_input_wcs.
This is separated to be spawned in parallel.
"""
if wcskey in ['', ' ', 'INDEF', None]:
if updatewcs:
uw.updatewcs(fname, checkfiles=False)
else:
numext = fileutil.countExtn(... | [
"def",
"_process_input_wcs_single",
"(",
"fname",
",",
"wcskey",
",",
"updatewcs",
")",
":",
"if",
"wcskey",
"in",
"[",
"''",
",",
"' '",
",",
"'INDEF'",
",",
"None",
"]",
":",
"if",
"updatewcs",
":",
"uw",
".",
"updatewcs",
"(",
"fname",
",",
"checkfi... | See docs for _process_input_wcs.
This is separated to be spawned in parallel. | [
"See",
"docs",
"for",
"_process_input_wcs",
".",
"This",
"is",
"separated",
"to",
"be",
"spawned",
"in",
"parallel",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L613-L636 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | buildFileList | def buildFileList(input, output=None, ivmlist=None,
wcskey=None, updatewcs=True, **workinplace):
"""
Builds a file list which has undergone various instrument-specific
checks for input to MultiDrizzle, including splitting STIS associations.
"""
newfilelist, ivmlist, output, oldasndic... | python | def buildFileList(input, output=None, ivmlist=None,
wcskey=None, updatewcs=True, **workinplace):
"""
Builds a file list which has undergone various instrument-specific
checks for input to MultiDrizzle, including splitting STIS associations.
"""
newfilelist, ivmlist, output, oldasndic... | [
"def",
"buildFileList",
"(",
"input",
",",
"output",
"=",
"None",
",",
"ivmlist",
"=",
"None",
",",
"wcskey",
"=",
"None",
",",
"updatewcs",
"=",
"True",
",",
"**",
"workinplace",
")",
":",
"newfilelist",
",",
"ivmlist",
",",
"output",
",",
"oldasndict",... | Builds a file list which has undergone various instrument-specific
checks for input to MultiDrizzle, including splitting STIS associations. | [
"Builds",
"a",
"file",
"list",
"which",
"has",
"undergone",
"various",
"instrument",
"-",
"specific",
"checks",
"for",
"input",
"to",
"MultiDrizzle",
"including",
"splitting",
"STIS",
"associations",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L639-L648 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | buildASNList | def buildASNList(rootnames, asnname, check_for_duplicates=True):
"""
Return the list of filenames for a given set of rootnames
"""
# Recognize when multiple valid inputs with the same rootname are present
# this would happen when both CTE-corrected (_flc) and non-CTE-corrected (_flt)
# products... | python | def buildASNList(rootnames, asnname, check_for_duplicates=True):
"""
Return the list of filenames for a given set of rootnames
"""
# Recognize when multiple valid inputs with the same rootname are present
# this would happen when both CTE-corrected (_flc) and non-CTE-corrected (_flt)
# products... | [
"def",
"buildASNList",
"(",
"rootnames",
",",
"asnname",
",",
"check_for_duplicates",
"=",
"True",
")",
":",
"filelist",
",",
"duplicates",
"=",
"checkForDuplicateInputs",
"(",
"rootnames",
")",
"if",
"check_for_duplicates",
"and",
"duplicates",
":",
"origasn",
"=... | Return the list of filenames for a given set of rootnames | [
"Return",
"the",
"list",
"of",
"filenames",
"for",
"a",
"given",
"set",
"of",
"rootnames"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L709-L739 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | changeSuffixinASN | def changeSuffixinASN(asnfile, suffix):
"""
Create a copy of the original asn file and change the name of all members
to include the suffix.
"""
# Start by creating a new name for the ASN table
_new_asn = asnfile.replace('_asn.fits','_'+suffix+'_asn.fits')
if os.path.exists(_new_asn):
... | python | def changeSuffixinASN(asnfile, suffix):
"""
Create a copy of the original asn file and change the name of all members
to include the suffix.
"""
# Start by creating a new name for the ASN table
_new_asn = asnfile.replace('_asn.fits','_'+suffix+'_asn.fits')
if os.path.exists(_new_asn):
... | [
"def",
"changeSuffixinASN",
"(",
"asnfile",
",",
"suffix",
")",
":",
"_new_asn",
"=",
"asnfile",
".",
"replace",
"(",
"'_asn.fits'",
",",
"'_'",
"+",
"suffix",
"+",
"'_asn.fits'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"_new_asn",
")",
":",
... | Create a copy of the original asn file and change the name of all members
to include the suffix. | [
"Create",
"a",
"copy",
"of",
"the",
"original",
"asn",
"file",
"and",
"change",
"the",
"name",
"of",
"all",
"members",
"to",
"include",
"the",
"suffix",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L742-L779 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | resetDQBits | def resetDQBits(imageObjectList, cr_bits_value=4096):
"""Reset the CR bit in each input image's DQ array"""
if cr_bits_value > 0:
for img in imageObjectList:
for chip in range(1,img._numchips+1,1):
sci_chip = img._image[img.scienceExt,chip]
resetbits.reset_dq... | python | def resetDQBits(imageObjectList, cr_bits_value=4096):
"""Reset the CR bit in each input image's DQ array"""
if cr_bits_value > 0:
for img in imageObjectList:
for chip in range(1,img._numchips+1,1):
sci_chip = img._image[img.scienceExt,chip]
resetbits.reset_dq... | [
"def",
"resetDQBits",
"(",
"imageObjectList",
",",
"cr_bits_value",
"=",
"4096",
")",
":",
"if",
"cr_bits_value",
">",
"0",
":",
"for",
"img",
"in",
"imageObjectList",
":",
"for",
"chip",
"in",
"range",
"(",
"1",
",",
"img",
".",
"_numchips",
"+",
"1",
... | Reset the CR bit in each input image's DQ array | [
"Reset",
"the",
"CR",
"bit",
"in",
"each",
"input",
"image",
"s",
"DQ",
"array"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L823-L831 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | update_member_names | def update_member_names(oldasndict, pydr_input):
"""
Update names in a member dictionary.
Given an association dictionary with rootnames and a list of full
file names, it will update the names in the member dictionary to
contain '_*' extension. For example a rootname of 'u9600201m' will
be repl... | python | def update_member_names(oldasndict, pydr_input):
"""
Update names in a member dictionary.
Given an association dictionary with rootnames and a list of full
file names, it will update the names in the member dictionary to
contain '_*' extension. For example a rootname of 'u9600201m' will
be repl... | [
"def",
"update_member_names",
"(",
"oldasndict",
",",
"pydr_input",
")",
":",
"omembers",
"=",
"oldasndict",
"[",
"'members'",
"]",
".",
"copy",
"(",
")",
"nmembers",
"=",
"{",
"}",
"translated_names",
"=",
"[",
"f",
".",
"split",
"(",
"'.fits'",
")",
"[... | Update names in a member dictionary.
Given an association dictionary with rootnames and a list of full
file names, it will update the names in the member dictionary to
contain '_*' extension. For example a rootname of 'u9600201m' will
be replaced by 'u9600201m_c0h' making sure that a MEf file is passed... | [
"Update",
"names",
"in",
"a",
"member",
"dictionary",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L834-L863 | train |
spacetelescope/drizzlepac | drizzlepac/processInput.py | manageInputCopies | def manageInputCopies(filelist, **workinplace):
"""
Creates copies of all input images in a sub-directory.
The copies are made prior to any processing being done to the images at all,
including updating the WCS keywords. If there are already copies present,
they will NOT be overwritten, but instead... | python | def manageInputCopies(filelist, **workinplace):
"""
Creates copies of all input images in a sub-directory.
The copies are made prior to any processing being done to the images at all,
including updating the WCS keywords. If there are already copies present,
they will NOT be overwritten, but instead... | [
"def",
"manageInputCopies",
"(",
"filelist",
",",
"**",
"workinplace",
")",
":",
"workingdir",
"=",
"os",
".",
"getcwd",
"(",
")",
"origdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"workingdir",
",",
"'OrIg_files'",
")",
"if",
"workinplace",
"[",
"'ov... | Creates copies of all input images in a sub-directory.
The copies are made prior to any processing being done to the images at all,
including updating the WCS keywords. If there are already copies present,
they will NOT be overwritten, but instead will be used to over-write the
current working copies. | [
"Creates",
"copies",
"of",
"all",
"input",
"images",
"in",
"a",
"sub",
"-",
"directory",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L866-L918 | train |
spacetelescope/drizzlepac | drizzlepac/tweakreg.py | _managePsets | def _managePsets(configobj, section_name, task_name, iparsobj=None, input_dict=None):
""" Read in parameter values from PSET-like configobj tasks defined for
source-finding algorithms, and any other PSET-like tasks under this task,
and merge those values into the input configobj dictionary.
"""
... | python | def _managePsets(configobj, section_name, task_name, iparsobj=None, input_dict=None):
""" Read in parameter values from PSET-like configobj tasks defined for
source-finding algorithms, and any other PSET-like tasks under this task,
and merge those values into the input configobj dictionary.
"""
... | [
"def",
"_managePsets",
"(",
"configobj",
",",
"section_name",
",",
"task_name",
",",
"iparsobj",
"=",
"None",
",",
"input_dict",
"=",
"None",
")",
":",
"configobj",
"[",
"section_name",
"]",
"=",
"{",
"}",
"iparsobj_cfg",
"=",
"teal",
".",
"load",
"(",
"... | Read in parameter values from PSET-like configobj tasks defined for
source-finding algorithms, and any other PSET-like tasks under this task,
and merge those values into the input configobj dictionary. | [
"Read",
"in",
"parameter",
"values",
"from",
"PSET",
"-",
"like",
"configobj",
"tasks",
"defined",
"for",
"source",
"-",
"finding",
"algorithms",
"and",
"any",
"other",
"PSET",
"-",
"like",
"tasks",
"under",
"this",
"task",
"and",
"merge",
"those",
"values",... | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakreg.py#L46-L74 | train |
spacetelescope/drizzlepac | drizzlepac/tweakreg.py | edit_imagefindpars | def edit_imagefindpars():
""" Allows the user to edit the imagefindpars configObj in a TEAL GUI
"""
teal.teal(imagefindpars.__taskname__, returnAs=None,
autoClose=True, loadOnly=False, canExecute=False) | python | def edit_imagefindpars():
""" Allows the user to edit the imagefindpars configObj in a TEAL GUI
"""
teal.teal(imagefindpars.__taskname__, returnAs=None,
autoClose=True, loadOnly=False, canExecute=False) | [
"def",
"edit_imagefindpars",
"(",
")",
":",
"teal",
".",
"teal",
"(",
"imagefindpars",
".",
"__taskname__",
",",
"returnAs",
"=",
"None",
",",
"autoClose",
"=",
"True",
",",
"loadOnly",
"=",
"False",
",",
"canExecute",
"=",
"False",
")"
] | Allows the user to edit the imagefindpars configObj in a TEAL GUI | [
"Allows",
"the",
"user",
"to",
"edit",
"the",
"imagefindpars",
"configObj",
"in",
"a",
"TEAL",
"GUI"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakreg.py#L81-L85 | train |
spacetelescope/drizzlepac | drizzlepac/tweakreg.py | edit_refimagefindpars | def edit_refimagefindpars():
""" Allows the user to edit the refimagefindpars configObj in a TEAL GUI
"""
teal.teal(refimagefindpars.__taskname__, returnAs=None,
autoClose=True, loadOnly=False, canExecute=False) | python | def edit_refimagefindpars():
""" Allows the user to edit the refimagefindpars configObj in a TEAL GUI
"""
teal.teal(refimagefindpars.__taskname__, returnAs=None,
autoClose=True, loadOnly=False, canExecute=False) | [
"def",
"edit_refimagefindpars",
"(",
")",
":",
"teal",
".",
"teal",
"(",
"refimagefindpars",
".",
"__taskname__",
",",
"returnAs",
"=",
"None",
",",
"autoClose",
"=",
"True",
",",
"loadOnly",
"=",
"False",
",",
"canExecute",
"=",
"False",
")"
] | Allows the user to edit the refimagefindpars configObj in a TEAL GUI | [
"Allows",
"the",
"user",
"to",
"edit",
"the",
"refimagefindpars",
"configObj",
"in",
"a",
"TEAL",
"GUI"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakreg.py#L87-L91 | train |
spacetelescope/drizzlepac | drizzlepac/updatenpol.py | find_d2ifile | def find_d2ifile(flist,detector):
""" Search a list of files for one that matches the detector specified.
"""
d2ifile = None
for f in flist:
fdet = fits.getval(f, 'detector', memmap=False)
if fdet == detector:
d2ifile = f
return d2ifile | python | def find_d2ifile(flist,detector):
""" Search a list of files for one that matches the detector specified.
"""
d2ifile = None
for f in flist:
fdet = fits.getval(f, 'detector', memmap=False)
if fdet == detector:
d2ifile = f
return d2ifile | [
"def",
"find_d2ifile",
"(",
"flist",
",",
"detector",
")",
":",
"d2ifile",
"=",
"None",
"for",
"f",
"in",
"flist",
":",
"fdet",
"=",
"fits",
".",
"getval",
"(",
"f",
",",
"'detector'",
",",
"memmap",
"=",
"False",
")",
"if",
"fdet",
"==",
"detector",... | Search a list of files for one that matches the detector specified. | [
"Search",
"a",
"list",
"of",
"files",
"for",
"one",
"that",
"matches",
"the",
"detector",
"specified",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatenpol.py#L257-L265 | train |
spacetelescope/drizzlepac | drizzlepac/updatenpol.py | find_npolfile | def find_npolfile(flist,detector,filters):
""" Search a list of files for one that matches the configuration
of detector and filters used.
"""
npolfile = None
for f in flist:
fdet = fits.getval(f, 'detector', memmap=False)
if fdet == detector:
filt1 = fits.getval(f, '... | python | def find_npolfile(flist,detector,filters):
""" Search a list of files for one that matches the configuration
of detector and filters used.
"""
npolfile = None
for f in flist:
fdet = fits.getval(f, 'detector', memmap=False)
if fdet == detector:
filt1 = fits.getval(f, '... | [
"def",
"find_npolfile",
"(",
"flist",
",",
"detector",
",",
"filters",
")",
":",
"npolfile",
"=",
"None",
"for",
"f",
"in",
"flist",
":",
"fdet",
"=",
"fits",
".",
"getval",
"(",
"f",
",",
"'detector'",
",",
"memmap",
"=",
"False",
")",
"if",
"fdet",... | Search a list of files for one that matches the configuration
of detector and filters used. | [
"Search",
"a",
"list",
"of",
"files",
"for",
"one",
"that",
"matches",
"the",
"configuration",
"of",
"detector",
"and",
"filters",
"used",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatenpol.py#L267-L281 | train |
spacetelescope/drizzlepac | drizzlepac/updatenpol.py | run | def run(configobj=None,editpars=False):
""" Teal interface for running this code.
"""
if configobj is None:
configobj =teal.teal(__taskname__,loadOnly=(not editpars))
update(configobj['input'],configobj['refdir'],
local=configobj['local'],interactive=configobj['interactive'],
w... | python | def run(configobj=None,editpars=False):
""" Teal interface for running this code.
"""
if configobj is None:
configobj =teal.teal(__taskname__,loadOnly=(not editpars))
update(configobj['input'],configobj['refdir'],
local=configobj['local'],interactive=configobj['interactive'],
w... | [
"def",
"run",
"(",
"configobj",
"=",
"None",
",",
"editpars",
"=",
"False",
")",
":",
"if",
"configobj",
"is",
"None",
":",
"configobj",
"=",
"teal",
".",
"teal",
"(",
"__taskname__",
",",
"loadOnly",
"=",
"(",
"not",
"editpars",
")",
")",
"update",
... | Teal interface for running this code. | [
"Teal",
"interface",
"for",
"running",
"this",
"code",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatenpol.py#L286-L295 | train |
spacetelescope/drizzlepac | drizzlepac/hlautils/astroquery_utils.py | retrieve_observation | def retrieve_observation(obsid, suffix=['FLC'], archive=False,clobber=False):
"""Simple interface for retrieving an observation from the MAST archive
If the input obsid is for an association, it will request all members with
the specified suffixes.
Parameters
-----------
obsid : string
... | python | def retrieve_observation(obsid, suffix=['FLC'], archive=False,clobber=False):
"""Simple interface for retrieving an observation from the MAST archive
If the input obsid is for an association, it will request all members with
the specified suffixes.
Parameters
-----------
obsid : string
... | [
"def",
"retrieve_observation",
"(",
"obsid",
",",
"suffix",
"=",
"[",
"'FLC'",
"]",
",",
"archive",
"=",
"False",
",",
"clobber",
"=",
"False",
")",
":",
"local_files",
"=",
"[",
"]",
"obsTable",
"=",
"Observations",
".",
"query_criteria",
"(",
"obs_id",
... | Simple interface for retrieving an observation from the MAST archive
If the input obsid is for an association, it will request all members with
the specified suffixes.
Parameters
-----------
obsid : string
ID for observation to be retrieved from the MAST archive. Only the
IPPSSOOT... | [
"Simple",
"interface",
"for",
"retrieving",
"an",
"observation",
"from",
"the",
"MAST",
"archive"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astroquery_utils.py#L15-L123 | train |
spacetelescope/drizzlepac | drizzlepac/pixreplace.py | replace | def replace(input, **pars):
""" Replace pixels in `input` that have a value of `pixvalue`
with a value given by `newvalue`.
"""
pixvalue = pars.get('pixvalue', np.nan)
if pixvalue is None: pixvalue = np.nan # insure that None == np.nan
newvalue = pars.get('newvalue', 0.0)
ext = pars.g... | python | def replace(input, **pars):
""" Replace pixels in `input` that have a value of `pixvalue`
with a value given by `newvalue`.
"""
pixvalue = pars.get('pixvalue', np.nan)
if pixvalue is None: pixvalue = np.nan # insure that None == np.nan
newvalue = pars.get('newvalue', 0.0)
ext = pars.g... | [
"def",
"replace",
"(",
"input",
",",
"**",
"pars",
")",
":",
"pixvalue",
"=",
"pars",
".",
"get",
"(",
"'pixvalue'",
",",
"np",
".",
"nan",
")",
"if",
"pixvalue",
"is",
"None",
":",
"pixvalue",
"=",
"np",
".",
"nan",
"newvalue",
"=",
"pars",
".",
... | Replace pixels in `input` that have a value of `pixvalue`
with a value given by `newvalue`. | [
"Replace",
"pixels",
"in",
"input",
"that",
"have",
"a",
"value",
"of",
"pixvalue",
"with",
"a",
"value",
"given",
"by",
"newvalue",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/pixreplace.py#L67-L104 | train |
spacetelescope/drizzlepac | drizzlepac/tweakback.py | extract_input_filenames | def extract_input_filenames(drzfile):
"""
Generate a list of filenames from a drizzled image's header
"""
data_kws = fits.getval(drzfile, 'd*data', ext=0, memmap=False)
if len(data_kws) == 0:
return None
fnames = []
for kw in data_kws.cards:
f = kw.value.split('[')[0]
... | python | def extract_input_filenames(drzfile):
"""
Generate a list of filenames from a drizzled image's header
"""
data_kws = fits.getval(drzfile, 'd*data', ext=0, memmap=False)
if len(data_kws) == 0:
return None
fnames = []
for kw in data_kws.cards:
f = kw.value.split('[')[0]
... | [
"def",
"extract_input_filenames",
"(",
"drzfile",
")",
":",
"data_kws",
"=",
"fits",
".",
"getval",
"(",
"drzfile",
",",
"'d*data'",
",",
"ext",
"=",
"0",
",",
"memmap",
"=",
"False",
")",
"if",
"len",
"(",
"data_kws",
")",
"==",
"0",
":",
"return",
... | Generate a list of filenames from a drizzled image's header | [
"Generate",
"a",
"list",
"of",
"filenames",
"from",
"a",
"drizzled",
"image",
"s",
"header"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakback.py#L351-L364 | train |
spacetelescope/drizzlepac | drizzlepac/tweakback.py | determine_orig_wcsname | def determine_orig_wcsname(header, wnames, wkeys):
"""
Determine the name of the original, unmodified WCS solution
"""
orig_wcsname = None
orig_key = None
if orig_wcsname is None:
for k,w in wnames.items():
if w[:4] == 'IDC_':
orig_wcsname = w
... | python | def determine_orig_wcsname(header, wnames, wkeys):
"""
Determine the name of the original, unmodified WCS solution
"""
orig_wcsname = None
orig_key = None
if orig_wcsname is None:
for k,w in wnames.items():
if w[:4] == 'IDC_':
orig_wcsname = w
... | [
"def",
"determine_orig_wcsname",
"(",
"header",
",",
"wnames",
",",
"wkeys",
")",
":",
"orig_wcsname",
"=",
"None",
"orig_key",
"=",
"None",
"if",
"orig_wcsname",
"is",
"None",
":",
"for",
"k",
",",
"w",
"in",
"wnames",
".",
"items",
"(",
")",
":",
"if... | Determine the name of the original, unmodified WCS solution | [
"Determine",
"the",
"name",
"of",
"the",
"original",
"unmodified",
"WCS",
"solution"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakback.py#L379-L396 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | parse_skypos | def parse_skypos(ra, dec):
"""
Function to parse RA and Dec input values and turn them into decimal
degrees
Input formats could be:
["nn","nn","nn.nn"]
"nn nn nn.nnn"
"nn:nn:nn.nn"
"nnH nnM nn.nnS" or "nnD nnM nn.nnS"
nn.nnnnnnnn
"nn.nnnnnnn"
"""
... | python | def parse_skypos(ra, dec):
"""
Function to parse RA and Dec input values and turn them into decimal
degrees
Input formats could be:
["nn","nn","nn.nn"]
"nn nn nn.nnn"
"nn:nn:nn.nn"
"nnH nnM nn.nnS" or "nnD nnM nn.nnS"
nn.nnnnnnnn
"nn.nnnnnnn"
"""
... | [
"def",
"parse_skypos",
"(",
"ra",
",",
"dec",
")",
":",
"rval",
"=",
"make_val_float",
"(",
"ra",
")",
"dval",
"=",
"make_val_float",
"(",
"dec",
")",
"if",
"rval",
"is",
"None",
":",
"rval",
",",
"dval",
"=",
"radec_hmstodd",
"(",
"ra",
",",
"dec",
... | Function to parse RA and Dec input values and turn them into decimal
degrees
Input formats could be:
["nn","nn","nn.nn"]
"nn nn nn.nnn"
"nn:nn:nn.nn"
"nnH nnM nn.nnS" or "nnD nnM nn.nnS"
nn.nnnnnnnn
"nn.nnnnnnn" | [
"Function",
"to",
"parse",
"RA",
"and",
"Dec",
"input",
"values",
"and",
"turn",
"them",
"into",
"decimal",
"degrees"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L173-L191 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | radec_hmstodd | def radec_hmstodd(ra, dec):
""" Function to convert HMS values into decimal degrees.
This function relies on the astropy.coordinates package to perform the
conversion to decimal degrees.
Parameters
----------
ra : list or array
List or array of input RA positio... | python | def radec_hmstodd(ra, dec):
""" Function to convert HMS values into decimal degrees.
This function relies on the astropy.coordinates package to perform the
conversion to decimal degrees.
Parameters
----------
ra : list or array
List or array of input RA positio... | [
"def",
"radec_hmstodd",
"(",
"ra",
",",
"dec",
")",
":",
"hmstrans",
"=",
"string",
".",
"maketrans",
"(",
"string",
".",
"ascii_letters",
",",
"' '",
"*",
"len",
"(",
"string",
".",
"ascii_letters",
")",
")",
"if",
"isinstance",
"(",
"ra",
",",
"list"... | Function to convert HMS values into decimal degrees.
This function relies on the astropy.coordinates package to perform the
conversion to decimal degrees.
Parameters
----------
ra : list or array
List or array of input RA positions
dec : list or array
... | [
"Function",
"to",
"convert",
"HMS",
"values",
"into",
"decimal",
"degrees",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L201-L270 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | parse_exclusions | def parse_exclusions(exclusions):
""" Read in exclusion definitions from file named by 'exclusions'
and return a list of positions and distances
"""
fname = fileutil.osfn(exclusions)
if os.path.exists(fname):
with open(fname) as f:
flines = f.readlines()
else:
pri... | python | def parse_exclusions(exclusions):
""" Read in exclusion definitions from file named by 'exclusions'
and return a list of positions and distances
"""
fname = fileutil.osfn(exclusions)
if os.path.exists(fname):
with open(fname) as f:
flines = f.readlines()
else:
pri... | [
"def",
"parse_exclusions",
"(",
"exclusions",
")",
":",
"fname",
"=",
"fileutil",
".",
"osfn",
"(",
"exclusions",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"flines",
"=",
... | Read in exclusion definitions from file named by 'exclusions'
and return a list of positions and distances | [
"Read",
"in",
"exclusion",
"definitions",
"from",
"file",
"named",
"by",
"exclusions",
"and",
"return",
"a",
"list",
"of",
"positions",
"and",
"distances"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L273-L331 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | parse_colname | def parse_colname(colname):
""" Common function to interpret input column names provided by the user.
This function translates column specification provided by the user
into a column number.
Notes
-----
This function will understand the following inputs::
'1,2,... | python | def parse_colname(colname):
""" Common function to interpret input column names provided by the user.
This function translates column specification provided by the user
into a column number.
Notes
-----
This function will understand the following inputs::
'1,2,... | [
"def",
"parse_colname",
"(",
"colname",
")",
":",
"if",
"isinstance",
"(",
"colname",
",",
"list",
")",
":",
"cname",
"=",
"''",
"for",
"c",
"in",
"colname",
":",
"cname",
"+=",
"str",
"(",
"c",
")",
"+",
"','",
"cname",
"=",
"cname",
".",
"rstrip"... | Common function to interpret input column names provided by the user.
This function translates column specification provided by the user
into a column number.
Notes
-----
This function will understand the following inputs::
'1,2,3' or 'c1,c2,c3' or ['c1','c2','c3... | [
"Common",
"function",
"to",
"interpret",
"input",
"column",
"names",
"provided",
"by",
"the",
"user",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L334-L390 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | readcols | def readcols(infile, cols=None):
""" Function which reads specified columns from either FITS tables or
ASCII files
This function reads in the columns specified by the user into numpy
arrays regardless of the format of the input table (ASCII or FITS
table).
Parameters
... | python | def readcols(infile, cols=None):
""" Function which reads specified columns from either FITS tables or
ASCII files
This function reads in the columns specified by the user into numpy
arrays regardless of the format of the input table (ASCII or FITS
table).
Parameters
... | [
"def",
"readcols",
"(",
"infile",
",",
"cols",
"=",
"None",
")",
":",
"if",
"_is_str_none",
"(",
"infile",
")",
"is",
"None",
":",
"return",
"None",
"if",
"infile",
".",
"endswith",
"(",
"'.fits'",
")",
":",
"outarr",
"=",
"read_FITS_cols",
"(",
"infil... | Function which reads specified columns from either FITS tables or
ASCII files
This function reads in the columns specified by the user into numpy
arrays regardless of the format of the input table (ASCII or FITS
table).
Parameters
----------
infile : string
... | [
"Function",
"which",
"reads",
"specified",
"columns",
"from",
"either",
"FITS",
"tables",
"or",
"ASCII",
"files"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L393-L421 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | read_FITS_cols | def read_FITS_cols(infile, cols=None): # noqa: N802
""" Read columns from FITS table """
with fits.open(infile, memmap=False) as ftab:
extnum = 0
extfound = False
for extn in ftab:
if 'tfields' in extn.header:
extfound = True
break
... | python | def read_FITS_cols(infile, cols=None): # noqa: N802
""" Read columns from FITS table """
with fits.open(infile, memmap=False) as ftab:
extnum = 0
extfound = False
for extn in ftab:
if 'tfields' in extn.header:
extfound = True
break
... | [
"def",
"read_FITS_cols",
"(",
"infile",
",",
"cols",
"=",
"None",
")",
":",
"with",
"fits",
".",
"open",
"(",
"infile",
",",
"memmap",
"=",
"False",
")",
"as",
"ftab",
":",
"extnum",
"=",
"0",
"extfound",
"=",
"False",
"for",
"extn",
"in",
"ftab",
... | Read columns from FITS table | [
"Read",
"columns",
"from",
"FITS",
"table"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L424-L447 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | read_ASCII_cols | def read_ASCII_cols(infile, cols=[1, 2, 3]): # noqa: N802
""" Interpret input ASCII file to return arrays for specified columns.
Notes
-----
The specification of the columns should be expected to have lists for
each 'column', with all columns in each list combined into a single
... | python | def read_ASCII_cols(infile, cols=[1, 2, 3]): # noqa: N802
""" Interpret input ASCII file to return arrays for specified columns.
Notes
-----
The specification of the columns should be expected to have lists for
each 'column', with all columns in each list combined into a single
... | [
"def",
"read_ASCII_cols",
"(",
"infile",
",",
"cols",
"=",
"[",
"1",
",",
"2",
",",
"3",
"]",
")",
":",
"coldict",
"=",
"{",
"}",
"with",
"open",
"(",
"infile",
",",
"'r'",
")",
"as",
"f",
":",
"flines",
"=",
"f",
".",
"readlines",
"(",
")",
... | Interpret input ASCII file to return arrays for specified columns.
Notes
-----
The specification of the columns should be expected to have lists for
each 'column', with all columns in each list combined into a single
entry.
For example::
cols = ['1,2,3','4,... | [
"Interpret",
"input",
"ASCII",
"file",
"to",
"return",
"arrays",
"for",
"specified",
"columns",
"."
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L450-L541 | train |
spacetelescope/drizzlepac | drizzlepac/tweakutils.py | write_shiftfile | def write_shiftfile(image_list, filename, outwcs='tweak_wcs.fits'):
""" Write out a shiftfile for a given list of input Image class objects
"""
rows = ''
nrows = 0
for img in image_list:
row = img.get_shiftfile_row()
if row is not None:
rows += row
nrows += 1
... | python | def write_shiftfile(image_list, filename, outwcs='tweak_wcs.fits'):
""" Write out a shiftfile for a given list of input Image class objects
"""
rows = ''
nrows = 0
for img in image_list:
row = img.get_shiftfile_row()
if row is not None:
rows += row
nrows += 1
... | [
"def",
"write_shiftfile",
"(",
"image_list",
",",
"filename",
",",
"outwcs",
"=",
"'tweak_wcs.fits'",
")",
":",
"rows",
"=",
"''",
"nrows",
"=",
"0",
"for",
"img",
"in",
"image_list",
":",
"row",
"=",
"img",
".",
"get_shiftfile_row",
"(",
")",
"if",
"row... | Write out a shiftfile for a given list of input Image class objects | [
"Write",
"out",
"a",
"shiftfile",
"for",
"a",
"given",
"list",
"of",
"input",
"Image",
"class",
"objects"
] | 15bec3c929a6a869d9e71b9398ced43ede0620f1 | https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L544-L572 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.