repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
spacetelescope/drizzlepac
drizzlepac/alignimages.py
generate_source_catalogs
def generate_source_catalogs(imglist, **pars): """Generates a dictionary of source catalogs keyed by image name. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for source detection. Returns ------- sourcecatalogdict : dictionary ...
python
def generate_source_catalogs(imglist, **pars): """Generates a dictionary of source catalogs keyed by image name. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for source detection. Returns ------- sourcecatalogdict : dictionary ...
[ "def", "generate_source_catalogs", "(", "imglist", ",", "**", "pars", ")", ":", "output", "=", "pars", ".", "get", "(", "'output'", ",", "False", ")", "sourcecatalogdict", "=", "{", "}", "for", "imgname", "in", "imglist", ":", "log", ".", "info", "(", ...
Generates a dictionary of source catalogs keyed by image name. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for source detection. Returns ------- sourcecatalogdict : dictionary a dictionary (keyed by image name) of two elemen...
[ "Generates", "a", "dictionary", "of", "source", "catalogs", "keyed", "by", "image", "name", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L903-L964
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
update_image_wcs_info
def update_image_wcs_info(tweakwcs_output): """Write newly computed WCS information to image headers and write headerlet files Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid...
python
def update_image_wcs_info(tweakwcs_output): """Write newly computed WCS information to image headers and write headerlet files Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid...
[ "def", "update_image_wcs_info", "(", "tweakwcs_output", ")", ":", "out_headerlet_dict", "=", "{", "}", "for", "item", "in", "tweakwcs_output", ":", "imageName", "=", "item", ".", "meta", "[", "'filename'", "]", "chipnum", "=", "item", ".", "meta", "[", "'chi...
Write newly computed WCS information to image headers and write headerlet files Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid input image. Returns ...
[ "Write", "newly", "computed", "WCS", "information", "to", "image", "headers", "and", "write", "headerlet", "files" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L970-L1036
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
update_headerlet_phdu
def update_headerlet_phdu(tweakwcs_item, headerlet): """Update the primary header data unit keywords of a headerlet object in-place Parameters ========== tweakwc_item : Basically the output from tweakwcs which contains the cross match and fit information for every chip of every valid in...
python
def update_headerlet_phdu(tweakwcs_item, headerlet): """Update the primary header data unit keywords of a headerlet object in-place Parameters ========== tweakwc_item : Basically the output from tweakwcs which contains the cross match and fit information for every chip of every valid in...
[ "def", "update_headerlet_phdu", "(", "tweakwcs_item", ",", "headerlet", ")", ":", "rms_ra", "=", "tweakwcs_item", ".", "meta", "[", "'fit_info'", "]", "[", "'RMS_RA'", "]", ".", "value", "rms_dec", "=", "tweakwcs_item", ".", "meta", "[", "'fit_info'", "]", "...
Update the primary header data unit keywords of a headerlet object in-place Parameters ========== tweakwc_item : Basically the output from tweakwcs which contains the cross match and fit information for every chip of every valid input image. headerlet : object containing WCS in...
[ "Update", "the", "primary", "header", "data", "unit", "keywords", "of", "a", "headerlet", "object", "in", "-", "place" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L1040-L1083
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
interpret_fit_rms
def interpret_fit_rms(tweakwcs_output, reference_catalog): """Interpret the FIT information to convert RMS to physical units Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid input ima...
python
def interpret_fit_rms(tweakwcs_output, reference_catalog): """Interpret the FIT information to convert RMS to physical units Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid input ima...
[ "def", "interpret_fit_rms", "(", "tweakwcs_output", ",", "reference_catalog", ")", ":", "group_ids", "=", "[", "info", ".", "meta", "[", "'group_id'", "]", "for", "info", "in", "tweakwcs_output", "]", "group_ids", "=", "list", "(", "set", "(", "group_ids", "...
Interpret the FIT information to convert RMS to physical units Parameters ---------- tweakwcs_output : list output of tweakwcs. Contains sourcelist tables, newly computed WCS info, etc. for every chip of every valid input image. This list gets updated, in-place, with the new RMS values; ...
[ "Interpret", "the", "FIT", "information", "to", "convert", "RMS", "to", "physical", "units" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L1089-L1170
train
spacetelescope/drizzlepac
drizzlepac/sky.py
sky
def sky(input=None,outExt=None,configObj=None, group=None, editpars=False, **inputDict): """ Perform sky subtraction on input list of images Parameters ---------- input : str or list of str a python list of image filenames, or just a single filename configObj : configObject an i...
python
def sky(input=None,outExt=None,configObj=None, group=None, editpars=False, **inputDict): """ Perform sky subtraction on input list of images Parameters ---------- input : str or list of str a python list of image filenames, or just a single filename configObj : configObject an i...
[ "def", "sky", "(", "input", "=", "None", ",", "outExt", "=", "None", ",", "configObj", "=", "None", ",", "group", "=", "None", ",", "editpars", "=", "False", ",", "**", "inputDict", ")", ":", "if", "input", "is", "not", "None", ":", "inputDict", "[...
Perform sky subtraction on input list of images Parameters ---------- input : str or list of str a python list of image filenames, or just a single filename configObj : configObject an instance of configObject inputDict : dict, optional an optional list of parameters specifi...
[ "Perform", "sky", "subtraction", "on", "input", "list", "of", "images" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L43-L107
train
spacetelescope/drizzlepac
drizzlepac/sky.py
_skyUserFromFile
def _skyUserFromFile(imageObjList, skyFile, apply_sky=None): """ Apply sky value as read in from a user-supplied input file. """ skyKW="MDRIZSKY" #header keyword that contains the sky that's been subtracted # create dict of fname=sky pairs skyvals = {} if apply_sky is None: skyappl...
python
def _skyUserFromFile(imageObjList, skyFile, apply_sky=None): """ Apply sky value as read in from a user-supplied input file. """ skyKW="MDRIZSKY" #header keyword that contains the sky that's been subtracted # create dict of fname=sky pairs skyvals = {} if apply_sky is None: skyappl...
[ "def", "_skyUserFromFile", "(", "imageObjList", ",", "skyFile", ",", "apply_sky", "=", "None", ")", ":", "skyKW", "=", "\"MDRIZSKY\"", "skyvals", "=", "{", "}", "if", "apply_sky", "is", "None", ":", "skyapplied", "=", "False", "else", ":", "skyapplied", "=...
Apply sky value as read in from a user-supplied input file.
[ "Apply", "sky", "value", "as", "read", "in", "from", "a", "user", "-", "supplied", "input", "file", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L453-L518
train
spacetelescope/drizzlepac
drizzlepac/sky.py
_computeSky
def _computeSky(image, skypars, memmap=False): """ Compute the sky value for the data array passed to the function image is a fits object which contains the data and the header for one image extension skypars is passed in as paramDict """ #this object contains the returned values from the...
python
def _computeSky(image, skypars, memmap=False): """ Compute the sky value for the data array passed to the function image is a fits object which contains the data and the header for one image extension skypars is passed in as paramDict """ #this object contains the returned values from the...
[ "def", "_computeSky", "(", "image", ",", "skypars", ",", "memmap", "=", "False", ")", ":", "_tmp", "=", "imagestats", ".", "ImageStats", "(", "image", ".", "data", ",", "fields", "=", "skypars", "[", "'skystat'", "]", ",", "lower", "=", "skypars", "[",...
Compute the sky value for the data array passed to the function image is a fits object which contains the data and the header for one image extension skypars is passed in as paramDict
[ "Compute", "the", "sky", "value", "for", "the", "data", "array", "passed", "to", "the", "function", "image", "is", "a", "fits", "object", "which", "contains", "the", "data", "and", "the", "header", "for", "one", "image", "extension" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L699-L726
train
spacetelescope/drizzlepac
drizzlepac/sky.py
_subtractSky
def _subtractSky(image,skyValue,memmap=False): """ subtract the given sky value from each the data array that has been passed. image is a fits object that contains the data and header for one image extension """ try: np.subtract(image.data,skyValue,image.data) except IOError: ...
python
def _subtractSky(image,skyValue,memmap=False): """ subtract the given sky value from each the data array that has been passed. image is a fits object that contains the data and header for one image extension """ try: np.subtract(image.data,skyValue,image.data) except IOError: ...
[ "def", "_subtractSky", "(", "image", ",", "skyValue", ",", "memmap", "=", "False", ")", ":", "try", ":", "np", ".", "subtract", "(", "image", ".", "data", ",", "skyValue", ",", "image", ".", "data", ")", "except", "IOError", ":", "print", "(", "\"Una...
subtract the given sky value from each the data array that has been passed. image is a fits object that contains the data and header for one image extension
[ "subtract", "the", "given", "sky", "value", "from", "each", "the", "data", "array", "that", "has", "been", "passed", ".", "image", "is", "a", "fits", "object", "that", "contains", "the", "data", "and", "header", "for", "one", "image", "extension" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L740-L751
train
spacetelescope/drizzlepac
drizzlepac/sky.py
_updateKW
def _updateKW(image, filename, exten, skyKW, Value): """update the header with the kw,value""" # Update the value in memory image.header[skyKW] = Value # Now update the value on disk if isinstance(exten,tuple): strexten = '[%s,%s]'%(exten[0],str(exten[1])) else: strexten = '[%s]...
python
def _updateKW(image, filename, exten, skyKW, Value): """update the header with the kw,value""" # Update the value in memory image.header[skyKW] = Value # Now update the value on disk if isinstance(exten,tuple): strexten = '[%s,%s]'%(exten[0],str(exten[1])) else: strexten = '[%s]...
[ "def", "_updateKW", "(", "image", ",", "filename", ",", "exten", ",", "skyKW", ",", "Value", ")", ":", "image", ".", "header", "[", "skyKW", "]", "=", "Value", "if", "isinstance", "(", "exten", ",", "tuple", ")", ":", "strexten", "=", "'[%s,%s]'", "%...
update the header with the kw,value
[ "update", "the", "header", "with", "the", "kw", "value" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L754-L767
train
spacetelescope/drizzlepac
drizzlepac/sky.py
_addDefaultSkyKW
def _addDefaultSkyKW(imageObjList): """Add MDRIZSKY keyword to "commanded" SCI headers of all input images, if that keyword does not already exist. """ skyKW = "MDRIZSKY" Value = 0.0 for imageSet in imageObjList: fname = imageSet._filename numchips=imageSet._numchips ...
python
def _addDefaultSkyKW(imageObjList): """Add MDRIZSKY keyword to "commanded" SCI headers of all input images, if that keyword does not already exist. """ skyKW = "MDRIZSKY" Value = 0.0 for imageSet in imageObjList: fname = imageSet._filename numchips=imageSet._numchips ...
[ "def", "_addDefaultSkyKW", "(", "imageObjList", ")", ":", "skyKW", "=", "\"MDRIZSKY\"", "Value", "=", "0.0", "for", "imageSet", "in", "imageObjList", ":", "fname", "=", "imageSet", ".", "_filename", "numchips", "=", "imageSet", ".", "_numchips", "sciExt", "=",...
Add MDRIZSKY keyword to "commanded" SCI headers of all input images, if that keyword does not already exist.
[ "Add", "MDRIZSKY", "keyword", "to", "commanded", "SCI", "headers", "of", "all", "input", "images", "if", "that", "keyword", "does", "not", "already", "exist", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/sky.py#L769-L790
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
create_astrometric_catalog
def create_astrometric_catalog(inputs, **pars): """Create an astrometric catalog that covers the inputs' field-of-view. Parameters ---------- input : str, list Filenames of images to be aligned to astrometric catalog catalog : str, optional Name of catalog to extract astrometric po...
python
def create_astrometric_catalog(inputs, **pars): """Create an astrometric catalog that covers the inputs' field-of-view. Parameters ---------- input : str, list Filenames of images to be aligned to astrometric catalog catalog : str, optional Name of catalog to extract astrometric po...
[ "def", "create_astrometric_catalog", "(", "inputs", ",", "**", "pars", ")", ":", "catalog", "=", "pars", ".", "get", "(", "\"catalog\"", ",", "'GAIADR2'", ")", "output", "=", "pars", ".", "get", "(", "\"output\"", ",", "'ref_cat.ecsv'", ")", "gaia_only", "...
Create an astrometric catalog that covers the inputs' field-of-view. Parameters ---------- input : str, list Filenames of images to be aligned to astrometric catalog catalog : str, optional Name of catalog to extract astrometric positions for sources in the input images' field-...
[ "Create", "an", "astrometric", "catalog", "that", "covers", "the", "inputs", "field", "-", "of", "-", "view", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L94-L184
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
build_reference_wcs
def build_reference_wcs(inputs, sciname='sci'): """Create the reference WCS based on all the inputs for a field""" # start by creating a composite field-of-view for all inputs wcslist = [] for img in inputs: nsci = countExtn(img) for num in range(nsci): extname = (sciname, nu...
python
def build_reference_wcs(inputs, sciname='sci'): """Create the reference WCS based on all the inputs for a field""" # start by creating a composite field-of-view for all inputs wcslist = [] for img in inputs: nsci = countExtn(img) for num in range(nsci): extname = (sciname, nu...
[ "def", "build_reference_wcs", "(", "inputs", ",", "sciname", "=", "'sci'", ")", ":", "wcslist", "=", "[", "]", "for", "img", "in", "inputs", ":", "nsci", "=", "countExtn", "(", "img", ")", "for", "num", "in", "range", "(", "nsci", ")", ":", "extname"...
Create the reference WCS based on all the inputs for a field
[ "Create", "the", "reference", "WCS", "based", "on", "all", "the", "inputs", "for", "a", "field" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L187-L209
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
get_catalog
def get_catalog(ra, dec, sr=0.1, fmt='CSV', catalog='GSC241'): """ Extract catalog from VO web service. Parameters ---------- ra : float Right Ascension (RA) of center of field-of-view (in decimal degrees) dec : float Declination (Dec) of center of field-of-view (in decimal degrees...
python
def get_catalog(ra, dec, sr=0.1, fmt='CSV', catalog='GSC241'): """ Extract catalog from VO web service. Parameters ---------- ra : float Right Ascension (RA) of center of field-of-view (in decimal degrees) dec : float Declination (Dec) of center of field-of-view (in decimal degrees...
[ "def", "get_catalog", "(", "ra", ",", "dec", ",", "sr", "=", "0.1", ",", "fmt", "=", "'CSV'", ",", "catalog", "=", "'GSC241'", ")", ":", "serviceType", "=", "'vo/CatalogSearch.aspx'", "spec_str", "=", "'RA={}&DEC={}&SR={}&FORMAT={}&CAT={}&MINDET=5'", "headers", ...
Extract catalog from VO web service. Parameters ---------- ra : float Right Ascension (RA) of center of field-of-view (in decimal degrees) dec : float Declination (Dec) of center of field-of-view (in decimal degrees) sr : float, optional Search radius (in decimal degrees) ...
[ "Extract", "catalog", "from", "VO", "web", "service", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L212-L255
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
compute_radius
def compute_radius(wcs): """Compute the radius from the center to the furthest edge of the WCS.""" ra, dec = wcs.wcs.crval img_center = SkyCoord(ra=ra * u.degree, dec=dec * u.degree) wcs_foot = wcs.calc_footprint() img_corners = SkyCoord(ra=wcs_foot[:, 0] * u.degree, dec=...
python
def compute_radius(wcs): """Compute the radius from the center to the furthest edge of the WCS.""" ra, dec = wcs.wcs.crval img_center = SkyCoord(ra=ra * u.degree, dec=dec * u.degree) wcs_foot = wcs.calc_footprint() img_corners = SkyCoord(ra=wcs_foot[:, 0] * u.degree, dec=...
[ "def", "compute_radius", "(", "wcs", ")", ":", "ra", ",", "dec", "=", "wcs", ".", "wcs", ".", "crval", "img_center", "=", "SkyCoord", "(", "ra", "=", "ra", "*", "u", ".", "degree", ",", "dec", "=", "dec", "*", "u", ".", "degree", ")", "wcs_foot",...
Compute the radius from the center to the furthest edge of the WCS.
[ "Compute", "the", "radius", "from", "the", "center", "to", "the", "furthest", "edge", "of", "the", "WCS", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L258-L268
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
find_gsc_offset
def find_gsc_offset(image, input_catalog='GSC1', output_catalog='GAIA'): """Find the GSC to GAIA offset based on guide star coordinates Parameters ---------- image : str Filename of image to be processed. Returns ------- delta_ra, delta_dec : tuple of floats Offset in decim...
python
def find_gsc_offset(image, input_catalog='GSC1', output_catalog='GAIA'): """Find the GSC to GAIA offset based on guide star coordinates Parameters ---------- image : str Filename of image to be processed. Returns ------- delta_ra, delta_dec : tuple of floats Offset in decim...
[ "def", "find_gsc_offset", "(", "image", ",", "input_catalog", "=", "'GSC1'", ",", "output_catalog", "=", "'GAIA'", ")", ":", "serviceType", "=", "\"GSCConvert/GSCconvert.aspx\"", "spec_str", "=", "\"TRANSFORM={}-{}&IPPPSSOOT={}\"", "if", "'rootname'", "in", "pf", ".",...
Find the GSC to GAIA offset based on guide star coordinates Parameters ---------- image : str Filename of image to be processed. Returns ------- delta_ra, delta_dec : tuple of floats Offset in decimal degrees of image based on correction to guide star coordinates relati...
[ "Find", "the", "GSC", "to", "GAIA", "offset", "based", "on", "guide", "star", "coordinates" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L271-L308
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
generate_source_catalog
def generate_source_catalog(image, **kwargs): """ Build source catalogs for each chip using photutils. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordinate frame defined by the reference WCS `refwcs`. The sources w...
python
def generate_source_catalog(image, **kwargs): """ Build source catalogs for each chip using photutils. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordinate frame defined by the reference WCS `refwcs`. The sources w...
[ "def", "generate_source_catalog", "(", "image", ",", "**", "kwargs", ")", ":", "if", "not", "isinstance", "(", "image", ",", "pf", ".", "HDUList", ")", ":", "raise", "ValueError", "(", "\"Input {} not fits.HDUList object\"", ".", "format", "(", "image", ")", ...
Build source catalogs for each chip using photutils. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordinate frame defined by the reference WCS `refwcs`. The sources will be - identified using photutils segmentation-b...
[ "Build", "source", "catalogs", "for", "each", "chip", "using", "photutils", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L554-L645
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
generate_sky_catalog
def generate_sky_catalog(image, refwcs, **kwargs): """Build source catalog from input image using photutils. This script borrows heavily from build_source_catalog. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordina...
python
def generate_sky_catalog(image, refwcs, **kwargs): """Build source catalog from input image using photutils. This script borrows heavily from build_source_catalog. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordina...
[ "def", "generate_sky_catalog", "(", "image", ",", "refwcs", ",", "**", "kwargs", ")", ":", "source_cats", "=", "generate_source_catalog", "(", "image", ",", "**", "kwargs", ")", "master_cat", "=", "None", "numSci", "=", "countExtn", "(", "image", ",", "extna...
Build source catalog from input image using photutils. This script borrows heavily from build_source_catalog. The catalog returned by this function includes sources found in all chips of the input image with the positions translated to the coordinate frame defined by the reference WCS `refwcs`. The s...
[ "Build", "source", "catalog", "from", "input", "image", "using", "photutils", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L648-L723
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
compute_photometry
def compute_photometry(catalog, photmode): """ Compute magnitudes for sources from catalog based on observations photmode. Parameters ---------- catalog : `~astropy.table.Table` Astropy Table with 'source_sum' column for the measured flux for each source. photmode : str Specificati...
python
def compute_photometry(catalog, photmode): """ Compute magnitudes for sources from catalog based on observations photmode. Parameters ---------- catalog : `~astropy.table.Table` Astropy Table with 'source_sum' column for the measured flux for each source. photmode : str Specificati...
[ "def", "compute_photometry", "(", "catalog", ",", "photmode", ")", ":", "photmode", "=", "photmode", ".", "replace", "(", "' '", ",", "', '", ")", "vega", "=", "S", ".", "FileSpectrum", "(", "VEGASPEC", ")", "bp", "=", "S", ".", "ObsBandpass", "(", "ph...
Compute magnitudes for sources from catalog based on observations photmode. Parameters ---------- catalog : `~astropy.table.Table` Astropy Table with 'source_sum' column for the measured flux for each source. photmode : str Specification of the observation filter configuration used for...
[ "Compute", "magnitudes", "for", "sources", "from", "catalog", "based", "on", "observations", "photmode", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L726-L758
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
filter_catalog
def filter_catalog(catalog, **kwargs): """ Create a new catalog selected from input based on photometry. Parameters ---------- bright_limit : float Fraction of catalog based on brightness that should be retained. Value of 1.00 means full catalog. max_bright : int Maximum nu...
python
def filter_catalog(catalog, **kwargs): """ Create a new catalog selected from input based on photometry. Parameters ---------- bright_limit : float Fraction of catalog based on brightness that should be retained. Value of 1.00 means full catalog. max_bright : int Maximum nu...
[ "def", "filter_catalog", "(", "catalog", ",", "**", "kwargs", ")", ":", "bright_limit", "=", "kwargs", ".", "get", "(", "'bright_limit'", ",", "1.00", ")", "max_bright", "=", "kwargs", ".", "get", "(", "'max_bright'", ",", "None", ")", "min_bright", "=", ...
Create a new catalog selected from input based on photometry. Parameters ---------- bright_limit : float Fraction of catalog based on brightness that should be retained. Value of 1.00 means full catalog. max_bright : int Maximum number of sources to keep regardless of `bright_l...
[ "Create", "a", "new", "catalog", "selected", "from", "input", "based", "on", "photometry", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L761-L804
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
build_self_reference
def build_self_reference(filename, clean_wcs=False): """ This function creates a reference, undistorted WCS that can be used to apply a correction to the WCS of the input file. Parameters ---------- filename : str Filename of image which will be corrected, and which will form the basis ...
python
def build_self_reference(filename, clean_wcs=False): """ This function creates a reference, undistorted WCS that can be used to apply a correction to the WCS of the input file. Parameters ---------- filename : str Filename of image which will be corrected, and which will form the basis ...
[ "def", "build_self_reference", "(", "filename", ",", "clean_wcs", "=", "False", ")", ":", "if", "'sipwcs'", "in", "filename", ":", "sciname", "=", "'sipwcs'", "else", ":", "sciname", "=", "'sci'", "wcslin", "=", "build_reference_wcs", "(", "[", "filename", "...
This function creates a reference, undistorted WCS that can be used to apply a correction to the WCS of the input file. Parameters ---------- filename : str Filename of image which will be corrected, and which will form the basis of the undistorted WCS. clean_wcs : bool Spe...
[ "This", "function", "creates", "a", "reference", "undistorted", "WCS", "that", "can", "be", "used", "to", "apply", "a", "correction", "to", "the", "WCS", "of", "the", "input", "file", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L807-L855
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
read_hlet_wcs
def read_hlet_wcs(filename, ext): """Insure `stwcs.wcsutil.HSTWCS` includes all attributes of a full image WCS. For headerlets, the WCS does not contain information about the size of the image, as the image array is not present in the headerlet. """ hstwcs = wcsutil.HSTWCS(filename, ext=ext) if...
python
def read_hlet_wcs(filename, ext): """Insure `stwcs.wcsutil.HSTWCS` includes all attributes of a full image WCS. For headerlets, the WCS does not contain information about the size of the image, as the image array is not present in the headerlet. """ hstwcs = wcsutil.HSTWCS(filename, ext=ext) if...
[ "def", "read_hlet_wcs", "(", "filename", ",", "ext", ")", ":", "hstwcs", "=", "wcsutil", ".", "HSTWCS", "(", "filename", ",", "ext", "=", "ext", ")", "if", "hstwcs", ".", "naxis1", "is", "None", ":", "hstwcs", ".", "naxis1", "=", "int", "(", "hstwcs"...
Insure `stwcs.wcsutil.HSTWCS` includes all attributes of a full image WCS. For headerlets, the WCS does not contain information about the size of the image, as the image array is not present in the headerlet.
[ "Insure", "stwcs", ".", "wcsutil", ".", "HSTWCS", "includes", "all", "attributes", "of", "a", "full", "image", "WCS", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L858-L869
train
spacetelescope/drizzlepac
drizzlepac/hlautils/astrometric_utils.py
build_hstwcs
def build_hstwcs(crval1, crval2, crpix1, crpix2, naxis1, naxis2, pscale, orientat): """ Create an `stwcs.wcsutil.HSTWCS` object for a default instrument without distortion based on user provided parameter values. """ wcsout = wcsutil.HSTWCS() wcsout.wcs.crval = np.array([crval1, crval2]) wcsout....
python
def build_hstwcs(crval1, crval2, crpix1, crpix2, naxis1, naxis2, pscale, orientat): """ Create an `stwcs.wcsutil.HSTWCS` object for a default instrument without distortion based on user provided parameter values. """ wcsout = wcsutil.HSTWCS() wcsout.wcs.crval = np.array([crval1, crval2]) wcsout....
[ "def", "build_hstwcs", "(", "crval1", ",", "crval2", ",", "crpix1", ",", "crpix2", ",", "naxis1", ",", "naxis2", ",", "pscale", ",", "orientat", ")", ":", "wcsout", "=", "wcsutil", ".", "HSTWCS", "(", ")", "wcsout", ".", "wcs", ".", "crval", "=", "np...
Create an `stwcs.wcsutil.HSTWCS` object for a default instrument without distortion based on user provided parameter values.
[ "Create", "an", "stwcs", ".", "wcsutil", ".", "HSTWCS", "object", "for", "a", "default", "instrument", "without", "distortion", "based", "on", "user", "provided", "parameter", "values", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L872-L888
train
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", ")", ":", "if", "hasattr", "(", "wcs", ",", "'naxis1'", ")", ":", "naxis1", "=", "wcs", ".", "naxis1", "naxis2", "=", "wcs", ".", "naxis2", "elif", "hasattr", "(", "wcs", ",", ...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L891-L932
train
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.", ")", ":", "if", "isinstance", "(", "image", ",", "str", ")", ":", "image", "=", "pf", ".", "open", "(", "image", ")", "numSci", "=", "countExtn", "(", "image", ",...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L935-L984
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L987-L1109
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/hlautils/astrometric_utils.py#L1117-L1180
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L41-L97
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L283-L312
train
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", ")", ":", "new_wcs", ".", "setOrient", "(", ")", "fimg_open", "=", "False", "if", "not", "isins...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L424-L520
train
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", "...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatehdr.py#L523-L561
train
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", ":", "print", "(", "'No trailer file saved...'", ...
Close log file and restore system defaults.
[ "Close", "log", "file", "and", "restore", "system", "defaults", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L149-L164
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L390-L403
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L406-L410
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L412-L424
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L451-L469
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L471-L482
train
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", ...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L484-L497
train
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", "if", "is_blank", "(", "refimage", ")", ":", "valid", "=", "True", "return", "valid", "refroot", ",", "extroot", "=", "fileutil", ".", "parseFilename", "(", "refimage", ")", "if", ...
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...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L499-L536
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L538-L577
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L580-L623
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L625-L636
train
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", ")", ":", "plist", "=", "getFullParList", "(", "configObj", ")", "extra_pars", "=", "[", "]", "for", "kw", "in", "input_dict", ":", "if", "kw", "not", "in", "plist", ":", "extra_pars", ".", ...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L638-L661
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L663-L677
train
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", ":", "configObj", "=", "teal", ".", "load", "(", "taskname", ")", "elif", "isinsta...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L680-L743
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L745-L750
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L758-L772
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L799-L820
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L860-L868
train
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", ":", "]", ")", "lines", "=", "f", ".", "readline", "(", ")", "f", ".", "close", "(", ")", "if", "len", "(", "line", ".", "split", "(", ")", ...
Open up the '@ file' and read in the science and possible ivm filenames from the first two columns.
[ "Open", "up", "the" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L870-L887
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L890-L896
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L920-L935
train
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?" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L967-L982
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L984-L1009
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1012-L1018
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1034-L1077
train
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", "(", "','", ")", "if", "coords", "is"...
Convert colnames input into list of column numbers.
[ "Convert", "colnames", "input", "into", "list", "of", "column", "numbers", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1079-L1118
train
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", ")", ":", "assert", "(", "dataArray", "is", "not", "None", ")", ",", "\"Please supply a data array for createFiles\"", "try", ":", "fitsobj", "=", "f...
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"...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1121-L1169
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L1171-L1219
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L329-L343
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L345-L363
train
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", ")", ":", "if", "not", "isinstance", "(", "imageObjectList", ",", "list", ")", ":", "imageObjectList", "=", "[", "imageObjectList", "]", "for", "img", "in", "imageObjectList", ":", "img", ".", ...
Build DQ masks for all input images.
[ "Build", "DQ", "masks", "for", "all", "input", "images", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L71-L79
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L82-L85
train
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", ")", ":", "maskname", "=", "output", "if", "fileutil", ".", "findFile", "(", "maskname", ")", ":", "fileutil", ".", "removeFil...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L88-L153
train
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", ")", ":", "if", "type", "(", "detnum", ")", "!=", "type", "(", "''", ")", ":", "detnum", "=", "repr", ...
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L187-L278
train
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", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "maskname", ")...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L396-L416
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L473-L507
train
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", ")", ":", "if", "'maskval'", "not", "in", "paramDict", ":", "return", "0", "maskval", "=", "paramDict", "[", "'maskval'", "]", "if", "maskval", "is", "None", ":", "maskval", "=", "np", ".", "nan", "else", ":"...
Apply logic for interpreting final_maskval value...
[ "Apply", "logic", "for", "interpreting", "final_maskval", "value", "..." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/adrizzle.py#L509-L521
train
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", ")", ":", "if", "len", "(", "shapelist", ")", "<", "1", ":", "_print_warning", "(", "\"The region list is empty. The region file \\\"%s\\\" \"", "\"will be empty.\"", "%", "outfile", ")", "try", ":", "outf", "=...
Writes the current shape list out as a region file
[ "Writes", "the", "current", "shape", "list", "out", "as", "a", "region", "file" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L296-L369
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/mapreg.py#L746-L754
train
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", ...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L8-L49
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L52-L81
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L85-L113
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L118-L145
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/generate_final_product_filenames.py#L149-L176
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1453-L1460
train
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", ")", ":", "points", "=", "sorted", "(", "set", "(", "points", ")", ")", "if", "len", "(", "points", ")", "<=", "1", ":", "return", "points", "def", "cross", "(", "o", ",", "a", ",", "b", ")", ":", "return", ...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1506-L1558
train
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...\"", ")", "zpmat", "=", "_xy_2dhist", "(", "imgxy", ",", "refxy", ",", "r", "=", "searchrad", ")", ...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1613-L1672
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L311-L329
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L331-L338
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L340-L368
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L370-L377
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L379-L394
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L960-L967
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1053-L1064
train
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", ")", ":", "for", "f", "in", "self", ".", "catalog_names", ":", "if", "'match'", "in", "f", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "catalog_names", "[", "f", "]", ")", ":", "log", ".", "info", ...
Remove intermediate files created.
[ "Remove", "intermediate", "files", "created", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1066-L1080
train
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" ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1443-L1447
train
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", "empty_image", "=", "fits", ".", "HDUList", "(", ")", "for", "u", "in", "self", ".", "_image", ":", "empty_image", ".", "append", "(", "u", ".", "__cla...
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...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L93-L113
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L131-L147
train
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", ":", "fname", "=", "self", ".", "_filename", "else", ":", "extn", "=", "exten", ".", "spli...
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L149-L179
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L181-L190
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L212-L220
train
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", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L246-L269
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._findExtnames
def _findExtnames(self, extname=None, exclude=None): """ This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all. """ #make a list of the available exten...
python
def _findExtnames(self, extname=None, exclude=None): """ This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all. """ #make a list of the available exten...
[ "def", "_findExtnames", "(", "self", ",", "extname", "=", "None", ",", "exclude", "=", "None", ")", ":", "extensions", "=", "[", "]", "if", "extname", "is", "not", "None", ":", "if", "not", "isinstance", "(", "extname", ",", "list", ")", ":", "extnam...
This method builds a list of all extensions which have 'EXTNAME'==extname and do not include any extensions with 'EXTNAME'==exclude, if any are specified for exclusion at all.
[ "This", "method", "builds", "a", "list", "of", "all", "extensions", "which", "have", "EXTNAME", "==", "extname", "and", "do", "not", "include", "any", "extensions", "with", "EXTNAME", "==", "exclude", "if", "any", "are", "specified", "for", "exclusion", "at"...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L288-L317
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.findExtNum
def findExtNum(self, extname=None, extver=1): """Find the extension number of the give extname and extver.""" extnum = None extname = extname.upper() if not self._isSimpleFits: for ext in self._image: if (hasattr(ext,'_extension') and 'IMAGE' in ext._extensio...
python
def findExtNum(self, extname=None, extver=1): """Find the extension number of the give extname and extver.""" extnum = None extname = extname.upper() if not self._isSimpleFits: for ext in self._image: if (hasattr(ext,'_extension') and 'IMAGE' in ext._extensio...
[ "def", "findExtNum", "(", "self", ",", "extname", "=", "None", ",", "extver", "=", "1", ")", ":", "extnum", "=", "None", "extname", "=", "extname", ".", "upper", "(", ")", "if", "not", "self", ".", "_isSimpleFits", ":", "for", "ext", "in", "self", ...
Find the extension number of the give extname and extver.
[ "Find", "the", "extension", "number", "of", "the", "give", "extname", "and", "extver", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L319-L332
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._assignRootname
def _assignRootname(self, chip): """ Assign a unique rootname for the image based in the expname. """ extname=self._image[self.scienceExt,chip].header["EXTNAME"].lower() extver=self._image[self.scienceExt,chip].header["EXTVER"] expname = self._rootname # record extension-based n...
python
def _assignRootname(self, chip): """ Assign a unique rootname for the image based in the expname. """ extname=self._image[self.scienceExt,chip].header["EXTNAME"].lower() extver=self._image[self.scienceExt,chip].header["EXTVER"] expname = self._rootname # record extension-based n...
[ "def", "_assignRootname", "(", "self", ",", "chip", ")", ":", "extname", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", ".", "header", "[", "\"EXTNAME\"", "]", ".", "lower", "(", ")", "extver", "=", "self", ".", "_image...
Assign a unique rootname for the image based in the expname.
[ "Assign", "a", "unique", "rootname", "for", "the", "image", "based", "in", "the", "expname", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L334-L346
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._setOutputNames
def _setOutputNames(self,rootname,suffix='_drz'): """ Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file. """...
python
def _setOutputNames(self,rootname,suffix='_drz'): """ Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file. """...
[ "def", "_setOutputNames", "(", "self", ",", "rootname", ",", "suffix", "=", "'_drz'", ")", ":", "outFinal", "=", "rootname", "+", "suffix", "+", "'.fits'", "outSci", "=", "rootname", "+", "suffix", "+", "'_sci.fits'", "outWeight", "=", "rootname", "+", "su...
Define the default output filenames for drizzle products, these are based on the original rootname of the image filename should be just 1 filename, so call this in a loop for chip names contained inside a file.
[ "Define", "the", "default", "output", "filenames", "for", "drizzle", "products", "these", "are", "based", "on", "the", "original", "rootname", "of", "the", "image", "filename", "should", "be", "just", "1", "filename", "so", "call", "this", "in", "a", "loop",...
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L348-L389
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject._initVirtualOutputs
def _initVirtualOutputs(self): """ Sets up the structure to hold all the output data arrays for this image in memory. """ self.virtualOutputs = {} for product in self.outputNames: self.virtualOutputs[product] = None
python
def _initVirtualOutputs(self): """ Sets up the structure to hold all the output data arrays for this image in memory. """ self.virtualOutputs = {} for product in self.outputNames: self.virtualOutputs[product] = None
[ "def", "_initVirtualOutputs", "(", "self", ")", ":", "self", ".", "virtualOutputs", "=", "{", "}", "for", "product", "in", "self", ".", "outputNames", ":", "self", ".", "virtualOutputs", "[", "product", "]", "=", "None" ]
Sets up the structure to hold all the output data arrays for this image in memory.
[ "Sets", "up", "the", "structure", "to", "hold", "all", "the", "output", "data", "arrays", "for", "this", "image", "in", "memory", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L417-L423
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.saveVirtualOutputs
def saveVirtualOutputs(self,outdict): """ Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'. """ if not self.inmemory: return for outname in outdict: self.virtualOutputs[outname] = outdict[outname]
python
def saveVirtualOutputs(self,outdict): """ Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'. """ if not self.inmemory: return for outname in outdict: self.virtualOutputs[outname] = outdict[outname]
[ "def", "saveVirtualOutputs", "(", "self", ",", "outdict", ")", ":", "if", "not", "self", ".", "inmemory", ":", "return", "for", "outname", "in", "outdict", ":", "self", ".", "virtualOutputs", "[", "outname", "]", "=", "outdict", "[", "outname", "]" ]
Assign in-memory versions of generated products for this ``imageObject`` based on dictionary 'outdict'.
[ "Assign", "in", "-", "memory", "versions", "of", "generated", "products", "for", "this", "imageObject", "based", "on", "dictionary", "outdict", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L425-L432
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.getOutputName
def getOutputName(self,name): """ Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory. """ val = self.outputNames[name] if self.inmemory: # if inmemory was turned on... # return virtualOutput object saved w...
python
def getOutputName(self,name): """ Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory. """ val = self.outputNames[name] if self.inmemory: # if inmemory was turned on... # return virtualOutput object saved w...
[ "def", "getOutputName", "(", "self", ",", "name", ")", ":", "val", "=", "self", ".", "outputNames", "[", "name", "]", "if", "self", ".", "inmemory", ":", "val", "=", "self", ".", "virtualOutputs", "[", "val", "]", "return", "val" ]
Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory.
[ "Return", "the", "name", "of", "the", "file", "or", "PyFITS", "object", "associated", "with", "that", "name", "depending", "on", "the", "setting", "of", "self", ".", "inmemory", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L434-L442
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.updateOutputValues
def updateOutputValues(self,output_wcs): """ Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object. """ outputvals = self.outputValues outputvals['output'] = output_wcs.outputNames['outFinal'] outputvals['outnx'], outputval...
python
def updateOutputValues(self,output_wcs): """ Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object. """ outputvals = self.outputValues outputvals['output'] = output_wcs.outputNames['outFinal'] outputvals['outnx'], outputval...
[ "def", "updateOutputValues", "(", "self", ",", "output_wcs", ")", ":", "outputvals", "=", "self", ".", "outputValues", "outputvals", "[", "'output'", "]", "=", "output_wcs", ".", "outputNames", "[", "'outFinal'", "]", "outputvals", "[", "'outnx'", "]", ",", ...
Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object.
[ "Copy", "info", "from", "output", "WCSObject", "into", "outputnames", "for", "each", "chip", "for", "use", "in", "creating", "outputimage", "object", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L447-L468
train