repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
within_footprint
def within_footprint(img, wcs, x, y): """Determine whether input x, y fall in the science area of the image. Parameters ---------- img : ndarray ndarray of image where non-science areas are marked with value of NaN. wcs : `stwcs.wcsutil.HSTWCS` HSTWCS or WCS object with naxis terms...
python
def within_footprint(img, wcs, x, y): """Determine whether input x, y fall in the science area of the image. Parameters ---------- img : ndarray ndarray of image where non-science areas are marked with value of NaN. wcs : `stwcs.wcsutil.HSTWCS` HSTWCS or WCS object with naxis terms...
[ "def", "within_footprint", "(", "img", ",", "wcs", ",", "x", ",", "y", ")", ":", "# start with limits of WCS shape", "if", "hasattr", "(", "wcs", ",", "'naxis1'", ")", ":", "naxis1", "=", "wcs", ".", "naxis1", "naxis2", "=", "wcs", ".", "naxis2", "elif",...
Determine whether input x, y fall in the science area of the image. Parameters ---------- img : ndarray ndarray of image where non-science areas are marked with value of NaN. wcs : `stwcs.wcsutil.HSTWCS` HSTWCS or WCS object with naxis terms defined. x, y : ndarray arrays ...
[ "Determine", "whether", "input", "x", "y", "fall", "in", "the", "science", "area", "of", "the", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L891-L932
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
create_image_footprint
def create_image_footprint(image, refwcs, border=0.): """ Create the footprint of the image in the reference WCS frame. Parameters ---------- image : `astropy.io.fits.HDUList` or str Image to extract sources for matching to the external astrometric catalog. refwcs : `stwcs.wcsutil....
python
def create_image_footprint(image, refwcs, border=0.): """ Create the footprint of the image in the reference WCS frame. Parameters ---------- image : `astropy.io.fits.HDUList` or str Image to extract sources for matching to the external astrometric catalog. refwcs : `stwcs.wcsutil....
[ "def", "create_image_footprint", "(", "image", ",", "refwcs", ",", "border", "=", "0.", ")", ":", "# Interpret input image to generate initial source catalog and WCS", "if", "isinstance", "(", "image", ",", "str", ")", ":", "image", "=", "pf", ".", "open", "(", ...
Create the footprint of the image in the reference WCS frame. Parameters ---------- image : `astropy.io.fits.HDUList` or str Image to extract sources for matching to the external astrometric catalog. refwcs : `stwcs.wcsutil.HSTWCS` Reference WCS for coordinate frame of image. ...
[ "Create", "the", "footprint", "of", "the", "image", "in", "the", "reference", "WCS", "frame", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L935-L984
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
find_hist2d_offset
def find_hist2d_offset(filename, reference, refwcs=None, refnames=['ra', 'dec'], match_tolerance=5., chip_catalog=True, search_radius=15.0, min_match=10, classify=True): """Iteratively look for the best cross-match between the catalog and ref. Parameters ------...
python
def find_hist2d_offset(filename, reference, refwcs=None, refnames=['ra', 'dec'], match_tolerance=5., chip_catalog=True, search_radius=15.0, min_match=10, classify=True): """Iteratively look for the best cross-match between the catalog and ref. Parameters ------...
[ "def", "find_hist2d_offset", "(", "filename", ",", "reference", ",", "refwcs", "=", "None", ",", "refnames", "=", "[", "'ra'", ",", "'dec'", "]", ",", "match_tolerance", "=", "5.", ",", "chip_catalog", "=", "True", ",", "search_radius", "=", "15.0", ",", ...
Iteratively look for the best cross-match between the catalog and ref. Parameters ---------- filename : `~astropy.io.fits.HDUList` or str Single image to extract sources for matching to the external astrometric catalog. reference : str or `~astropy.table.Table` ...
[ "Iteratively", "look", "for", "the", "best", "cross", "-", "match", "between", "the", "catalog", "and", "ref", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L987-L1109
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
build_wcscat
def build_wcscat(image, group_id, source_catalog): """ Return a list of `~tweakwcs.tpwcs.FITSWCS` objects for all chips in an image. Parameters ---------- image : str, ~astropy.io.fits.HDUList` Either filename or HDUList of a single HST observation. group_id : int Integer ID for gr...
python
def build_wcscat(image, group_id, source_catalog): """ Return a list of `~tweakwcs.tpwcs.FITSWCS` objects for all chips in an image. Parameters ---------- image : str, ~astropy.io.fits.HDUList` Either filename or HDUList of a single HST observation. group_id : int Integer ID for gr...
[ "def", "build_wcscat", "(", "image", ",", "group_id", ",", "source_catalog", ")", ":", "open_file", "=", "False", "if", "isinstance", "(", "image", ",", "str", ")", ":", "hdulist", "=", "pf", ".", "open", "(", "image", ")", "open_file", "=", "True", "e...
Return a list of `~tweakwcs.tpwcs.FITSWCS` objects for all chips in an image. Parameters ---------- image : str, ~astropy.io.fits.HDUList` Either filename or HDUList of a single HST observation. group_id : int Integer ID for group this image should be associated with; primarily ...
[ "Return", "a", "list", "of", "~tweakwcs", ".", "tpwcs", ".", "FITSWCS", "objects", "for", "all", "chips", "in", "an", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L1117-L1180
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
update_from_shiftfile
def update_from_shiftfile(shiftfile,wcsname=None,force=False): """ Update headers of all images specified in shiftfile with shifts from shiftfile. Parameters ---------- shiftfile : str Filename of shiftfile. wcsname : str Label to give to new WCS solution being created by t...
python
def update_from_shiftfile(shiftfile,wcsname=None,force=False): """ Update headers of all images specified in shiftfile with shifts from shiftfile. Parameters ---------- shiftfile : str Filename of shiftfile. wcsname : str Label to give to new WCS solution being created by t...
[ "def", "update_from_shiftfile", "(", "shiftfile", ",", "wcsname", "=", "None", ",", "force", "=", "False", ")", ":", "f", "=", "open", "(", "fileutil", ".", "osfn", "(", "shiftfile", ")", ")", "shift_lines", "=", "[", "x", ".", "strip", "(", ")", "fo...
Update headers of all images specified in shiftfile with shifts from shiftfile. Parameters ---------- shiftfile : str Filename of shiftfile. wcsname : str Label to give to new WCS solution being created by this fit. If a value of None is given, it will automatically use 'TW...
[ "Update", "headers", "of", "all", "images", "specified", "in", "shiftfile", "with", "shifts", "from", "shiftfile", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L41-L97
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
updatewcs_with_shift
def updatewcs_with_shift(image,reference,wcsname=None, reusename=False, fitgeom='rscale', rot=0.0,scale=1.0,xsh=0.0,ysh=0.0,fit=None, xrms=None, yrms = None, verbose=False,force=False,sciext='SCI'): """ Update t...
python
def updatewcs_with_shift(image,reference,wcsname=None, reusename=False, fitgeom='rscale', rot=0.0,scale=1.0,xsh=0.0,ysh=0.0,fit=None, xrms=None, yrms = None, verbose=False,force=False,sciext='SCI'): """ Update t...
[ "def", "updatewcs_with_shift", "(", "image", ",", "reference", ",", "wcsname", "=", "None", ",", "reusename", "=", "False", ",", "fitgeom", "=", "'rscale'", ",", "rot", "=", "0.0", ",", "scale", "=", "1.0", ",", "xsh", "=", "0.0", ",", "ysh", "=", "0...
Update the SCI headers in 'image' based on the fit provided as determined in the WCS specified by 'reference'. The fit should be a 2-D matrix as generated for use with 'make_vector_plot()'. Notes ----- The algorithm used to apply the provided fit solution to the image involves applying the fol...
[ "Update", "the", "SCI", "headers", "in", "image", "based", "on", "the", "fit", "provided", "as", "determined", "in", "the", "WCS", "specified", "by", "reference", ".", "The", "fit", "should", "be", "a", "2", "-", "D", "matrix", "as", "generated", "for", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L99-L280
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
linearize
def linearize(wcsim, wcsima, wcsref, imcrpix, f, shift, hx=1.0, hy=1.0): """ linearization using 5-point formula for first order derivative """ x0 = imcrpix[0] y0 = imcrpix[1] p = np.asarray([[x0, y0], [x0 - hx, y0], [x0 - hx * 0.5, y0], [...
python
def linearize(wcsim, wcsima, wcsref, imcrpix, f, shift, hx=1.0, hy=1.0): """ linearization using 5-point formula for first order derivative """ x0 = imcrpix[0] y0 = imcrpix[1] p = np.asarray([[x0, y0], [x0 - hx, y0], [x0 - hx * 0.5, y0], [...
[ "def", "linearize", "(", "wcsim", ",", "wcsima", ",", "wcsref", ",", "imcrpix", ",", "f", ",", "shift", ",", "hx", "=", "1.0", ",", "hy", "=", "1.0", ")", ":", "x0", "=", "imcrpix", "[", "0", "]", "y0", "=", "imcrpix", "[", "1", "]", "p", "="...
linearization using 5-point formula for first order derivative
[ "linearization", "using", "5", "-", "point", "formula", "for", "first", "order", "derivative" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L283-L312
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
update_refchip_with_shift
def update_refchip_with_shift(chip_wcs, wcslin, fitgeom='rscale', rot=0.0, scale=1.0, xsh=0.0, ysh=0.0, fit=None, xrms=None, yrms=None): """ Compute the matrix for the scale and rotation correction Parameters ---------- chip_wcs: wcs object ...
python
def update_refchip_with_shift(chip_wcs, wcslin, fitgeom='rscale', rot=0.0, scale=1.0, xsh=0.0, ysh=0.0, fit=None, xrms=None, yrms=None): """ Compute the matrix for the scale and rotation correction Parameters ---------- chip_wcs: wcs object ...
[ "def", "update_refchip_with_shift", "(", "chip_wcs", ",", "wcslin", ",", "fitgeom", "=", "'rscale'", ",", "rot", "=", "0.0", ",", "scale", "=", "1.0", ",", "xsh", "=", "0.0", ",", "ysh", "=", "0.0", ",", "fit", "=", "None", ",", "xrms", "=", "None", ...
Compute the matrix for the scale and rotation correction Parameters ---------- chip_wcs: wcs object HST of the input image wcslin: wcs object Reference WCS from which the offsets/rotations are determined fitgeom: str NOT USED rot : float Amount of rotation measur...
[ "Compute", "the", "matrix", "for", "the", "scale", "and", "rotation", "correction" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L315-L418
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
update_wcs
def update_wcs(image,extnum,new_wcs,wcsname="",reusename=False,verbose=False): """ Updates the WCS of the specified extension number with the new WCS after archiving the original WCS. The value of 'new_wcs' needs to be the full HSTWCS object. Parameters ---------- image : str F...
python
def update_wcs(image,extnum,new_wcs,wcsname="",reusename=False,verbose=False): """ Updates the WCS of the specified extension number with the new WCS after archiving the original WCS. The value of 'new_wcs' needs to be the full HSTWCS object. Parameters ---------- image : str F...
[ "def", "update_wcs", "(", "image", ",", "extnum", ",", "new_wcs", ",", "wcsname", "=", "\"\"", ",", "reusename", "=", "False", ",", "verbose", "=", "False", ")", ":", "# Start by insuring that the correct value of 'orientat' has been computed", "new_wcs", ".", "setO...
Updates the WCS of the specified extension number with the new WCS after archiving the original WCS. The value of 'new_wcs' needs to be the full HSTWCS object. Parameters ---------- image : str Filename of image with WCS that needs to be updated extnum : int Extension numb...
[ "Updates", "the", "WCS", "of", "the", "specified", "extension", "number", "with", "the", "new", "WCS", "after", "archiving", "the", "original", "WCS", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L424-L520
spacetelescope/drizzlepac
drizzlepac/updatehdr.py
create_unique_wcsname
def create_unique_wcsname(fimg, extnum, wcsname): """ This function evaluates whether the specified wcsname value has already been used in this image. If so, it automatically modifies the name with a simple version ID using wcsname_NNN format. Parameters ---------- fimg : obj PyFIT...
python
def create_unique_wcsname(fimg, extnum, wcsname): """ This function evaluates whether the specified wcsname value has already been used in this image. If so, it automatically modifies the name with a simple version ID using wcsname_NNN format. Parameters ---------- fimg : obj PyFIT...
[ "def", "create_unique_wcsname", "(", "fimg", ",", "extnum", ",", "wcsname", ")", ":", "wnames", "=", "list", "(", "wcsutil", ".", "altwcs", ".", "wcsnames", "(", "fimg", ",", "ext", "=", "extnum", ")", ".", "values", "(", ")", ")", "if", "wcsname", "...
This function evaluates whether the specified wcsname value has already been used in this image. If so, it automatically modifies the name with a simple version ID using wcsname_NNN format. Parameters ---------- fimg : obj PyFITS object of image with WCS information to be updated extn...
[ "This", "function", "evaluates", "whether", "the", "specified", "wcsname", "value", "has", "already", "been", "used", "in", "this", "image", ".", "If", "so", "it", "automatically", "modifies", "the", "name", "with", "a", "simple", "version", "ID", "using", "...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L523-L561
spacetelescope/drizzlepac
drizzlepac/util.py
get_pool_size
def get_pool_size(usr_config_value, num_tasks): """ Determine size of thread/process-pool for parallel processing. This examines the cpu_count to decide and return the right pool size to use. Also take into account the user's wishes via the config object value, if specified. On top of that, don't allo...
python
def get_pool_size(usr_config_value, num_tasks): """ Determine size of thread/process-pool for parallel processing. This examines the cpu_count to decide and return the right pool size to use. Also take into account the user's wishes via the config object value, if specified. On top of that, don't allo...
[ "def", "get_pool_size", "(", "usr_config_value", ",", "num_tasks", ")", ":", "if", "not", "can_parallel", ":", "return", "1", "# Give priority to their specified cfg value, over the actual cpu count", "if", "usr_config_value", "is", "not", "None", ":", "if", "num_tasks", ...
Determine size of thread/process-pool for parallel processing. This examines the cpu_count to decide and return the right pool size to use. Also take into account the user's wishes via the config object value, if specified. On top of that, don't allow the pool size returned to be any higher than the n...
[ "Determine", "size", "of", "thread", "/", "process", "-", "pool", "for", "parallel", "processing", ".", "This", "examines", "the", "cpu_count", "to", "decide", "and", "return", "the", "right", "pool", "size", "to", "use", ".", "Also", "take", "into", "acco...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L51-L76
spacetelescope/drizzlepac
drizzlepac/util.py
init_logging
def init_logging(logfile=DEFAULT_LOGNAME, default=None, level=logging.INFO): """ Set up logger for capturing stdout/stderr messages. Must be called prior to writing any messages that you want to log. """ if logfile == "INDEF": if not is_blank(default): logname = fileutil.buildN...
python
def init_logging(logfile=DEFAULT_LOGNAME, default=None, level=logging.INFO): """ Set up logger for capturing stdout/stderr messages. Must be called prior to writing any messages that you want to log. """ if logfile == "INDEF": if not is_blank(default): logname = fileutil.buildN...
[ "def", "init_logging", "(", "logfile", "=", "DEFAULT_LOGNAME", ",", "default", "=", "None", ",", "level", "=", "logging", ".", "INFO", ")", ":", "if", "logfile", "==", "\"INDEF\"", ":", "if", "not", "is_blank", "(", "default", ")", ":", "logname", "=", ...
Set up logger for capturing stdout/stderr messages. Must be called prior to writing any messages that you want to log.
[ "Set", "up", "logger", "for", "capturing", "stdout", "/", "stderr", "messages", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L100-L146
spacetelescope/drizzlepac
drizzlepac/util.py
end_logging
def end_logging(filename=None): """ Close log file and restore system defaults. """ if logutil.global_logging_started: if filename: print('Trailer file written to: ', filename) else: # This generally shouldn't happen if logging was started with # init...
python
def end_logging(filename=None): """ Close log file and restore system defaults. """ if logutil.global_logging_started: if filename: print('Trailer file written to: ', filename) else: # This generally shouldn't happen if logging was started with # init...
[ "def", "end_logging", "(", "filename", "=", "None", ")", ":", "if", "logutil", ".", "global_logging_started", ":", "if", "filename", ":", "print", "(", "'Trailer file written to: '", ",", "filename", ")", "else", ":", "# This generally shouldn't happen if logging was ...
Close log file and restore system defaults.
[ "Close", "log", "file", "and", "restore", "system", "defaults", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L149-L164
spacetelescope/drizzlepac
drizzlepac/util.py
findrootname
def findrootname(filename): """ Return the rootname of the given file. """ puncloc = [filename.find(char) for char in string.punctuation] if sys.version_info[0] >= 3: val = sys.maxsize else: val = sys.maxint for num in puncloc: if num !=-1 and num < val: ...
python
def findrootname(filename): """ Return the rootname of the given file. """ puncloc = [filename.find(char) for char in string.punctuation] if sys.version_info[0] >= 3: val = sys.maxsize else: val = sys.maxint for num in puncloc: if num !=-1 and num < val: ...
[ "def", "findrootname", "(", "filename", ")", ":", "puncloc", "=", "[", "filename", ".", "find", "(", "char", ")", "for", "char", "in", "string", ".", "punctuation", "]", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "val", "=", "...
Return the rootname of the given file.
[ "Return", "the", "rootname", "of", "the", "given", "file", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L390-L403
spacetelescope/drizzlepac
drizzlepac/util.py
removeFileSafely
def removeFileSafely(filename,clobber=True): """ Delete the file specified, but only if it exists and clobber is True. """ if filename is not None and filename.strip() != '': if os.path.exists(filename) and clobber: os.remove(filename)
python
def removeFileSafely(filename,clobber=True): """ Delete the file specified, but only if it exists and clobber is True. """ if filename is not None and filename.strip() != '': if os.path.exists(filename) and clobber: os.remove(filename)
[ "def", "removeFileSafely", "(", "filename", ",", "clobber", "=", "True", ")", ":", "if", "filename", "is", "not", "None", "and", "filename", ".", "strip", "(", ")", "!=", "''", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", "and",...
Delete the file specified, but only if it exists and clobber is True.
[ "Delete", "the", "file", "specified", "but", "only", "if", "it", "exists", "and", "clobber", "is", "True", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L406-L410
spacetelescope/drizzlepac
drizzlepac/util.py
displayEmptyInputWarningBox
def displayEmptyInputWarningBox(display=True, parent=None): """ Displays a warning box for the 'input' parameter. """ if sys.version_info[0] >= 3: from tkinter.messagebox import showwarning else: from tkMessageBox import showwarning if display: msg = 'No valid input files fo...
python
def displayEmptyInputWarningBox(display=True, parent=None): """ Displays a warning box for the 'input' parameter. """ if sys.version_info[0] >= 3: from tkinter.messagebox import showwarning else: from tkMessageBox import showwarning if display: msg = 'No valid input files fo...
[ "def", "displayEmptyInputWarningBox", "(", "display", "=", "True", ",", "parent", "=", "None", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "from", "tkinter", ".", "messagebox", "import", "showwarning", "else", ":", "from", ...
Displays a warning box for the 'input' parameter.
[ "Displays", "a", "warning", "box", "for", "the", "input", "parameter", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L412-L424
spacetelescope/drizzlepac
drizzlepac/util.py
count_sci_extensions
def count_sci_extensions(filename): """ Return the number of SCI extensions and the EXTNAME from a input MEF file. """ num_sci = 0 extname = 'SCI' hdu_list = fileutil.openImage(filename, memmap=False) for extn in hdu_list: if 'extname' in extn.header and extn.header['extname'] == extna...
python
def count_sci_extensions(filename): """ Return the number of SCI extensions and the EXTNAME from a input MEF file. """ num_sci = 0 extname = 'SCI' hdu_list = fileutil.openImage(filename, memmap=False) for extn in hdu_list: if 'extname' in extn.header and extn.header['extname'] == extna...
[ "def", "count_sci_extensions", "(", "filename", ")", ":", "num_sci", "=", "0", "extname", "=", "'SCI'", "hdu_list", "=", "fileutil", ".", "openImage", "(", "filename", ",", "memmap", "=", "False", ")", "for", "extn", "in", "hdu_list", ":", "if", "'extname'...
Return the number of SCI extensions and the EXTNAME from a input MEF file.
[ "Return", "the", "number", "of", "SCI", "extensions", "and", "the", "EXTNAME", "from", "a", "input", "MEF", "file", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L451-L469
spacetelescope/drizzlepac
drizzlepac/util.py
verifyUniqueWcsname
def verifyUniqueWcsname(fname,wcsname): """ Report whether or not the specified WCSNAME already exists in the file """ uniq = True numsci,extname = count_sci_extensions(fname) wnames = altwcs.wcsnames(fname,ext=(extname,1)) if wcsname in wnames.values(): uniq = False return uni...
python
def verifyUniqueWcsname(fname,wcsname): """ Report whether or not the specified WCSNAME already exists in the file """ uniq = True numsci,extname = count_sci_extensions(fname) wnames = altwcs.wcsnames(fname,ext=(extname,1)) if wcsname in wnames.values(): uniq = False return uni...
[ "def", "verifyUniqueWcsname", "(", "fname", ",", "wcsname", ")", ":", "uniq", "=", "True", "numsci", ",", "extname", "=", "count_sci_extensions", "(", "fname", ")", "wnames", "=", "altwcs", ".", "wcsnames", "(", "fname", ",", "ext", "=", "(", "extname", ...
Report whether or not the specified WCSNAME already exists in the file
[ "Report", "whether", "or", "not", "the", "specified", "WCSNAME", "already", "exists", "in", "the", "file" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L471-L482
spacetelescope/drizzlepac
drizzlepac/util.py
verifyUpdatewcs
def verifyUpdatewcs(fname): """ Verify the existence of WCSNAME in the file. If it is not present, report this to the user and raise an exception. Returns True if WCSNAME was found in all SCI extensions. """ updated = True numsci,extname = count_sci_extensions(fname) for n in range(1,n...
python
def verifyUpdatewcs(fname): """ Verify the existence of WCSNAME in the file. If it is not present, report this to the user and raise an exception. Returns True if WCSNAME was found in all SCI extensions. """ updated = True numsci,extname = count_sci_extensions(fname) for n in range(1,n...
[ "def", "verifyUpdatewcs", "(", "fname", ")", ":", "updated", "=", "True", "numsci", ",", "extname", "=", "count_sci_extensions", "(", "fname", ")", "for", "n", "in", "range", "(", "1", ",", "numsci", "+", "1", ")", ":", "hdr", "=", "fits", ".", "geth...
Verify the existence of WCSNAME in the file. If it is not present, report this to the user and raise an exception. Returns True if WCSNAME was found in all SCI extensions.
[ "Verify", "the", "existence", "of", "WCSNAME", "in", "the", "file", ".", "If", "it", "is", "not", "present", "report", "this", "to", "the", "user", "and", "raise", "an", "exception", ".", "Returns", "True", "if", "WCSNAME", "was", "found", "in", "all", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L484-L497
spacetelescope/drizzlepac
drizzlepac/util.py
verifyRefimage
def verifyRefimage(refimage): """ Verify that the value of refimage specified by the user points to an extension with a proper WCS defined. It starts by making sure an extension gets specified by the user when using a MEF file. The final check comes by looking for a CD matrix in the WCS object itsel...
python
def verifyRefimage(refimage): """ Verify that the value of refimage specified by the user points to an extension with a proper WCS defined. It starts by making sure an extension gets specified by the user when using a MEF file. The final check comes by looking for a CD matrix in the WCS object itsel...
[ "def", "verifyRefimage", "(", "refimage", ")", ":", "valid", "=", "True", "# start by trying to see whether the code can even find the file", "if", "is_blank", "(", "refimage", ")", ":", "valid", "=", "True", "return", "valid", "refroot", ",", "extroot", "=", "fileu...
Verify that the value of refimage specified by the user points to an extension with a proper WCS defined. It starts by making sure an extension gets specified by the user when using a MEF file. The final check comes by looking for a CD matrix in the WCS object itself. If either test fails, it returns a ...
[ "Verify", "that", "the", "value", "of", "refimage", "specified", "by", "the", "user", "points", "to", "an", "extension", "with", "a", "proper", "WCS", "defined", ".", "It", "starts", "by", "making", "sure", "an", "extension", "gets", "specified", "by", "th...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L499-L536
spacetelescope/drizzlepac
drizzlepac/util.py
findWCSExtn
def findWCSExtn(filename): """ Return new filename with extension that points to an extension with a valid WCS. Returns ======= extnum : str, None Value of extension name as a string either as provided by the user or based on the extension number for the firs...
python
def findWCSExtn(filename): """ Return new filename with extension that points to an extension with a valid WCS. Returns ======= extnum : str, None Value of extension name as a string either as provided by the user or based on the extension number for the firs...
[ "def", "findWCSExtn", "(", "filename", ")", ":", "rootname", ",", "extroot", "=", "fileutil", ".", "parseFilename", "(", "filename", ")", "extnum", "=", "None", "if", "extroot", "is", "None", ":", "fimg", "=", "fits", ".", "open", "(", "rootname", ",", ...
Return new filename with extension that points to an extension with a valid WCS. Returns ======= extnum : str, None Value of extension name as a string either as provided by the user or based on the extension number for the first extension which conta...
[ "Return", "new", "filename", "with", "extension", "that", "points", "to", "an", "extension", "with", "a", "valid", "WCS", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L538-L577
spacetelescope/drizzlepac
drizzlepac/util.py
verifyFilePermissions
def verifyFilePermissions(filelist, chmod=True): """ Verify that images specified in 'filelist' can be updated. A message will be printed reporting the names of any images which do not have write-permission, then quit. """ badfiles = [] archive_dir = False for img in filelist: fname...
python
def verifyFilePermissions(filelist, chmod=True): """ Verify that images specified in 'filelist' can be updated. A message will be printed reporting the names of any images which do not have write-permission, then quit. """ badfiles = [] archive_dir = False for img in filelist: fname...
[ "def", "verifyFilePermissions", "(", "filelist", ",", "chmod", "=", "True", ")", ":", "badfiles", "=", "[", "]", "archive_dir", "=", "False", "for", "img", "in", "filelist", ":", "fname", "=", "fileutil", ".", "osfn", "(", "img", ")", "if", "'OrIg_files'...
Verify that images specified in 'filelist' can be updated. A message will be printed reporting the names of any images which do not have write-permission, then quit.
[ "Verify", "that", "images", "specified", "in", "filelist", "can", "be", "updated", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L580-L623
spacetelescope/drizzlepac
drizzlepac/util.py
getFullParList
def getFullParList(configObj): """ Return a single list of all parameter names included in the configObj regardless of which section the parameter was stored """ plist = [] for par in configObj.keys(): if isinstance(configObj[par],configobj.Section): plist.extend(getFullParLi...
python
def getFullParList(configObj): """ Return a single list of all parameter names included in the configObj regardless of which section the parameter was stored """ plist = [] for par in configObj.keys(): if isinstance(configObj[par],configobj.Section): plist.extend(getFullParLi...
[ "def", "getFullParList", "(", "configObj", ")", ":", "plist", "=", "[", "]", "for", "par", "in", "configObj", ".", "keys", "(", ")", ":", "if", "isinstance", "(", "configObj", "[", "par", "]", ",", "configobj", ".", "Section", ")", ":", "plist", ".",...
Return a single list of all parameter names included in the configObj regardless of which section the parameter was stored
[ "Return", "a", "single", "list", "of", "all", "parameter", "names", "included", "in", "the", "configObj", "regardless", "of", "which", "section", "the", "parameter", "was", "stored" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L625-L636
spacetelescope/drizzlepac
drizzlepac/util.py
validateUserPars
def validateUserPars(configObj,input_dict): """ Compares input parameter names specified by user with those already recognized by the task. Any parameters provided by the user that does not match a known task parameter will be reported and a ValueError exception will be raised. ...
python
def validateUserPars(configObj,input_dict): """ Compares input parameter names specified by user with those already recognized by the task. Any parameters provided by the user that does not match a known task parameter will be reported and a ValueError exception will be raised. ...
[ "def", "validateUserPars", "(", "configObj", ",", "input_dict", ")", ":", "# check to see whether any input parameters are unexpected.", "# Any unexpected parameters provided on input should be reported and", "# the code should stop", "plist", "=", "getFullParList", "(", "configObj", ...
Compares input parameter names specified by user with those already recognized by the task. Any parameters provided by the user that does not match a known task parameter will be reported and a ValueError exception will be raised.
[ "Compares", "input", "parameter", "names", "specified", "by", "user", "with", "those", "already", "recognized", "by", "the", "task", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L638-L661
spacetelescope/drizzlepac
drizzlepac/util.py
applyUserPars_steps
def applyUserPars_steps(configObj, input_dict, step='3a'): """ Apply logic to turn on use of user-specified output WCS if user provides any parameter on command-line regardless of how final_wcs was set. """ step_kws = {'7a': 'final_wcs', '3a': 'driz_sep_wcs'} stepname = getSectionName(configObj,...
python
def applyUserPars_steps(configObj, input_dict, step='3a'): """ Apply logic to turn on use of user-specified output WCS if user provides any parameter on command-line regardless of how final_wcs was set. """ step_kws = {'7a': 'final_wcs', '3a': 'driz_sep_wcs'} stepname = getSectionName(configObj,...
[ "def", "applyUserPars_steps", "(", "configObj", ",", "input_dict", ",", "step", "=", "'3a'", ")", ":", "step_kws", "=", "{", "'7a'", ":", "'final_wcs'", ",", "'3a'", ":", "'driz_sep_wcs'", "}", "stepname", "=", "getSectionName", "(", "configObj", ",", "step"...
Apply logic to turn on use of user-specified output WCS if user provides any parameter on command-line regardless of how final_wcs was set.
[ "Apply", "logic", "to", "turn", "on", "use", "of", "user", "-", "specified", "output", "WCS", "if", "user", "provides", "any", "parameter", "on", "command", "-", "line", "regardless", "of", "how", "final_wcs", "was", "set", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L663-L677
spacetelescope/drizzlepac
drizzlepac/util.py
getDefaultConfigObj
def getDefaultConfigObj(taskname,configObj,input_dict={},loadOnly=True): """ Return default configObj instance for task updated with user-specified values from input_dict. Parameters ---------- taskname : string Name of task to load into TEAL configObj : string ...
python
def getDefaultConfigObj(taskname,configObj,input_dict={},loadOnly=True): """ Return default configObj instance for task updated with user-specified values from input_dict. Parameters ---------- taskname : string Name of task to load into TEAL configObj : string ...
[ "def", "getDefaultConfigObj", "(", "taskname", ",", "configObj", ",", "input_dict", "=", "{", "}", ",", "loadOnly", "=", "True", ")", ":", "if", "configObj", "is", "None", ":", "# Start by grabbing the default values without using the GUI", "# This insures that all subs...
Return default configObj instance for task updated with user-specified values from input_dict. Parameters ---------- taskname : string Name of task to load into TEAL configObj : string The valid values for 'configObj' would be:: None ...
[ "Return", "default", "configObj", "instance", "for", "task", "updated", "with", "user", "-", "specified", "values", "from", "input_dict", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L680-L743
spacetelescope/drizzlepac
drizzlepac/util.py
getSectionName
def getSectionName(configObj,stepnum): """ Return section label based on step number. """ for key in configObj.keys(): if key.find('STEP '+str(stepnum)+':') >= 0: return key
python
def getSectionName(configObj,stepnum): """ Return section label based on step number. """ for key in configObj.keys(): if key.find('STEP '+str(stepnum)+':') >= 0: return key
[ "def", "getSectionName", "(", "configObj", ",", "stepnum", ")", ":", "for", "key", "in", "configObj", ".", "keys", "(", ")", ":", "if", "key", ".", "find", "(", "'STEP '", "+", "str", "(", "stepnum", ")", "+", "':'", ")", ">=", "0", ":", "return", ...
Return section label based on step number.
[ "Return", "section", "label", "based", "on", "step", "number", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L745-L750
spacetelescope/drizzlepac
drizzlepac/util.py
displayMakewcsWarningBox
def displayMakewcsWarningBox(display=True, parent=None): """ Displays a warning box for the 'makewcs' parameter. """ if sys.version_info[0] >= 3: from tkinter.messagebox import showwarning else: from tkMessageBox import showwarning ans = {'yes':True,'no':False} if ans[display]: ...
python
def displayMakewcsWarningBox(display=True, parent=None): """ Displays a warning box for the 'makewcs' parameter. """ if sys.version_info[0] >= 3: from tkinter.messagebox import showwarning else: from tkMessageBox import showwarning ans = {'yes':True,'no':False} if ans[display]: ...
[ "def", "displayMakewcsWarningBox", "(", "display", "=", "True", ",", "parent", "=", "None", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "from", "tkinter", ".", "messagebox", "import", "showwarning", "else", ":", "from", "tk...
Displays a warning box for the 'makewcs' parameter.
[ "Displays", "a", "warning", "box", "for", "the", "makewcs", "parameter", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L758-L772
spacetelescope/drizzlepac
drizzlepac/util.py
printParams
def printParams(paramDictionary, all=False, log=None): """ Print nicely the parameters from the dictionary. """ if log is not None: def output(msg): log.info(msg) else: def output(msg): print(msg) if not paramDictionary: output('No parameters wer...
python
def printParams(paramDictionary, all=False, log=None): """ Print nicely the parameters from the dictionary. """ if log is not None: def output(msg): log.info(msg) else: def output(msg): print(msg) if not paramDictionary: output('No parameters wer...
[ "def", "printParams", "(", "paramDictionary", ",", "all", "=", "False", ",", "log", "=", "None", ")", ":", "if", "log", "is", "not", "None", ":", "def", "output", "(", "msg", ")", ":", "log", ".", "info", "(", "msg", ")", "else", ":", "def", "out...
Print nicely the parameters from the dictionary.
[ "Print", "nicely", "the", "parameters", "from", "the", "dictionary", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L799-L820
spacetelescope/drizzlepac
drizzlepac/util.py
isCommaList
def isCommaList(inputFilelist): """Return True if the input is a comma separated list of names.""" if isinstance(inputFilelist, int) or isinstance(inputFilelist, np.int32): ilist = str(inputFilelist) else: ilist = inputFilelist if "," in ilist: return True return False
python
def isCommaList(inputFilelist): """Return True if the input is a comma separated list of names.""" if isinstance(inputFilelist, int) or isinstance(inputFilelist, np.int32): ilist = str(inputFilelist) else: ilist = inputFilelist if "," in ilist: return True return False
[ "def", "isCommaList", "(", "inputFilelist", ")", ":", "if", "isinstance", "(", "inputFilelist", ",", "int", ")", "or", "isinstance", "(", "inputFilelist", ",", "np", ".", "int32", ")", ":", "ilist", "=", "str", "(", "inputFilelist", ")", "else", ":", "il...
Return True if the input is a comma separated list of names.
[ "Return", "True", "if", "the", "input", "is", "a", "comma", "separated", "list", "of", "names", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L860-L868
spacetelescope/drizzlepac
drizzlepac/util.py
loadFileList
def loadFileList(inputFilelist): """Open up the '@ file' and read in the science and possible ivm filenames from the first two columns. """ f = open(inputFilelist[1:]) # check the first line in order to determine whether # IVM files have been specified in a second column... lines = f.read...
python
def loadFileList(inputFilelist): """Open up the '@ file' and read in the science and possible ivm filenames from the first two columns. """ f = open(inputFilelist[1:]) # check the first line in order to determine whether # IVM files have been specified in a second column... lines = f.read...
[ "def", "loadFileList", "(", "inputFilelist", ")", ":", "f", "=", "open", "(", "inputFilelist", "[", "1", ":", "]", ")", "# check the first line in order to determine whether", "# IVM files have been specified in a second column...", "lines", "=", "f", ".", "readline", "...
Open up the '@ file' and read in the science and possible ivm filenames from the first two columns.
[ "Open", "up", "the" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L870-L887
spacetelescope/drizzlepac
drizzlepac/util.py
readCommaList
def readCommaList(fileList): """ Return a list of the files with the commas removed. """ names=fileList.split(',') fileList=[] for item in names: fileList.append(item) return fileList
python
def readCommaList(fileList): """ Return a list of the files with the commas removed. """ names=fileList.split(',') fileList=[] for item in names: fileList.append(item) return fileList
[ "def", "readCommaList", "(", "fileList", ")", ":", "names", "=", "fileList", ".", "split", "(", "','", ")", "fileList", "=", "[", "]", "for", "item", "in", "names", ":", "fileList", ".", "append", "(", "item", ")", "return", "fileList" ]
Return a list of the files with the commas removed.
[ "Return", "a", "list", "of", "the", "files", "with", "the", "commas", "removed", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L890-L896
spacetelescope/drizzlepac
drizzlepac/util.py
update_input
def update_input(filelist, ivmlist=None, removed_files=None): """ Removes files flagged to be removed from the input filelist. Removes the corresponding ivm files if present. """ newfilelist = [] if removed_files == []: return filelist, ivmlist else: sci_ivm = list(zip(filel...
python
def update_input(filelist, ivmlist=None, removed_files=None): """ Removes files flagged to be removed from the input filelist. Removes the corresponding ivm files if present. """ newfilelist = [] if removed_files == []: return filelist, ivmlist else: sci_ivm = list(zip(filel...
[ "def", "update_input", "(", "filelist", ",", "ivmlist", "=", "None", ",", "removed_files", "=", "None", ")", ":", "newfilelist", "=", "[", "]", "if", "removed_files", "==", "[", "]", ":", "return", "filelist", ",", "ivmlist", "else", ":", "sci_ivm", "=",...
Removes files flagged to be removed from the input filelist. Removes the corresponding ivm files if present.
[ "Removes", "files", "flagged", "to", "be", "removed", "from", "the", "input", "filelist", ".", "Removes", "the", "corresponding", "ivm", "files", "if", "present", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L920-L935
spacetelescope/drizzlepac
drizzlepac/util.py
get_expstart
def get_expstart(header,primary_hdr): """shouldn't this just be defined in the instrument subclass of imageobject?""" if 'expstart' in primary_hdr: exphdr = primary_hdr else: exphdr = header if 'EXPSTART' in exphdr: expstart = float(exphdr['EXPSTART']) expend = float(ex...
python
def get_expstart(header,primary_hdr): """shouldn't this just be defined in the instrument subclass of imageobject?""" if 'expstart' in primary_hdr: exphdr = primary_hdr else: exphdr = header if 'EXPSTART' in exphdr: expstart = float(exphdr['EXPSTART']) expend = float(ex...
[ "def", "get_expstart", "(", "header", ",", "primary_hdr", ")", ":", "if", "'expstart'", "in", "primary_hdr", ":", "exphdr", "=", "primary_hdr", "else", ":", "exphdr", "=", "header", "if", "'EXPSTART'", "in", "exphdr", ":", "expstart", "=", "float", "(", "e...
shouldn't this just be defined in the instrument subclass of imageobject?
[ "shouldn", "t", "this", "just", "be", "defined", "in", "the", "instrument", "subclass", "of", "imageobject?" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L967-L982
spacetelescope/drizzlepac
drizzlepac/util.py
compute_texptime
def compute_texptime(imageObjectList): """ Add up the exposure time for all the members in the pattern, since 'drizzle' doesn't have the necessary information to correctly set this itself. """ expnames = [] exptimes = [] start = [] end = [] for img in imageObjectList: exp...
python
def compute_texptime(imageObjectList): """ Add up the exposure time for all the members in the pattern, since 'drizzle' doesn't have the necessary information to correctly set this itself. """ expnames = [] exptimes = [] start = [] end = [] for img in imageObjectList: exp...
[ "def", "compute_texptime", "(", "imageObjectList", ")", ":", "expnames", "=", "[", "]", "exptimes", "=", "[", "]", "start", "=", "[", "]", "end", "=", "[", "]", "for", "img", "in", "imageObjectList", ":", "expnames", "+=", "img", ".", "getKeywordList", ...
Add up the exposure time for all the members in the pattern, since 'drizzle' doesn't have the necessary information to correctly set this itself.
[ "Add", "up", "the", "exposure", "time", "for", "all", "the", "members", "in", "the", "pattern", "since", "drizzle", "doesn", "t", "have", "the", "necessary", "information", "to", "correctly", "set", "this", "itself", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L984-L1009
spacetelescope/drizzlepac
drizzlepac/util.py
computeRange
def computeRange(corners): """ Determine the range spanned by an array of pixel positions. """ x = corners[:, 0] y = corners[:, 1] _xrange = (np.minimum.reduce(x), np.maximum.reduce(x)) _yrange = (np.minimum.reduce(y), np.maximum.reduce(y)) return _xrange, _yrange
python
def computeRange(corners): """ Determine the range spanned by an array of pixel positions. """ x = corners[:, 0] y = corners[:, 1] _xrange = (np.minimum.reduce(x), np.maximum.reduce(x)) _yrange = (np.minimum.reduce(y), np.maximum.reduce(y)) return _xrange, _yrange
[ "def", "computeRange", "(", "corners", ")", ":", "x", "=", "corners", "[", ":", ",", "0", "]", "y", "=", "corners", "[", ":", ",", "1", "]", "_xrange", "=", "(", "np", ".", "minimum", ".", "reduce", "(", "x", ")", ",", "np", ".", "maximum", "...
Determine the range spanned by an array of pixel positions.
[ "Determine", "the", "range", "spanned", "by", "an", "array", "of", "pixel", "positions", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1012-L1018
spacetelescope/drizzlepac
drizzlepac/util.py
getRotatedSize
def getRotatedSize(corners, angle): """ Determine the size of a rotated (meta)image.""" if angle: _rotm = fileutil.buildRotMatrix(angle) # Rotate about the center _corners = np.dot(corners, _rotm) else: # If there is no rotation, simply return original values _corners...
python
def getRotatedSize(corners, angle): """ Determine the size of a rotated (meta)image.""" if angle: _rotm = fileutil.buildRotMatrix(angle) # Rotate about the center _corners = np.dot(corners, _rotm) else: # If there is no rotation, simply return original values _corners...
[ "def", "getRotatedSize", "(", "corners", ",", "angle", ")", ":", "if", "angle", ":", "_rotm", "=", "fileutil", ".", "buildRotMatrix", "(", "angle", ")", "# Rotate about the center", "_corners", "=", "np", ".", "dot", "(", "corners", ",", "_rotm", ")", "els...
Determine the size of a rotated (meta)image.
[ "Determine", "the", "size", "of", "a", "rotated", "(", "meta", ")", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1021-L1031
spacetelescope/drizzlepac
drizzlepac/util.py
readcols
def readcols(infile, cols=[0, 1, 2, 3], hms=False): """ Read the columns from an ASCII file as numpy arrays. Parameters ---------- infile : str Filename of ASCII file with array data as columns. cols : list of int List of 0-indexed column numbers for columns to be turned into n...
python
def readcols(infile, cols=[0, 1, 2, 3], hms=False): """ Read the columns from an ASCII file as numpy arrays. Parameters ---------- infile : str Filename of ASCII file with array data as columns. cols : list of int List of 0-indexed column numbers for columns to be turned into n...
[ "def", "readcols", "(", "infile", ",", "cols", "=", "[", "0", ",", "1", ",", "2", ",", "3", "]", ",", "hms", "=", "False", ")", ":", "fin", "=", "open", "(", "infile", ",", "'r'", ")", "outarr", "=", "[", "]", "for", "l", "in", "fin", ".", ...
Read the columns from an ASCII file as numpy arrays. Parameters ---------- infile : str Filename of ASCII file with array data as columns. cols : list of int List of 0-indexed column numbers for columns to be turned into numpy arrays (DEFAULT- [0,1,2,3]). Returns -----...
[ "Read", "the", "columns", "from", "an", "ASCII", "file", "as", "numpy", "arrays", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1034-L1077
spacetelescope/drizzlepac
drizzlepac/util.py
parse_colnames
def parse_colnames(colnames,coords=None): """ Convert colnames input into list of column numbers. """ cols = [] if not isinstance(colnames,list): colnames = colnames.split(',') # parse column names from coords file and match to input values if coords is not None and fileutil.isFits(coord...
python
def parse_colnames(colnames,coords=None): """ Convert colnames input into list of column numbers. """ cols = [] if not isinstance(colnames,list): colnames = colnames.split(',') # parse column names from coords file and match to input values if coords is not None and fileutil.isFits(coord...
[ "def", "parse_colnames", "(", "colnames", ",", "coords", "=", "None", ")", ":", "cols", "=", "[", "]", "if", "not", "isinstance", "(", "colnames", ",", "list", ")", ":", "colnames", "=", "colnames", ".", "split", "(", "','", ")", "# parse column names fr...
Convert colnames input into list of column numbers.
[ "Convert", "colnames", "input", "into", "list", "of", "column", "numbers", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1079-L1118
spacetelescope/drizzlepac
drizzlepac/util.py
createFile
def createFile(dataArray=None, outfile=None, header=None): """ Create a simple fits file for the given data array and header. Returns either the FITS object in-membory when outfile==None or None when the FITS file was written out to a file. """ # Insure that at least a data-array has been provid...
python
def createFile(dataArray=None, outfile=None, header=None): """ Create a simple fits file for the given data array and header. Returns either the FITS object in-membory when outfile==None or None when the FITS file was written out to a file. """ # Insure that at least a data-array has been provid...
[ "def", "createFile", "(", "dataArray", "=", "None", ",", "outfile", "=", "None", ",", "header", "=", "None", ")", ":", "# Insure that at least a data-array has been provided to create the file", "assert", "(", "dataArray", "is", "not", "None", ")", ",", "\"Please su...
Create a simple fits file for the given data array and header. Returns either the FITS object in-membory when outfile==None or None when the FITS file was written out to a file.
[ "Create", "a", "simple", "fits", "file", "for", "the", "given", "data", "array", "and", "header", ".", "Returns", "either", "the", "FITS", "object", "in", "-", "membory", "when", "outfile", "==", "None", "or", "None", "when", "the", "FITS", "file", "was"...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1121-L1169
spacetelescope/drizzlepac
drizzlepac/util.py
base_taskname
def base_taskname(taskname, packagename=None): """ Extract the base name of the task. Many tasks in the `drizzlepac` have "compound" names such as 'drizzlepac.sky'. This function will search for the presence of a dot in the input `taskname` and if found, it will return the string to the right o...
python
def base_taskname(taskname, packagename=None): """ Extract the base name of the task. Many tasks in the `drizzlepac` have "compound" names such as 'drizzlepac.sky'. This function will search for the presence of a dot in the input `taskname` and if found, it will return the string to the right o...
[ "def", "base_taskname", "(", "taskname", ",", "packagename", "=", "None", ")", ":", "if", "not", "isinstance", "(", "taskname", ",", "str", ")", ":", "return", "taskname", "indx", "=", "taskname", ".", "rfind", "(", "'.'", ")", "if", "indx", ">=", "0",...
Extract the base name of the task. Many tasks in the `drizzlepac` have "compound" names such as 'drizzlepac.sky'. This function will search for the presence of a dot in the input `taskname` and if found, it will return the string to the right of the right-most dot. If a dot is not found, it will return...
[ "Extract", "the", "base", "name", "of", "the", "task", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1171-L1219
spacetelescope/drizzlepac
drizzlepac/util.py
ProcSteps.addStep
def addStep(self,key): """ Add information about a new step to the dict of steps The value 'ptime' is the output from '_ptime()' containing both the formatted and unformatted time for the start of the step. """ ptime = _ptime() print('==== Processing Step ...
python
def addStep(self,key): """ Add information about a new step to the dict of steps The value 'ptime' is the output from '_ptime()' containing both the formatted and unformatted time for the start of the step. """ ptime = _ptime() print('==== Processing Step ...
[ "def", "addStep", "(", "self", ",", "key", ")", ":", "ptime", "=", "_ptime", "(", ")", "print", "(", "'==== Processing Step '", ",", "key", ",", "' started at '", ",", "ptime", "[", "0", "]", ")", "self", ".", "steps", "[", "key", "]", "=", "{", "'...
Add information about a new step to the dict of steps The value 'ptime' is the output from '_ptime()' containing both the formatted and unformatted time for the start of the step.
[ "Add", "information", "about", "a", "new", "step", "to", "the", "dict", "of", "steps", "The", "value", "ptime", "is", "the", "output", "from", "_ptime", "()", "containing", "both", "the", "formatted", "and", "unformatted", "time", "for", "the", "start", "o...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L317-L327
spacetelescope/drizzlepac
drizzlepac/util.py
ProcSteps.endStep
def endStep(self,key): """ Record the end time for the step. If key==None, simply record ptime as end time for class to represent the overall runtime since the initialization of the class. """ ptime = _ptime() if key is not None: self.steps[key]['end'...
python
def endStep(self,key): """ Record the end time for the step. If key==None, simply record ptime as end time for class to represent the overall runtime since the initialization of the class. """ ptime = _ptime() if key is not None: self.steps[key]['end'...
[ "def", "endStep", "(", "self", ",", "key", ")", ":", "ptime", "=", "_ptime", "(", ")", "if", "key", "is", "not", "None", ":", "self", ".", "steps", "[", "key", "]", "[", "'end'", "]", "=", "ptime", "self", ".", "steps", "[", "key", "]", "[", ...
Record the end time for the step. If key==None, simply record ptime as end time for class to represent the overall runtime since the initialization of the class.
[ "Record", "the", "end", "time", "for", "the", "step", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L329-L343
spacetelescope/drizzlepac
drizzlepac/util.py
ProcSteps.reportTimes
def reportTimes(self): """ Print out a formatted summary of the elapsed times for all the performed steps. """ self.end = _ptime() total_time = 0 print(ProcSteps.__report_header) for step in self.order: if 'elapsed' in self.steps[step]: ...
python
def reportTimes(self): """ Print out a formatted summary of the elapsed times for all the performed steps. """ self.end = _ptime() total_time = 0 print(ProcSteps.__report_header) for step in self.order: if 'elapsed' in self.steps[step]: ...
[ "def", "reportTimes", "(", "self", ")", ":", "self", ".", "end", "=", "_ptime", "(", ")", "total_time", "=", "0", "print", "(", "ProcSteps", ".", "__report_header", ")", "for", "step", "in", "self", ".", "order", ":", "if", "'elapsed'", "in", "self", ...
Print out a formatted summary of the elapsed times for all the performed steps.
[ "Print", "out", "a", "formatted", "summary", "of", "the", "elapsed", "times", "for", "all", "the", "performed", "steps", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L345-L363
spacetelescope/drizzlepac
drizzlepac/buildmask.py
run
def run(configObj=None, input_dict={}, loadOnly=False): """ Build DQ masks from all input images, then apply static mask(s). """ # If called from interactive user-interface, configObj will not be # defined yet, so get defaults using EPAR/TEAL. # # Also insure that the input_dict (user-specified ...
python
def run(configObj=None, input_dict={}, loadOnly=False): """ Build DQ masks from all input images, then apply static mask(s). """ # If called from interactive user-interface, configObj will not be # defined yet, so get defaults using EPAR/TEAL. # # Also insure that the input_dict (user-specified ...
[ "def", "run", "(", "configObj", "=", "None", ",", "input_dict", "=", "{", "}", ",", "loadOnly", "=", "False", ")", ":", "# If called from interactive user-interface, configObj will not be", "# defined yet, so get defaults using EPAR/TEAL.", "#", "# Also insure that the input_...
Build DQ masks from all input images, then apply static mask(s).
[ "Build", "DQ", "masks", "from", "all", "input", "images", "then", "apply", "static", "mask", "(", "s", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L52-L68
spacetelescope/drizzlepac
drizzlepac/buildmask.py
buildDQMasks
def buildDQMasks(imageObjectList,configObj): """ Build DQ masks for all input images. """ # Insure that input imageObject is a list if not isinstance(imageObjectList, list): imageObjectList = [imageObjectList] for img in imageObjectList: img.buildMask(configObj['single'], configObj[...
python
def buildDQMasks(imageObjectList,configObj): """ Build DQ masks for all input images. """ # Insure that input imageObject is a list if not isinstance(imageObjectList, list): imageObjectList = [imageObjectList] for img in imageObjectList: img.buildMask(configObj['single'], configObj[...
[ "def", "buildDQMasks", "(", "imageObjectList", ",", "configObj", ")", ":", "# Insure that input imageObject is a list", "if", "not", "isinstance", "(", "imageObjectList", ",", "list", ")", ":", "imageObjectList", "=", "[", "imageObjectList", "]", "for", "img", "in",...
Build DQ masks for all input images.
[ "Build", "DQ", "masks", "for", "all", "input", "images", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L71-L79
spacetelescope/drizzlepac
drizzlepac/buildmask.py
buildMask
def buildMask(dqarr, bitvalue): """ Builds a bit-mask from an input DQ array and a bitvalue flag """ return bitfield_to_boolean_mask(dqarr, bitvalue, good_mask_value=1, dtype=np.uint8)
python
def buildMask(dqarr, bitvalue): """ Builds a bit-mask from an input DQ array and a bitvalue flag """ return bitfield_to_boolean_mask(dqarr, bitvalue, good_mask_value=1, dtype=np.uint8)
[ "def", "buildMask", "(", "dqarr", ",", "bitvalue", ")", ":", "return", "bitfield_to_boolean_mask", "(", "dqarr", ",", "bitvalue", ",", "good_mask_value", "=", "1", ",", "dtype", "=", "np", ".", "uint8", ")" ]
Builds a bit-mask from an input DQ array and a bitvalue flag
[ "Builds", "a", "bit", "-", "mask", "from", "an", "input", "DQ", "array", "and", "a", "bitvalue", "flag" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L82-L85
spacetelescope/drizzlepac
drizzlepac/buildmask.py
buildMaskImage
def buildMaskImage(rootname, bitvalue, output, extname='DQ', extver=1): """ Builds mask image from rootname's DQ array If there is no valid 'DQ' array in image, then return an empty string. """ # If no bitvalue is set or rootname given, assume no mask is desired # However, this name wou...
python
def buildMaskImage(rootname, bitvalue, output, extname='DQ', extver=1): """ Builds mask image from rootname's DQ array If there is no valid 'DQ' array in image, then return an empty string. """ # If no bitvalue is set or rootname given, assume no mask is desired # However, this name wou...
[ "def", "buildMaskImage", "(", "rootname", ",", "bitvalue", ",", "output", ",", "extname", "=", "'DQ'", ",", "extver", "=", "1", ")", ":", "# If no bitvalue is set or rootname given, assume no mask is desired", "# However, this name would be useful as the output mask from", "#...
Builds mask image from rootname's DQ array If there is no valid 'DQ' array in image, then return an empty string.
[ "Builds", "mask", "image", "from", "rootname", "s", "DQ", "array", "If", "there", "is", "no", "valid", "DQ", "array", "in", "image", "then", "return", "an", "empty", "string", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L88-L153
spacetelescope/drizzlepac
drizzlepac/buildmask.py
buildShadowMaskImage
def buildShadowMaskImage(dqfile,detnum,extnum,maskname,bitvalue=None,binned=1): """ Builds mask image from WFPC2 shadow calibrations. detnum - string value for 'DETECTOR' detector """ # insure detnum is a string if type(detnum) != type(''): detnum = repr(detnum) _funcroot = '_func_Sha...
python
def buildShadowMaskImage(dqfile,detnum,extnum,maskname,bitvalue=None,binned=1): """ Builds mask image from WFPC2 shadow calibrations. detnum - string value for 'DETECTOR' detector """ # insure detnum is a string if type(detnum) != type(''): detnum = repr(detnum) _funcroot = '_func_Sha...
[ "def", "buildShadowMaskImage", "(", "dqfile", ",", "detnum", ",", "extnum", ",", "maskname", ",", "bitvalue", "=", "None", ",", "binned", "=", "1", ")", ":", "# insure detnum is a string", "if", "type", "(", "detnum", ")", "!=", "type", "(", "''", ")", "...
Builds mask image from WFPC2 shadow calibrations. detnum - string value for 'DETECTOR' detector
[ "Builds", "mask", "image", "from", "WFPC2", "shadow", "calibrations", ".", "detnum", "-", "string", "value", "for", "DETECTOR", "detector" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L187-L278
spacetelescope/drizzlepac
drizzlepac/pixtosky.py
xy2rd
def xy2rd(input,x=None,y=None,coords=None, coordfile=None,colnames=None,separator=None, hms=True, precision=6,output=None,verbose=True): """ Primary interface to perform coordinate transformations from pixel to sky coordinates using STWCS and full distortion models read from the input im...
python
def xy2rd(input,x=None,y=None,coords=None, coordfile=None,colnames=None,separator=None, hms=True, precision=6,output=None,verbose=True): """ Primary interface to perform coordinate transformations from pixel to sky coordinates using STWCS and full distortion models read from the input im...
[ "def", "xy2rd", "(", "input", ",", "x", "=", "None", ",", "y", "=", "None", ",", "coords", "=", "None", ",", "coordfile", "=", "None", ",", "colnames", "=", "None", ",", "separator", "=", "None", ",", "hms", "=", "True", ",", "precision", "=", "6...
Primary interface to perform coordinate transformations from pixel to sky coordinates using STWCS and full distortion models read from the input image header.
[ "Primary", "interface", "to", "perform", "coordinate", "transformations", "from", "pixel", "to", "sky", "coordinates", "using", "STWCS", "and", "full", "distortion", "models", "read", "from", "the", "input", "image", "header", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/pixtosky.py#L102-L187
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
run
def run(configObj, wcsmap=None): """ Interface for running `wdrizzle` from TEAL or Python command-line. This code performs all file ``I/O`` to set up the use of the drizzle code for a single exposure to replicate the functionality of the original `wdrizzle`. """ # Insure all output filenames speci...
python
def run(configObj, wcsmap=None): """ Interface for running `wdrizzle` from TEAL or Python command-line. This code performs all file ``I/O`` to set up the use of the drizzle code for a single exposure to replicate the functionality of the original `wdrizzle`. """ # Insure all output filenames speci...
[ "def", "run", "(", "configObj", ",", "wcsmap", "=", "None", ")", ":", "# Insure all output filenames specified have .fits extensions", "if", "configObj", "[", "'outdata'", "]", "[", "-", "5", ":", "]", "!=", "'.fits'", ":", "configObj", "[", "'outdata'", "]", ...
Interface for running `wdrizzle` from TEAL or Python command-line. This code performs all file ``I/O`` to set up the use of the drizzle code for a single exposure to replicate the functionality of the original `wdrizzle`.
[ "Interface", "for", "running", "wdrizzle", "from", "TEAL", "or", "Python", "command", "-", "line", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L76-L317
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
mergeDQarray
def mergeDQarray(maskname,dqarr): """ Merge static or CR mask with mask created from DQ array on-the-fly here. """ maskarr = None if maskname is not None: if isinstance(maskname, str): # working with file on disk (default case) if os.path.exists(maskname): ...
python
def mergeDQarray(maskname,dqarr): """ Merge static or CR mask with mask created from DQ array on-the-fly here. """ maskarr = None if maskname is not None: if isinstance(maskname, str): # working with file on disk (default case) if os.path.exists(maskname): ...
[ "def", "mergeDQarray", "(", "maskname", ",", "dqarr", ")", ":", "maskarr", "=", "None", "if", "maskname", "is", "not", "None", ":", "if", "isinstance", "(", "maskname", ",", "str", ")", ":", "# working with file on disk (default case)", "if", "os", ".", "pat...
Merge static or CR mask with mask created from DQ array on-the-fly here.
[ "Merge", "static", "or", "CR", "mask", "with", "mask", "created", "from", "DQ", "array", "on", "-", "the", "-", "fly", "here", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L396-L416
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
_setDefaults
def _setDefaults(configObj={}): """set up the default parameters to run drizzle build,single,units,wt_scl,pixfrac,kernel,fillval, rot,scale,xsh,ysh,blotnx,blotny,outnx,outny,data Used exclusively for unit-testing, if any are defined. """ paramDict={"build":True, "single...
python
def _setDefaults(configObj={}): """set up the default parameters to run drizzle build,single,units,wt_scl,pixfrac,kernel,fillval, rot,scale,xsh,ysh,blotnx,blotny,outnx,outny,data Used exclusively for unit-testing, if any are defined. """ paramDict={"build":True, "single...
[ "def", "_setDefaults", "(", "configObj", "=", "{", "}", ")", ":", "paramDict", "=", "{", "\"build\"", ":", "True", ",", "\"single\"", ":", "True", ",", "\"stepsize\"", ":", "10", ",", "\"in_units\"", ":", "\"cps\"", ",", "\"wt_scl\"", ":", "1.", ",", "...
set up the default parameters to run drizzle build,single,units,wt_scl,pixfrac,kernel,fillval, rot,scale,xsh,ysh,blotnx,blotny,outnx,outny,data Used exclusively for unit-testing, if any are defined.
[ "set", "up", "the", "default", "parameters", "to", "run", "drizzle", "build", "single", "units", "wt_scl", "pixfrac", "kernel", "fillval", "rot", "scale", "xsh", "ysh", "blotnx", "blotny", "outnx", "outny", "data" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L473-L507
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
interpret_maskval
def interpret_maskval(paramDict): """ Apply logic for interpreting final_maskval value... """ # interpret user specified final_maskval value to use for initializing # output SCI array... if 'maskval' not in paramDict: return 0 maskval = paramDict['maskval'] if maskval is None: ...
python
def interpret_maskval(paramDict): """ Apply logic for interpreting final_maskval value... """ # interpret user specified final_maskval value to use for initializing # output SCI array... if 'maskval' not in paramDict: return 0 maskval = paramDict['maskval'] if maskval is None: ...
[ "def", "interpret_maskval", "(", "paramDict", ")", ":", "# interpret user specified final_maskval value to use for initializing", "# output SCI array...", "if", "'maskval'", "not", "in", "paramDict", ":", "return", "0", "maskval", "=", "paramDict", "[", "'maskval'", "]", ...
Apply logic for interpreting final_maskval value...
[ "Apply", "logic", "for", "interpreting", "final_maskval", "value", "..." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L509-L521
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
run_driz
def run_driz(imageObjectList,output_wcs,paramDict,single,build,wcsmap=None): """ Perform drizzle operation on input to create output. The input parameters originally was a list of dictionaries, one for each input, that matches the primary parameters for an ``IRAF`` `drizzle` task. This method would...
python
def run_driz(imageObjectList,output_wcs,paramDict,single,build,wcsmap=None): """ Perform drizzle operation on input to create output. The input parameters originally was a list of dictionaries, one for each input, that matches the primary parameters for an ``IRAF`` `drizzle` task. This method would...
[ "def", "run_driz", "(", "imageObjectList", ",", "output_wcs", ",", "paramDict", ",", "single", ",", "build", ",", "wcsmap", "=", "None", ")", ":", "# Insure that input imageObject is a list", "if", "not", "isinstance", "(", "imageObjectList", ",", "list", ")", "...
Perform drizzle operation on input to create output. The input parameters originally was a list of dictionaries, one for each input, that matches the primary parameters for an ``IRAF`` `drizzle` task. This method would then loop over all the entries in the list and run `drizzle` for each entry. ...
[ "Perform", "drizzle", "operation", "on", "input", "to", "create", "output", ".", "The", "input", "parameters", "originally", "was", "a", "list", "of", "dictionaries", "one", "for", "each", "input", "that", "matches", "the", "primary", "parameters", "for", "an"...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L523-L681
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
run_driz_img
def run_driz_img(img,chiplist,output_wcs,outwcs,template,paramDict,single, num_in_prod,build,_versions,_numctx,_nplanes,chipIdxCopy, _outsci,_outwht,_outctx,_hdrlist,wcsmap): """ Perform the drizzle operation on a single image. This is separated out from :py:func:`run_driz` so ...
python
def run_driz_img(img,chiplist,output_wcs,outwcs,template,paramDict,single, num_in_prod,build,_versions,_numctx,_nplanes,chipIdxCopy, _outsci,_outwht,_outctx,_hdrlist,wcsmap): """ Perform the drizzle operation on a single image. This is separated out from :py:func:`run_driz` so ...
[ "def", "run_driz_img", "(", "img", ",", "chiplist", ",", "output_wcs", ",", "outwcs", ",", "template", ",", "paramDict", ",", "single", ",", "num_in_prod", ",", "build", ",", "_versions", ",", "_numctx", ",", "_nplanes", ",", "chipIdxCopy", ",", "_outsci", ...
Perform the drizzle operation on a single image. This is separated out from :py:func:`run_driz` so as to keep together the entirety of the code which is inside the loop over images. See the :py:func:`run_driz` code for more documentation.
[ "Perform", "the", "drizzle", "operation", "on", "a", "single", "image", ".", "This", "is", "separated", "out", "from", ":", "py", ":", "func", ":", "run_driz", "so", "as", "to", "keep", "together", "the", "entirety", "of", "the", "code", "which", "is", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L689-L742
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
run_driz_chip
def run_driz_chip(img,chip,output_wcs,outwcs,template,paramDict,single, doWrite,build,_versions,_numctx,_nplanes,_numchips, _outsci,_outwht,_outctx,_hdrlist,wcsmap): """ Perform the drizzle operation on a single chip. This is separated out from `run_driz_img` so as to keep to...
python
def run_driz_chip(img,chip,output_wcs,outwcs,template,paramDict,single, doWrite,build,_versions,_numctx,_nplanes,_numchips, _outsci,_outwht,_outctx,_hdrlist,wcsmap): """ Perform the drizzle operation on a single chip. This is separated out from `run_driz_img` so as to keep to...
[ "def", "run_driz_chip", "(", "img", ",", "chip", ",", "output_wcs", ",", "outwcs", ",", "template", ",", "paramDict", ",", "single", ",", "doWrite", ",", "build", ",", "_versions", ",", "_numctx", ",", "_nplanes", ",", "_numchips", ",", "_outsci", ",", "...
Perform the drizzle operation on a single chip. This is separated out from `run_driz_img` so as to keep together the entirety of the code which is inside the loop over chips. See the `run_driz` code for more documentation.
[ "Perform", "the", "drizzle", "operation", "on", "a", "single", "chip", ".", "This", "is", "separated", "out", "from", "run_driz_img", "so", "as", "to", "keep", "together", "the", "entirety", "of", "the", "code", "which", "is", "inside", "the", "loop", "ove...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L749-L1008
spacetelescope/drizzlepac
drizzlepac/adrizzle.py
do_driz
def do_driz(insci, input_wcs, inwht, output_wcs, outsci, outwht, outcon, expin, in_units, wt_scl, wcslin_pscale=1.0,uniqid=1, pixfrac=1.0, kernel='square', fillval="INDEF", stepsize=10,wcsmap=None): """ Core routine for performing 'drizzle' operation on a single i...
python
def do_driz(insci, input_wcs, inwht, output_wcs, outsci, outwht, outcon, expin, in_units, wt_scl, wcslin_pscale=1.0,uniqid=1, pixfrac=1.0, kernel='square', fillval="INDEF", stepsize=10,wcsmap=None): """ Core routine for performing 'drizzle' operation on a single i...
[ "def", "do_driz", "(", "insci", ",", "input_wcs", ",", "inwht", ",", "output_wcs", ",", "outsci", ",", "outwht", ",", "outcon", ",", "expin", ",", "in_units", ",", "wt_scl", ",", "wcslin_pscale", "=", "1.0", ",", "uniqid", "=", "1", ",", "pixfrac", "="...
Core routine for performing 'drizzle' operation on a single input image All input values will be Python objects such as ndarrays, instead of filenames. File handling (input and output) will be performed by calling routine.
[ "Core", "routine", "for", "performing", "drizzle", "operation", "on", "a", "single", "input", "image", "All", "input", "values", "will", "be", "Python", "objects", "such", "as", "ndarrays", "instead", "of", "filenames", ".", "File", "handling", "(", "input", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L1011-L1101
spacetelescope/drizzlepac
drizzlepac/mapreg.py
_regwrite
def _regwrite(shapelist,outfile): """ Writes the current shape list out as a region file """ # This function corrects bugs and provides improvements over the pyregion's # ShapeList.write method in the following: # # 1. ShapeList.write crashes if regions have no comments; # 2. ShapeList.write con...
python
def _regwrite(shapelist,outfile): """ Writes the current shape list out as a region file """ # This function corrects bugs and provides improvements over the pyregion's # ShapeList.write method in the following: # # 1. ShapeList.write crashes if regions have no comments; # 2. ShapeList.write con...
[ "def", "_regwrite", "(", "shapelist", ",", "outfile", ")", ":", "# This function corrects bugs and provides improvements over the pyregion's", "# ShapeList.write method in the following:", "#", "# 1. ShapeList.write crashes if regions have no comments;", "# 2. ShapeList.write converts 'exclu...
Writes the current shape list out as a region file
[ "Writes", "the", "current", "shape", "list", "out", "as", "a", "region", "file" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L296-L369
spacetelescope/drizzlepac
drizzlepac/mapreg.py
_needs_ref_WCS
def _needs_ref_WCS(reglist): """ Check if the region list contains shapes in image-like coordinates """ from pyregion.wcs_helper import image_like_coordformats for r in reglist: if r.coord_format in image_like_coordformats: return True return False
python
def _needs_ref_WCS(reglist): """ Check if the region list contains shapes in image-like coordinates """ from pyregion.wcs_helper import image_like_coordformats for r in reglist: if r.coord_format in image_like_coordformats: return True return False
[ "def", "_needs_ref_WCS", "(", "reglist", ")", ":", "from", "pyregion", ".", "wcs_helper", "import", "image_like_coordformats", "for", "r", "in", "reglist", ":", "if", "r", ".", "coord_format", "in", "image_like_coordformats", ":", "return", "True", "return", "Fa...
Check if the region list contains shapes in image-like coordinates
[ "Check", "if", "the", "region", "list", "contains", "shapes", "in", "image", "-", "like", "coordinates" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L746-L754
spacetelescope/drizzlepac
drizzlepac/mapreg.py
extension_from_filename
def extension_from_filename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. """ # Parse out any extension specified in filename _indx1 = filename.find('[') _indx2 = filename.find(']') if _indx1 > 0: # check f...
python
def extension_from_filename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. """ # Parse out any extension specified in filename _indx1 = filename.find('[') _indx2 = filename.find(']') if _indx1 > 0: # check f...
[ "def", "extension_from_filename", "(", "filename", ")", ":", "# Parse out any extension specified in filename", "_indx1", "=", "filename", ".", "find", "(", "'['", ")", "_indx2", "=", "filename", ".", "find", "(", "']'", ")", "if", "_indx1", ">", "0", ":", "# ...
Parse out filename from any specified extensions. Returns rootname and string version of extension name.
[ "Parse", "out", "filename", "from", "any", "specified", "extensions", ".", "Returns", "rootname", "and", "string", "version", "of", "extension", "name", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L777-L797
spacetelescope/drizzlepac
drizzlepac/mapreg.py
count_extensions
def count_extensions(img, extname='SCI'): """ Return the number of 'extname' extensions. 'img' can be either a file name, an HDU List object (from fits), or None (to get the number of all HDU headers. """ if isinstance(img, str): img = fits.open(img, memmap=False) img.close() eli...
python
def count_extensions(img, extname='SCI'): """ Return the number of 'extname' extensions. 'img' can be either a file name, an HDU List object (from fits), or None (to get the number of all HDU headers. """ if isinstance(img, str): img = fits.open(img, memmap=False) img.close() eli...
[ "def", "count_extensions", "(", "img", ",", "extname", "=", "'SCI'", ")", ":", "if", "isinstance", "(", "img", ",", "str", ")", ":", "img", "=", "fits", ".", "open", "(", "img", ",", "memmap", "=", "False", ")", "img", ".", "close", "(", ")", "el...
Return the number of 'extname' extensions. 'img' can be either a file name, an HDU List object (from fits), or None (to get the number of all HDU headers.
[ "Return", "the", "number", "of", "extname", "extensions", ".", "img", "can", "be", "either", "a", "file", "name", "an", "HDU", "List", "object", "(", "from", "fits", ")", "or", "None", "(", "to", "get", "the", "number", "of", "all", "HDU", "headers", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L916-L946
spacetelescope/drizzlepac
drizzlepac/mapreg.py
get_extver_list
def get_extver_list(img, extname='SCI'): """ Return a list of all extension versions of 'extname' extensions. 'img' can be either a file name or a HDU List object (from fits). """ if isinstance(img, str): img = fits.open(img, memmap=False) img.close() elif not isinstance(img, fits.HD...
python
def get_extver_list(img, extname='SCI'): """ Return a list of all extension versions of 'extname' extensions. 'img' can be either a file name or a HDU List object (from fits). """ if isinstance(img, str): img = fits.open(img, memmap=False) img.close() elif not isinstance(img, fits.HD...
[ "def", "get_extver_list", "(", "img", ",", "extname", "=", "'SCI'", ")", ":", "if", "isinstance", "(", "img", ",", "str", ")", ":", "img", "=", "fits", ".", "open", "(", "img", ",", "memmap", "=", "False", ")", "img", ".", "close", "(", ")", "eli...
Return a list of all extension versions of 'extname' extensions. 'img' can be either a file name or a HDU List object (from fits).
[ "Return", "a", "list", "of", "all", "extension", "versions", "of", "extname", "extensions", ".", "img", "can", "be", "either", "a", "file", "name", "or", "a", "HDU", "List", "object", "(", "from", "fits", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L949-L980
spacetelescope/drizzlepac
drizzlepac/mapreg.py
_check_FITS_extvers
def _check_FITS_extvers(img, extname, extvers): """Returns True if all (except None) extension versions specified by the argument 'extvers' and that are of the type specified by the argument 'extname' are present in the 'img' FITS file. Returns False if some of the extension versions for a given EXTNAME...
python
def _check_FITS_extvers(img, extname, extvers): """Returns True if all (except None) extension versions specified by the argument 'extvers' and that are of the type specified by the argument 'extname' are present in the 'img' FITS file. Returns False if some of the extension versions for a given EXTNAME...
[ "def", "_check_FITS_extvers", "(", "img", ",", "extname", ",", "extvers", ")", ":", "default_extn", "=", "1", "if", "isinstance", "(", "extname", ",", "str", ")", "else", "0", "if", "isinstance", "(", "extvers", ",", "list", ")", ":", "extv", "=", "[",...
Returns True if all (except None) extension versions specified by the argument 'extvers' and that are of the type specified by the argument 'extname' are present in the 'img' FITS file. Returns False if some of the extension versions for a given EXTNAME cannot be found in the FITS image.
[ "Returns", "True", "if", "all", "(", "except", "None", ")", "extension", "versions", "specified", "by", "the", "argument", "extvers", "and", "that", "are", "of", "the", "type", "specified", "by", "the", "argument", "extname", "are", "present", "in", "the", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L983-L998
spacetelescope/drizzlepac
drizzlepac/generate_final_product_filenames.py
run_generator
def run_generator(product_category,obs_info): """ This is the main calling subroutine. It decides which filename generation subroutine should be run based on the input product_category, and then passes the information stored in input obs_info to the subroutine so that the appropriate filenames can be ge...
python
def run_generator(product_category,obs_info): """ This is the main calling subroutine. It decides which filename generation subroutine should be run based on the input product_category, and then passes the information stored in input obs_info to the subroutine so that the appropriate filenames can be ge...
[ "def", "run_generator", "(", "product_category", ",", "obs_info", ")", ":", "category_generator_mapping", "=", "{", "'single exposure product'", ":", "single_exposure_product_filename_generator", ",", "'filter product'", ":", "filter_product_filename_generator", ",", "'total de...
This is the main calling subroutine. It decides which filename generation subroutine should be run based on the input product_category, and then passes the information stored in input obs_info to the subroutine so that the appropriate filenames can be generated. Parameters ---------- product_catego...
[ "This", "is", "the", "main", "calling", "subroutine", ".", "It", "decides", "which", "filename", "generation", "subroutine", "should", "be", "run", "based", "on", "the", "input", "product_category", "and", "then", "passes", "the", "information", "stored", "in", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L8-L49
spacetelescope/drizzlepac
drizzlepac/generate_final_product_filenames.py
single_exposure_product_filename_generator
def single_exposure_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for single-exposure products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, filter,...
python
def single_exposure_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for single-exposure products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, filter,...
[ "def", "single_exposure_product_filename_generator", "(", "obs_info", ",", "nn", ")", ":", "proposal_id", "=", "obs_info", "[", "0", "]", "visit_id", "=", "obs_info", "[", "1", "]", "instrument", "=", "obs_info", "[", "2", "]", "detector", "=", "obs_info", "...
Generate image and sourcelist filenames for single-exposure products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, filter, and ipppssoot nn : string the single-exposure image number (...
[ "Generate", "image", "and", "sourcelist", "filenames", "for", "single", "-", "exposure", "products" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L52-L81
spacetelescope/drizzlepac
drizzlepac/generate_final_product_filenames.py
filter_product_filename_generator
def filter_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for filter products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, and filter nn : strin...
python
def filter_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for filter products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, and filter nn : strin...
[ "def", "filter_product_filename_generator", "(", "obs_info", ",", "nn", ")", ":", "proposal_id", "=", "obs_info", "[", "0", "]", "visit_id", "=", "obs_info", "[", "1", "]", "instrument", "=", "obs_info", "[", "2", "]", "detector", "=", "obs_info", "[", "3"...
Generate image and sourcelist filenames for filter products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, detector, and filter nn : string the single-exposure image number (NOTE: only used in ...
[ "Generate", "image", "and", "sourcelist", "filenames", "for", "filter", "products" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L85-L113
spacetelescope/drizzlepac
drizzlepac/generate_final_product_filenames.py
total_detection_product_filename_generator
def total_detection_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for total detection products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, and detector ...
python
def total_detection_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for total detection products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, and detector ...
[ "def", "total_detection_product_filename_generator", "(", "obs_info", ",", "nn", ")", ":", "proposal_id", "=", "obs_info", "[", "0", "]", "visit_id", "=", "obs_info", "[", "1", "]", "instrument", "=", "obs_info", "[", "2", "]", "detector", "=", "obs_info", "...
Generate image and sourcelist filenames for total detection products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: proposal_id, visit_id, instrument, and detector nn : string the single-exposure image number (NOTE: only used in ...
[ "Generate", "image", "and", "sourcelist", "filenames", "for", "total", "detection", "products" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L118-L145
spacetelescope/drizzlepac
drizzlepac/generate_final_product_filenames.py
multivisit_mosaic_product_filename_generator
def multivisit_mosaic_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for multi-visit mosaic products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: group_id, instrument, detector, and filter ...
python
def multivisit_mosaic_product_filename_generator(obs_info,nn): """ Generate image and sourcelist filenames for multi-visit mosaic products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: group_id, instrument, detector, and filter ...
[ "def", "multivisit_mosaic_product_filename_generator", "(", "obs_info", ",", "nn", ")", ":", "group_num", "=", "obs_info", "[", "0", "]", "instrument", "=", "obs_info", "[", "1", "]", "detector", "=", "obs_info", "[", "2", "]", "filter", "=", "obs_info", "["...
Generate image and sourcelist filenames for multi-visit mosaic products Parameters ---------- obs_info : list list of items that will be used to generate the filenames: group_id, instrument, detector, and filter nn : string the single-exposure image number (NOTE: only used in ...
[ "Generate", "image", "and", "sourcelist", "filenames", "for", "multi", "-", "visit", "mosaic", "products" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L149-L176
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
build_referenceWCS
def build_referenceWCS(catalog_list): """ Compute default reference WCS from list of Catalog objects. """ wcslist = [] for catalog in catalog_list: for scichip in catalog.catalogs: wcslist.append(catalog.catalogs[scichip]['wcs']) return utils.output_wcs(wcslist)
python
def build_referenceWCS(catalog_list): """ Compute default reference WCS from list of Catalog objects. """ wcslist = [] for catalog in catalog_list: for scichip in catalog.catalogs: wcslist.append(catalog.catalogs[scichip]['wcs']) return utils.output_wcs(wcslist)
[ "def", "build_referenceWCS", "(", "catalog_list", ")", ":", "wcslist", "=", "[", "]", "for", "catalog", "in", "catalog_list", ":", "for", "scichip", "in", "catalog", ".", "catalogs", ":", "wcslist", ".", "append", "(", "catalog", ".", "catalogs", "[", "sci...
Compute default reference WCS from list of Catalog objects.
[ "Compute", "default", "reference", "WCS", "from", "list", "of", "Catalog", "objects", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1453-L1460
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
convex_hull
def convex_hull(points): """Computes the convex hull of a set of 2D points. Implements `Andrew's monotone chain algorithm <http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain>`_. The algorithm has O(n log n) complexity. Credit: `<http://en.wikibooks.org/wiki/Algor...
python
def convex_hull(points): """Computes the convex hull of a set of 2D points. Implements `Andrew's monotone chain algorithm <http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain>`_. The algorithm has O(n log n) complexity. Credit: `<http://en.wikibooks.org/wiki/Algor...
[ "def", "convex_hull", "(", "points", ")", ":", "# Sort the points lexicographically (tuples are compared lexicographically).", "# Remove duplicates to detect the case we have just one unique point.", "points", "=", "sorted", "(", "set", "(", "points", ")", ")", "# Boring case: no p...
Computes the convex hull of a set of 2D points. Implements `Andrew's monotone chain algorithm <http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain>`_. The algorithm has O(n log n) complexity. Credit: `<http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Con...
[ "Computes", "the", "convex", "hull", "of", "a", "set", "of", "2D", "points", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1506-L1558
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
_estimate_2dhist_shift
def _estimate_2dhist_shift(imgxy, refxy, searchrad=3.0): """ Create a 2D matrix-histogram which contains the delta between each XY position and each UV position. Then estimate initial offset between catalogs. """ print("Computing initial guess for X and Y shifts...") # create ZP matrix ...
python
def _estimate_2dhist_shift(imgxy, refxy, searchrad=3.0): """ Create a 2D matrix-histogram which contains the delta between each XY position and each UV position. Then estimate initial offset between catalogs. """ print("Computing initial guess for X and Y shifts...") # create ZP matrix ...
[ "def", "_estimate_2dhist_shift", "(", "imgxy", ",", "refxy", ",", "searchrad", "=", "3.0", ")", ":", "print", "(", "\"Computing initial guess for X and Y shifts...\"", ")", "# create ZP matrix", "zpmat", "=", "_xy_2dhist", "(", "imgxy", ",", "refxy", ",", "r", "="...
Create a 2D matrix-histogram which contains the delta between each XY position and each UV position. Then estimate initial offset between catalogs.
[ "Create", "a", "2D", "matrix", "-", "histogram", "which", "contains", "the", "delta", "between", "each", "XY", "position", "and", "each", "UV", "position", ".", "Then", "estimate", "initial", "offset", "between", "catalogs", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1613-L1672
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
_find_peak
def _find_peak(data, peak_fit_box=5, mask=None): """ Find location of the peak in an array. This is done by fitting a second degree 2D polynomial to the data within a `peak_fit_box` and computing the location of its maximum. An initial estimate of the position of the maximum will be performed by sea...
python
def _find_peak(data, peak_fit_box=5, mask=None): """ Find location of the peak in an array. This is done by fitting a second degree 2D polynomial to the data within a `peak_fit_box` and computing the location of its maximum. An initial estimate of the position of the maximum will be performed by sea...
[ "def", "_find_peak", "(", "data", ",", "peak_fit_box", "=", "5", ",", "mask", "=", "None", ")", ":", "# check arguments:", "data", "=", "np", ".", "asarray", "(", "data", ",", "dtype", "=", "np", ".", "float64", ")", "ny", ",", "nx", "=", "data", "...
Find location of the peak in an array. This is done by fitting a second degree 2D polynomial to the data within a `peak_fit_box` and computing the location of its maximum. An initial estimate of the position of the maximum will be performed by searching for the location of the pixel/array element with t...
[ "Find", "location", "of", "the", "peak", "in", "an", "array", ".", "This", "is", "done", "by", "fitting", "a", "second", "degree", "2D", "polynomial", "to", "the", "data", "within", "a", "peak_fit_box", "and", "computing", "the", "location", "of", "its", ...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1675-L1839
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.openFile
def openFile(self, openDQ=False): """ Open file and set up filehandle for image file """ if self._im.closed: if not self._dq.closed: self._dq.release() assert(self._dq.closed) fi = FileExtMaskInfo(clobber=False, ...
python
def openFile(self, openDQ=False): """ Open file and set up filehandle for image file """ if self._im.closed: if not self._dq.closed: self._dq.release() assert(self._dq.closed) fi = FileExtMaskInfo(clobber=False, ...
[ "def", "openFile", "(", "self", ",", "openDQ", "=", "False", ")", ":", "if", "self", ".", "_im", ".", "closed", ":", "if", "not", "self", ".", "_dq", ".", "closed", ":", "self", ".", "_dq", ".", "release", "(", ")", "assert", "(", "self", ".", ...
Open file and set up filehandle for image file
[ "Open", "file", "and", "set", "up", "filehandle", "for", "image", "file" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L311-L329
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.get_wcs
def get_wcs(self): """ Helper method to return a list of all the input WCS objects associated with this image. """ wcslist = [] for chip in self.chip_catalogs: wcslist.append(self.chip_catalogs[chip]['wcs']) return wcslist
python
def get_wcs(self): """ Helper method to return a list of all the input WCS objects associated with this image. """ wcslist = [] for chip in self.chip_catalogs: wcslist.append(self.chip_catalogs[chip]['wcs']) return wcslist
[ "def", "get_wcs", "(", "self", ")", ":", "wcslist", "=", "[", "]", "for", "chip", "in", "self", ".", "chip_catalogs", ":", "wcslist", ".", "append", "(", "self", ".", "chip_catalogs", "[", "chip", "]", "[", "'wcs'", "]", ")", "return", "wcslist" ]
Helper method to return a list of all the input WCS objects associated with this image.
[ "Helper", "method", "to", "return", "a", "list", "of", "all", "the", "input", "WCS", "objects", "associated", "with", "this", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L331-L338
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.buildSkyCatalog
def buildSkyCatalog(self): """ Convert sky catalog for all chips into a single catalog for the entire field-of-view of this image. """ self.all_radec = None self.all_radec_orig = None ralist = [] declist = [] fluxlist = [] idlist = [] f...
python
def buildSkyCatalog(self): """ Convert sky catalog for all chips into a single catalog for the entire field-of-view of this image. """ self.all_radec = None self.all_radec_orig = None ralist = [] declist = [] fluxlist = [] idlist = [] f...
[ "def", "buildSkyCatalog", "(", "self", ")", ":", "self", ".", "all_radec", "=", "None", "self", ".", "all_radec_orig", "=", "None", "ralist", "=", "[", "]", "declist", "=", "[", "]", "fluxlist", "=", "[", "]", "idlist", "=", "[", "]", "for", "scichip...
Convert sky catalog for all chips into a single catalog for the entire field-of-view of this image.
[ "Convert", "sky", "catalog", "for", "all", "chips", "into", "a", "single", "catalog", "for", "the", "entire", "field", "-", "of", "-", "view", "of", "this", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L340-L368
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.buildDefaultRefWCS
def buildDefaultRefWCS(self): """ Generate a default reference WCS for this image. """ self.default_refWCS = None if self.use_wcs: wcslist = [] for scichip in self.chip_catalogs: wcslist.append(self.chip_catalogs[scichip]['wcs']) self.default_r...
python
def buildDefaultRefWCS(self): """ Generate a default reference WCS for this image. """ self.default_refWCS = None if self.use_wcs: wcslist = [] for scichip in self.chip_catalogs: wcslist.append(self.chip_catalogs[scichip]['wcs']) self.default_r...
[ "def", "buildDefaultRefWCS", "(", "self", ")", ":", "self", ".", "default_refWCS", "=", "None", "if", "self", ".", "use_wcs", ":", "wcslist", "=", "[", "]", "for", "scichip", "in", "self", ".", "chip_catalogs", ":", "wcslist", ".", "append", "(", "self",...
Generate a default reference WCS for this image.
[ "Generate", "a", "default", "reference", "WCS", "for", "this", "image", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L370-L377
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.transformToRef
def transformToRef(self,ref_wcs,force=False): """ Transform sky coords from ALL chips into X,Y coords in reference WCS. """ if not isinstance(ref_wcs, pywcs.WCS): print(textutil.textbox('Reference WCS not a valid HSTWCS object'), file=sys.stderr) raise V...
python
def transformToRef(self,ref_wcs,force=False): """ Transform sky coords from ALL chips into X,Y coords in reference WCS. """ if not isinstance(ref_wcs, pywcs.WCS): print(textutil.textbox('Reference WCS not a valid HSTWCS object'), file=sys.stderr) raise V...
[ "def", "transformToRef", "(", "self", ",", "ref_wcs", ",", "force", "=", "False", ")", ":", "if", "not", "isinstance", "(", "ref_wcs", ",", "pywcs", ".", "WCS", ")", ":", "print", "(", "textutil", ".", "textbox", "(", "'Reference WCS not a valid HSTWCS objec...
Transform sky coords from ALL chips into X,Y coords in reference WCS.
[ "Transform", "sky", "coords", "from", "ALL", "chips", "into", "X", "Y", "coords", "in", "reference", "WCS", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L379-L394
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.sortSkyCatalog
def sortSkyCatalog(self): """ Sort and clip the source catalog based on the flux range specified by the user. It keeps a copy of the original full list in order to support iteration. """ if len(self.all_radec_orig[2].nonzero()[0]) == 0: warn_str = "Source catalog NOT...
python
def sortSkyCatalog(self): """ Sort and clip the source catalog based on the flux range specified by the user. It keeps a copy of the original full list in order to support iteration. """ if len(self.all_radec_orig[2].nonzero()[0]) == 0: warn_str = "Source catalog NOT...
[ "def", "sortSkyCatalog", "(", "self", ")", ":", "if", "len", "(", "self", ".", "all_radec_orig", "[", "2", "]", ".", "nonzero", "(", ")", "[", "0", "]", ")", "==", "0", ":", "warn_str", "=", "\"Source catalog NOT trimmed by flux/mag. No fluxes read in for sour...
Sort and clip the source catalog based on the flux range specified by the user. It keeps a copy of the original full list in order to support iteration.
[ "Sort", "and", "clip", "the", "source", "catalog", "based", "on", "the", "flux", "range", "specified", "by", "the", "user", ".", "It", "keeps", "a", "copy", "of", "the", "original", "full", "list", "in", "order", "to", "support", "iteration", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L396-L476
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.match
def match(self,refimage, quiet_identity, **kwargs): """ Uses xyxymatch to cross-match sources between this catalog and a reference catalog (refCatalog). """ ref_outxy = refimage.outxy refWCS = refimage.wcs refname = refimage.name ref_inxy = refimage.xy_catalog...
python
def match(self,refimage, quiet_identity, **kwargs): """ Uses xyxymatch to cross-match sources between this catalog and a reference catalog (refCatalog). """ ref_outxy = refimage.outxy refWCS = refimage.wcs refname = refimage.name ref_inxy = refimage.xy_catalog...
[ "def", "match", "(", "self", ",", "refimage", ",", "quiet_identity", ",", "*", "*", "kwargs", ")", ":", "ref_outxy", "=", "refimage", ".", "outxy", "refWCS", "=", "refimage", ".", "wcs", "refname", "=", "refimage", ".", "name", "ref_inxy", "=", "refimage...
Uses xyxymatch to cross-match sources between this catalog and a reference catalog (refCatalog).
[ "Uses", "xyxymatch", "to", "cross", "-", "match", "sources", "between", "this", "catalog", "and", "a", "reference", "catalog", "(", "refCatalog", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L478-L637
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.performFit
def performFit(self,**kwargs): """ Perform a fit between the matched sources. Parameters ---------- kwargs : dict Parameter necessary to perform the fit; namely, *fitgeometry*. Notes ----- This task still needs to implemen...
python
def performFit(self,**kwargs): """ Perform a fit between the matched sources. Parameters ---------- kwargs : dict Parameter necessary to perform the fit; namely, *fitgeometry*. Notes ----- This task still needs to implemen...
[ "def", "performFit", "(", "self", ",", "*", "*", "kwargs", ")", ":", "assert", "(", "self", ".", "refWCS", "is", "not", "None", ")", "pars", "=", "kwargs", ".", "copy", "(", ")", "self", ".", "fit_pars", "=", "pars", "self", ".", "fit", "=", "{",...
Perform a fit between the matched sources. Parameters ---------- kwargs : dict Parameter necessary to perform the fit; namely, *fitgeometry*. Notes ----- This task still needs to implement (eventually) interactive iteration of ...
[ "Perform", "a", "fit", "between", "the", "matched", "sources", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L639-L771
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.updateHeader
def updateHeader(self, wcsname=None, reusename=False): """ Update header of image with shifts computed by *perform_fit()*. """ # Insure filehandle is open and available... self.openFile() verbose_level = 1 if not self.perform_update: verbose_level = 0 ...
python
def updateHeader(self, wcsname=None, reusename=False): """ Update header of image with shifts computed by *perform_fit()*. """ # Insure filehandle is open and available... self.openFile() verbose_level = 1 if not self.perform_update: verbose_level = 0 ...
[ "def", "updateHeader", "(", "self", ",", "wcsname", "=", "None", ",", "reusename", "=", "False", ")", ":", "# Insure filehandle is open and available...", "self", ".", "openFile", "(", ")", "verbose_level", "=", "1", "if", "not", "self", ".", "perform_update", ...
Update header of image with shifts computed by *perform_fit()*.
[ "Update", "header", "of", "image", "with", "shifts", "computed", "by", "*", "perform_fit", "()", "*", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L786-L913
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.writeHeaderlet
def writeHeaderlet(self,**kwargs): """ Write and/or attach a headerlet based on update to PRIMARY WCS """ # Insure filehandle is open and available... self.openFile() pars = kwargs.copy() rms_pars = self.fit['rms_keys'] str_kw = ['descrip','history','author','hd...
python
def writeHeaderlet(self,**kwargs): """ Write and/or attach a headerlet based on update to PRIMARY WCS """ # Insure filehandle is open and available... self.openFile() pars = kwargs.copy() rms_pars = self.fit['rms_keys'] str_kw = ['descrip','history','author','hd...
[ "def", "writeHeaderlet", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Insure filehandle is open and available...", "self", ".", "openFile", "(", ")", "pars", "=", "kwargs", ".", "copy", "(", ")", "rms_pars", "=", "self", ".", "fit", "[", "'rms_keys'", ...
Write and/or attach a headerlet based on update to PRIMARY WCS
[ "Write", "and", "/", "or", "attach", "a", "headerlet", "based", "on", "update", "to", "PRIMARY", "WCS" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L915-L943
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.write_skycatalog
def write_skycatalog(self,filename): """ Write out the all_radec catalog for this image to a file. """ if self.all_radec is None: return ralist = self.all_radec[0]#.tolist() declist = self.all_radec[1]#.tolist() f = open(filename,'w') f.write("#Sky pos...
python
def write_skycatalog(self,filename): """ Write out the all_radec catalog for this image to a file. """ if self.all_radec is None: return ralist = self.all_radec[0]#.tolist() declist = self.all_radec[1]#.tolist() f = open(filename,'w') f.write("#Sky pos...
[ "def", "write_skycatalog", "(", "self", ",", "filename", ")", ":", "if", "self", ".", "all_radec", "is", "None", ":", "return", "ralist", "=", "self", ".", "all_radec", "[", "0", "]", "#.tolist()", "declist", "=", "self", ".", "all_radec", "[", "1", "]...
Write out the all_radec catalog for this image to a file.
[ "Write", "out", "the", "all_radec", "catalog", "for", "this", "image", "to", "a", "file", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L945-L958
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.get_xy_catnames
def get_xy_catnames(self): """ Return a string with the names of input_xy catalog names """ catstr = self.name+' ' if 'input_xy' in self.catalog_names: for xycat in self.catalog_names['input_xy']: catstr += ' '+xycat return catstr + '\n'
python
def get_xy_catnames(self): """ Return a string with the names of input_xy catalog names """ catstr = self.name+' ' if 'input_xy' in self.catalog_names: for xycat in self.catalog_names['input_xy']: catstr += ' '+xycat return catstr + '\n'
[ "def", "get_xy_catnames", "(", "self", ")", ":", "catstr", "=", "self", ".", "name", "+", "' '", "if", "'input_xy'", "in", "self", ".", "catalog_names", ":", "for", "xycat", "in", "self", ".", "catalog_names", "[", "'input_xy'", "]", ":", "catstr", "+="...
Return a string with the names of input_xy catalog names
[ "Return", "a", "string", "with", "the", "names", "of", "input_xy", "catalog", "names" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L960-L967
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.write_fit_catalog
def write_fit_catalog(self): """ Write out the catalog of all sources and resids used in the final fit. """ if self.pars['writecat']: log.info('Creating catalog for the fit: {:s}'.format(self.catalog_names['fitmatch'])) f = open(self.catalog_names['fitmatch'],'w') ...
python
def write_fit_catalog(self): """ Write out the catalog of all sources and resids used in the final fit. """ if self.pars['writecat']: log.info('Creating catalog for the fit: {:s}'.format(self.catalog_names['fitmatch'])) f = open(self.catalog_names['fitmatch'],'w') ...
[ "def", "write_fit_catalog", "(", "self", ")", ":", "if", "self", ".", "pars", "[", "'writecat'", "]", ":", "log", ".", "info", "(", "'Creating catalog for the fit: {:s}'", ".", "format", "(", "self", ".", "catalog_names", "[", "'fitmatch'", "]", ")", ")", ...
Write out the catalog of all sources and resids used in the final fit.
[ "Write", "out", "the", "catalog", "of", "all", "sources", "and", "resids", "used", "in", "the", "final", "fit", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L969-L1040
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.write_outxy
def write_outxy(self,filename): """ Write out the output(transformed) XY catalog for this image to a file. """ f = open(filename,'w') f.write("#Pixel positions for: "+self.name+'\n') f.write("#X Y\n") f.write("#(pix) (pix)\n") for i in range(self.a...
python
def write_outxy(self,filename): """ Write out the output(transformed) XY catalog for this image to a file. """ f = open(filename,'w') f.write("#Pixel positions for: "+self.name+'\n') f.write("#X Y\n") f.write("#(pix) (pix)\n") for i in range(self.a...
[ "def", "write_outxy", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'w'", ")", "f", ".", "write", "(", "\"#Pixel positions for: \"", "+", "self", ".", "name", "+", "'\\n'", ")", "f", ".", "write", "(", "\"#X ...
Write out the output(transformed) XY catalog for this image to a file.
[ "Write", "out", "the", "output", "(", "transformed", ")", "XY", "catalog", "for", "this", "image", "to", "a", "file", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1042-L1051
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.get_shiftfile_row
def get_shiftfile_row(self): """ Return the information for a shiftfile for this image to provide compatability with the IRAF-based MultiDrizzle. """ if self.fit is not None: rowstr = '%s %0.6f %0.6f %0.6f %0.6f %0.6f %0.6f\n'%( self.name...
python
def get_shiftfile_row(self): """ Return the information for a shiftfile for this image to provide compatability with the IRAF-based MultiDrizzle. """ if self.fit is not None: rowstr = '%s %0.6f %0.6f %0.6f %0.6f %0.6f %0.6f\n'%( self.name...
[ "def", "get_shiftfile_row", "(", "self", ")", ":", "if", "self", ".", "fit", "is", "not", "None", ":", "rowstr", "=", "'%s %0.6f %0.6f %0.6f %0.6f %0.6f %0.6f\\n'", "%", "(", "self", ".", "name", ",", "self", ".", "fit", "[", "'offset'", "]", "...
Return the information for a shiftfile for this image to provide compatability with the IRAF-based MultiDrizzle.
[ "Return", "the", "information", "for", "a", "shiftfile", "for", "this", "image", "to", "provide", "compatability", "with", "the", "IRAF", "-", "based", "MultiDrizzle", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1053-L1064
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
Image.clean
def clean(self): """ Remove intermediate files created. """ #TODO: add cleaning of mask files, *if* created ... for f in self.catalog_names: if 'match' in f: if os.path.exists(self.catalog_names[f]): log.info('Deleting intermediate match fi...
python
def clean(self): """ Remove intermediate files created. """ #TODO: add cleaning of mask files, *if* created ... for f in self.catalog_names: if 'match' in f: if os.path.exists(self.catalog_names[f]): log.info('Deleting intermediate match fi...
[ "def", "clean", "(", "self", ")", ":", "#TODO: add cleaning of mask files, *if* created ...", "for", "f", "in", "self", ".", "catalog_names", ":", "if", "'match'", "in", "f", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "catalog_names", "["...
Remove intermediate files created.
[ "Remove", "intermediate", "files", "created", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1066-L1080
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
RefImage.write_skycatalog
def write_skycatalog(self, filename, show_flux=False, show_id=False): """ Write out the all_radec catalog for this image to a file. """ f = open(filename,'w') f.write("#Sky positions for cumulative reference catalog. Initial catalog from: "+self.name+'\n') header1 = "#RA D...
python
def write_skycatalog(self, filename, show_flux=False, show_id=False): """ Write out the all_radec catalog for this image to a file. """ f = open(filename,'w') f.write("#Sky positions for cumulative reference catalog. Initial catalog from: "+self.name+'\n') header1 = "#RA D...
[ "def", "write_skycatalog", "(", "self", ",", "filename", ",", "show_flux", "=", "False", ",", "show_id", "=", "False", ")", ":", "f", "=", "open", "(", "filename", ",", "'w'", ")", "f", ".", "write", "(", "\"#Sky positions for cumulative reference catalog. Ini...
Write out the all_radec catalog for this image to a file.
[ "Write", "out", "the", "all_radec", "catalog", "for", "this", "image", "to", "a", "file", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1316-L1356
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
RefImage.transformToRef
def transformToRef(self): """ Transform reference catalog sky positions (self.all_radec) to reference tangent plane (self.wcs) to create output X,Y positions. """ if 'refxyunits' in self.pars and self.pars['refxyunits'] == 'pixels': log.info('Creating RA/Dec positions for ref...
python
def transformToRef(self): """ Transform reference catalog sky positions (self.all_radec) to reference tangent plane (self.wcs) to create output X,Y positions. """ if 'refxyunits' in self.pars and self.pars['refxyunits'] == 'pixels': log.info('Creating RA/Dec positions for ref...
[ "def", "transformToRef", "(", "self", ")", ":", "if", "'refxyunits'", "in", "self", ".", "pars", "and", "self", ".", "pars", "[", "'refxyunits'", "]", "==", "'pixels'", ":", "log", ".", "info", "(", "'Creating RA/Dec positions for reference sources...'", ")", ...
Transform reference catalog sky positions (self.all_radec) to reference tangent plane (self.wcs) to create output X,Y positions.
[ "Transform", "reference", "catalog", "sky", "positions", "(", "self", ".", "all_radec", ")", "to", "reference", "tangent", "plane", "(", "self", ".", "wcs", ")", "to", "create", "output", "X", "Y", "positions", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1358-L1374
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
RefImage.clean
def clean(self): """ Remove intermediate files created """ if not util.is_blank(self.catalog.catname) and os.path.exists(self.catalog.catname): os.remove(self.catalog.catname)
python
def clean(self): """ Remove intermediate files created """ if not util.is_blank(self.catalog.catname) and os.path.exists(self.catalog.catname): os.remove(self.catalog.catname)
[ "def", "clean", "(", "self", ")", ":", "if", "not", "util", ".", "is_blank", "(", "self", ".", "catalog", ".", "catname", ")", "and", "os", ".", "path", ".", "exists", "(", "self", ".", "catalog", ".", "catname", ")", ":", "os", ".", "remove", "(...
Remove intermediate files created
[ "Remove", "intermediate", "files", "created" ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1443-L1447
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.close
def close(self): """ Close the object nicely and release all the data arrays from memory YOU CANT GET IT BACK, the pointers and data are gone so use the getData method to get the data array returned for future use. You can use putData to reattach a new data array ...
python
def close(self): """ Close the object nicely and release all the data arrays from memory YOU CANT GET IT BACK, the pointers and data are gone so use the getData method to get the data array returned for future use. You can use putData to reattach a new data array ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_image", "is", "None", ":", "return", "# mcara: I think the code below is not necessary but in order to", "# preserve the same functionality as the code removed below,", "# I make an empty copy of the image obje...
Close the object nicely and release all the data arrays from memory YOU CANT GET IT BACK, the pointers and data are gone so use the getData method to get the data array returned for future use. You can use putData to reattach a new data array to the imageObject.
[ "Close", "the", "object", "nicely", "and", "release", "all", "the", "data", "arrays", "from", "memory", "YOU", "CANT", "GET", "IT", "BACK", "the", "pointers", "and", "data", "are", "gone", "so", "use", "the", "getData", "method", "to", "get", "the", "dat...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L93-L113
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.clean
def clean(self): """ Deletes intermediate products generated for this imageObject. """ clean_files = ['blotImage','crmaskImage','finalMask', 'staticMask','singleDrizMask','outSky', 'outSContext','outSWeight','outSingle', 'ou...
python
def clean(self): """ Deletes intermediate products generated for this imageObject. """ clean_files = ['blotImage','crmaskImage','finalMask', 'staticMask','singleDrizMask','outSky', 'outSContext','outSWeight','outSingle', 'ou...
[ "def", "clean", "(", "self", ")", ":", "clean_files", "=", "[", "'blotImage'", ",", "'crmaskImage'", ",", "'finalMask'", ",", "'staticMask'", ",", "'singleDrizMask'", ",", "'outSky'", ",", "'outSContext'", ",", "'outSWeight'", ",", "'outSingle'", ",", "'outMedia...
Deletes intermediate products generated for this imageObject.
[ "Deletes", "intermediate", "products", "generated", "for", "this", "imageObject", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L131-L147
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getData
def getData(self,exten=None): """ Return just the data array from the specified extension fileutil is used instead of fits to account for non- FITS input images. openImage returns a fits object. """ if exten.lower().find('sci') > -1: # For SCI extensions, the ...
python
def getData(self,exten=None): """ Return just the data array from the specified extension fileutil is used instead of fits to account for non- FITS input images. openImage returns a fits object. """ if exten.lower().find('sci') > -1: # For SCI extensions, the ...
[ "def", "getData", "(", "self", ",", "exten", "=", "None", ")", ":", "if", "exten", ".", "lower", "(", ")", ".", "find", "(", "'sci'", ")", ">", "-", "1", ":", "# For SCI extensions, the current file will have the data", "fname", "=", "self", ".", "_filenam...
Return just the data array from the specified extension fileutil is used instead of fits to account for non- FITS input images. openImage returns a fits object.
[ "Return", "just", "the", "data", "array", "from", "the", "specified", "extension", "fileutil", "is", "used", "instead", "of", "fits", "to", "account", "for", "non", "-", "FITS", "input", "images", ".", "openImage", "returns", "a", "fits", "object", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L149-L179
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getHeader
def getHeader(self,exten=None): """ Return just the specified header extension fileutil is used instead of fits to account for non-FITS input images. openImage returns a fits object. """ _image=fileutil.openImage(self._filename, clobber=False, memmap=False) _heade...
python
def getHeader(self,exten=None): """ Return just the specified header extension fileutil is used instead of fits to account for non-FITS input images. openImage returns a fits object. """ _image=fileutil.openImage(self._filename, clobber=False, memmap=False) _heade...
[ "def", "getHeader", "(", "self", ",", "exten", "=", "None", ")", ":", "_image", "=", "fileutil", ".", "openImage", "(", "self", ".", "_filename", ",", "clobber", "=", "False", ",", "memmap", "=", "False", ")", "_header", "=", "fileutil", ".", "getExtn"...
Return just the specified header extension fileutil is used instead of fits to account for non-FITS input images. openImage returns a fits object.
[ "Return", "just", "the", "specified", "header", "extension", "fileutil", "is", "used", "instead", "of", "fits", "to", "account", "for", "non", "-", "FITS", "input", "images", ".", "openImage", "returns", "a", "fits", "object", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L181-L190
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.updateData
def updateData(self,exten,data): """ Write out updated data and header to the original input file for this object. """ _extnum=self._interpretExten(exten) fimg = fileutil.openImage(self._filename, mode='update', memmap=False) fimg[_extnum].data = data fimg[_ex...
python
def updateData(self,exten,data): """ Write out updated data and header to the original input file for this object. """ _extnum=self._interpretExten(exten) fimg = fileutil.openImage(self._filename, mode='update', memmap=False) fimg[_extnum].data = data fimg[_ex...
[ "def", "updateData", "(", "self", ",", "exten", ",", "data", ")", ":", "_extnum", "=", "self", ".", "_interpretExten", "(", "exten", ")", "fimg", "=", "fileutil", ".", "openImage", "(", "self", ".", "_filename", ",", "mode", "=", "'update'", ",", "memm...
Write out updated data and header to the original input file for this object.
[ "Write", "out", "updated", "data", "and", "header", "to", "the", "original", "input", "file", "for", "this", "object", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L212-L220
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.putData
def putData(self,data=None,exten=None): """ Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method...
python
def putData(self,data=None,exten=None): """ Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method...
[ "def", "putData", "(", "self", ",", "data", "=", "None", ",", "exten", "=", "None", ")", ":", "if", "data", "is", "None", ":", "log", ".", "warning", "(", "\"No data supplied\"", ")", "else", ":", "extnum", "=", "_interpretExten", "(", "exten", ")", ...
Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method is an attempt to make sure that when yo...
[ "Now", "that", "we", "are", "removing", "the", "data", "from", "the", "object", "to", "save", "memory", "we", "need", "something", "that", "cleanly", "puts", "the", "data", "array", "back", "into", "the", "object", "so", "that", "we", "can", "write", "ou...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L222-L244
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getAllData
def getAllData(self,extname=None,exclude=None): """ This function is meant to make it easier to attach ALL the data extensions of the image object so that we can write out copies of the original image nicer. If no extname is given, the it retrieves all data from the original...
python
def getAllData(self,extname=None,exclude=None): """ This function is meant to make it easier to attach ALL the data extensions of the image object so that we can write out copies of the original image nicer. If no extname is given, the it retrieves all data from the original...
[ "def", "getAllData", "(", "self", ",", "extname", "=", "None", ",", "exclude", "=", "None", ")", ":", "extensions", "=", "self", ".", "_findExtnames", "(", "extname", "=", "extname", ",", "exclude", "=", "exclude", ")", "for", "i", "in", "range", "(", ...
This function is meant to make it easier to attach ALL the data extensions of the image object so that we can write out copies of the original image nicer. If no extname is given, the it retrieves all data from the original file and attaches it. Otherwise, give the name ...
[ "This", "function", "is", "meant", "to", "make", "it", "easier", "to", "attach", "ALL", "the", "data", "extensions", "of", "the", "image", "object", "so", "that", "we", "can", "write", "out", "copies", "of", "the", "original", "image", "nicer", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L246-L269
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.returnAllChips
def returnAllChips(self,extname=None,exclude=None): """ Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any). """ extensions = self._findExtnames(extname=extname,exclude=exclude) chiplist = [] for i in rang...
python
def returnAllChips(self,extname=None,exclude=None): """ Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any). """ extensions = self._findExtnames(extname=extname,exclude=exclude) chiplist = [] for i in rang...
[ "def", "returnAllChips", "(", "self", ",", "extname", "=", "None", ",", "exclude", "=", "None", ")", ":", "extensions", "=", "self", ".", "_findExtnames", "(", "extname", "=", "extname", ",", "exclude", "=", "exclude", ")", "chiplist", "=", "[", "]", "...
Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any).
[ "Returns", "a", "list", "containing", "all", "the", "chips", "which", "match", "the", "extname", "given", "minus", "those", "specified", "for", "exclusion", "(", "if", "any", ")", "." ]
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L271-L286