code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
logger.info('Starting rpmbuild to build: {0} SRPM.'.format(specfile))
if save_dir != get_default_save_path():
try:
msg = subprocess.Popen(
['rpmbuild',
'--define', '_sourcedir {0}'.format(save_dir),
'--define', '_builddir {0}'.format(sav... | def build_srpm(specfile, save_dir) | Builds a srpm from given specfile using rpmbuild.
Generated srpm is stored in directory specified by save_dir.
Args:
specfile: path to a specfile
save_dir: path to source and build tree | 2.194827 | 2.21729 | 0.989869 |
minor_major_regex = re.compile("-\d.?\d?$")
return [x for x in scripts if not minor_major_regex.search(x)] | def remove_major_minor_suffix(scripts) | Checks if executables already contain a "-MAJOR.MINOR" suffix. | 4.665373 | 4.213418 | 1.107265 |
build_deps = copy.deepcopy(runtime_deps)
for dep in build_deps:
if len(dep) > 0:
dep[0] = 'BuildRequires'
return build_deps | def runtime_to_build(runtime_deps) | Adds all runtime deps to build deps | 4.305658 | 4.128199 | 1.042987 |
deps.sort()
return list(k for k, _ in itertools.groupby(deps)) | def unique_deps(deps) | Remove duplicities from deps list of the lists | 5.576541 | 4.74893 | 1.174273 |
old_time_locale = locale.getlocale(locale.LC_TIME)
locale.setlocale(locale.LC_TIME, 'C')
yield
locale.setlocale(locale.LC_TIME, old_time_locale) | def c_time_locale() | Context manager with C LC_TIME locale | 2.005813 | 1.970804 | 1.017764 |
try:
value = subprocess.Popen(
['rpm', '--eval', macro],
stdout=subprocess.PIPE).communicate()[0].strip()
except OSError:
logger.error('Failed to get value of {0} rpm macro'.format(
macro), exc_info=True)
value = b''
return console_to_str(valu... | def rpm_eval(macro) | Get value of given macro using rpm tool | 3.906656 | 3.595253 | 1.086615 |
macro = '%{_topdir}'
if rpm:
save_path = rpm.expandMacro(macro)
else:
save_path = rpm_eval(macro)
if not save_path:
logger.warn("rpm tools are missing, using default save path "
"~/rpmbuild/.")
save_path = os.path.expanduser('~/rpm... | def get_default_save_path() | Return default save path for the packages | 8.262697 | 7.718862 | 1.070455 |
filteredTable = Table()
run_align(input_list, result=filteredTable, **kwargs)
return filteredTable | def perform_align(input_list, **kwargs) | Main calling function.
Parameters
----------
input_list : list
List of one or more IPPSSOOTs (rootnames) to align.
archive : Boolean
Retain copies of the downloaded files in the astroquery created sub-directories?
clobber : Boolean
Download and overwrite existing local cop... | 9.081182 | 10.775684 | 0.842748 |
log.info("------------------- STEP 5b: (match_relative_fit) Cross matching and fitting ---------------------------")
# 0: Specify matching algorithm to use
match = tweakwcs.TPMatch(searchrad=75, separation=0.1,
tolerance=2, use2dhist=True)
# match = tweakwcs.TPMatch(sea... | def match_relative_fit(imglist, reference_catalog) | Perform cross-matching and final fit using 2dHistogram matching
Parameters
----------
imglist : list
List of input image `~tweakwcs.tpwcs.FITSWCS` objects with metadata and source catalogs
reference_catalog : Table
Astropy Table of reference sources for this field
Returns
----... | 7.978938 | 7.706194 | 1.035393 |
log.info("-------------------- STEP 5b: (match_default_fit) Cross matching and fitting ---------------------------")
# Specify matching algorithm to use
match = tweakwcs.TPMatch(searchrad=250, separation=0.1,
tolerance=100, use2dhist=False)
# Align images and correct WC... | def match_default_fit(imglist, reference_catalog) | Perform cross-matching and final fit using 2dHistogram matching
Parameters
----------
imglist : list
List of input image `~tweakwcs.tpwcs.FITSWCS` objects with metadata and source catalogs
reference_catalog : Table
Astropy Table of reference sources for this field
Returns
----... | 10.400321 | 9.849094 | 1.055967 |
# generate catalog
temp_pars = pars.copy()
if pars['output'] == True:
pars['output'] = 'ref_cat.ecsv'
else:
pars['output'] = None
out_catalog = amutils.create_astrometric_catalog(imglist,**pars)
pars = temp_pars.copy()
#if the catalog has contents, write the catalog to a... | def generate_astrometric_catalog(imglist, **pars) | Generates a catalog of all sources from an existing astrometric catalog are in or near the FOVs of the images in
the input list.
Parameters
----------
imglist : list
List of one or more calibrated fits images that will be used for catalog generation.
Returns
=======
ref_table :... | 4.071446 | 3.993756 | 1.019453 |
output = pars.get('output', False)
sourcecatalogdict = {}
for imgname in imglist:
log.info("Image name: {}".format(imgname))
sourcecatalogdict[imgname] = {}
# open image
imghdu = fits.open(imgname)
imgprimaryheader = imghdu[0].header
instrument = imgpri... | 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
a dictionary (keyed by image name) of two elemen... | 3.946356 | 3.854948 | 1.023712 |
out_headerlet_dict = {}
for item in tweakwcs_output:
imageName = item.meta['filename']
chipnum = item.meta['chip']
if chipnum == 1:
chipctr = 1
hdulist = fits.open(imageName, mode='update')
num_sci_ext = amutils.countExtn(hdulist)
# g... | 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
input image.
Returns
... | 4.028672 | 3.76856 | 1.069022 |
# Get the data to be used as values for FITS keywords
rms_ra = tweakwcs_item.meta['fit_info']['RMS_RA'].value
rms_dec = tweakwcs_item.meta['fit_info']['RMS_DEC'].value
fit_rms = tweakwcs_item.meta['fit_info']['FIT_RMS']
nmatch = tweakwcs_item.meta['fit_info']['nmatches']
catalog = tweakwcs... | 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 input image.
headerlet :
object containing WCS in... | 2.269608 | 2.279821 | 0.99552 |
if input is not None:
inputDict['input']=input
inputDict['output']=None
inputDict['updatewcs']=False
inputDict['group']=group
else:
print("Please supply an input image", file=sys.stderr)
raise ValueError
configObj = util.getDefaultConfigObj(__taskname_... | 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 instance of configObject
inputDict : dict, optional
an optional list of parameters specifi... | 4.65004 | 5.719779 | 0.812975 |
skyKW="MDRIZSKY" #header keyword that contains the sky that's been subtracted
# create dict of fname=sky pairs
skyvals = {}
if apply_sky is None:
skyapplied = False # flag whether sky has already been applied to images
else:
skyapplied = apply_sky
for line in open(skyFile)... | def _skyUserFromFile(imageObjList, skyFile, apply_sky=None) | Apply sky value as read in from a user-supplied input file. | 4.888431 | 4.824945 | 1.013158 |
_skyValue=0.0 #this will be the sky value computed for the exposure
skyKW="MDRIZSKY" #header keyword that contains the sky that's been subtracted
#just making sure, tricky users and all, these are things that will be used
#by the sky function so we want them defined at least
try:
as... | def _skyUserFromHeaderKwd(imageSet,paramDict) | subtract the sky from all the chips in the imagefile that imageSet represents
imageSet is a single imageObject reference
paramDict should be the subset from an actual config object | 7.155529 | 6.988987 | 1.023829 |
#this object contains the returned values from the image stats routine
_tmp = imagestats.ImageStats(image.data,
fields = skypars['skystat'],
lower = skypars['skylower'],
upper = skypars['skyupper'],
nclip = skypars['skyclip'],
... | 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 | 5.794858 | 5.643986 | 1.026732 |
try:
np.subtract(image.data,skyValue,image.data)
except IOError:
print("Unable to perform sky subtraction on data array")
raise IOError | 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 | 5.902302 | 5.834482 | 1.011624 |
# 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]'%(exten)
log.info('Updating keyword %s in %s' % (skyKW, filename + strexten))
fobj = ... | def _updateKW(image, filename, exten, skyKW, Value) | update the header with the kw,value | 3.775806 | 3.757106 | 1.004977 |
skyKW = "MDRIZSKY"
Value = 0.0
for imageSet in imageObjList:
fname = imageSet._filename
numchips=imageSet._numchips
sciExt=imageSet.scienceExt
fobj = fileutil.openImage(fname, mode='update', memmap=False)
for chip in range(1,numchips+1,1):
ext = (sciE... | def _addDefaultSkyKW(imageObjList) | Add MDRIZSKY keyword to "commanded" SCI headers of all input images,
if that keyword does not already exist. | 5.042875 | 4.641229 | 1.086539 |
helpstr = getHelpAsString(docstring=True, show_ver = True)
if file is None:
print(helpstr)
else:
if os.path.exists(file): os.remove(file)
f = open(file, mode = 'w')
f.write(helpstr)
f.close() | def help(file=None) | Print out syntax help for running astrodrizzle
Parameters
----------
file : str (Default = None)
If given, write out help to the filename specified by this parameter
Any previously existing file with this name will be deleted before
writing out the help. | 3.41576 | 3.620704 | 0.943397 |
single_coord = False
if coordfile is not None:
if colnames in blank_list:
colnames = ['c1','c2']
elif isinstance(colnames,type('a')):
colnames = colnames.split(',')
# convert input file coordinates to lists of decimal degrees values
xlist,ylist = twea... | def rd2xy(input,ra=None,dec=None,coordfile=None,colnames=None,
precision=6,output=None,verbose=True) | Primary interface to perform coordinate transformations from
pixel to sky coordinates using STWCS and full distortion models
read from the input image header. | 3.121752 | 3.143828 | 0.992978 |
# interpret input parameters
catalog = pars.get("catalog", 'GAIADR2')
output = pars.get("output", 'ref_cat.ecsv')
gaia_only = pars.get("gaia_only", False)
table_format = pars.get("table_format", 'ascii.ecsv')
existing_wcs = pars.get("existing_wcs", None)
inputs, _ = parseinput.parseinp... | 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 positions for sources in the
input images' field-... | 3.896356 | 3.630044 | 1.073363 |
# 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, num + 1)
if sciname == 'sci':
extwcs = wcsutil.HSTWCS(img, ext=extname)
else... | def build_reference_wcs(inputs, sciname='sci') | Create the reference WCS based on all the inputs for a field | 7.941836 | 8.155872 | 0.973757 |
serviceType = 'vo/CatalogSearch.aspx'
spec_str = 'RA={}&DEC={}&SR={}&FORMAT={}&CAT={}&MINDET=5'
headers = {'Content-Type': 'text/csv'}
spec = spec_str.format(ra, dec, sr, fmt, catalog)
serviceUrl = '{}/{}?{}'.format(SERVICELOCATION, serviceType, spec)
rawcat = requests.get(serviceUrl, head... | 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)
sr : float, optional
Search radius (in decimal degrees) ... | 6.019142 | 6.192964 | 0.971932 |
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=wcs_foot[:, 1] * u.degree)
radius = img_center.separation(img_corners).max().value
return... | def compute_radius(wcs) | Compute the radius from the center to the furthest edge of the WCS. | 2.653549 | 2.471237 | 1.073773 |
serviceType = "GSCConvert/GSCconvert.aspx"
spec_str = "TRANSFORM={}-{}&IPPPSSOOT={}"
if 'rootname' in pf.getheader(image):
ippssoot = pf.getval(image, 'rootname').upper()
else:
ippssoot = fu.buildNewRootname(image).upper()
spec = spec_str.format(input_catalog, output_catalog, ... | 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 decimal degrees of image based on correction to guide star
coordinates relati... | 5.469059 | 5.552247 | 0.985017 |
moments = catalog.moments_central
if sources is None:
sources = (0, len(moments))
num_sources = sources[1] - sources[0]
srctype = np.zeros((num_sources,), np.int32)
for src in range(sources[0], sources[1]):
# Protect against spurious detections
src_x = catalog[src].xcent... | def classify_sources(catalog, sources=None) | Convert moments_central attribute for source catalog into star/cr flag.
This algorithm interprets the central_moments from the source_properties
generated for the sources as more-likely a star or a cosmic-ray. It is not
intended or expected to be precise, merely a means of making a first cut at
removi... | 2.875177 | 2.583287 | 1.112992 |
if not isinstance(image, pf.HDUList):
raise ValueError("Input {} not fits.HDUList object".format(image))
dqname = kwargs.get('dqname', 'DQ')
output = kwargs.get('output', None)
# Build source catalog for entire image
source_cats = {}
numSci = countExtn(image, extname='SCI')
for... | 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 will be
- identified using photutils segmentation-b... | 5.466904 | 5.04722 | 1.083152 |
# Extract source catalogs for each chip
source_cats = generate_source_catalog(image, **kwargs)
# Build source catalog for entire image
master_cat = None
numSci = countExtn(image, extname='SCI')
# if no refwcs specified, build one now...
if refwcs is None:
refwcs = build_referen... | 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 coordinate frame
defined by the reference WCS `refwcs`. The s... | 3.471708 | 3.22601 | 1.076162 |
# Determine VEGAMAG zero-point using pysynphot for this photmode
photmode = photmode.replace(' ', ', ')
vega = S.FileSpectrum(VEGASPEC)
bp = S.ObsBandpass(photmode)
vegauvis = S.Observation(vega, bp)
vegazpt = 2.5 * np.log10(vegauvis.countrate())
# Use zero-point to convert flux values... | 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
Specification of the observation filter configuration used for... | 5.349174 | 4.187308 | 1.277473 |
# interpret input pars
bright_limit = kwargs.get('bright_limit', 1.00)
max_bright = kwargs.get('max_bright', None)
min_bright = kwargs.get('min_bright', 20)
colname = kwargs.get('colname', 'vegamag')
# sort by magnitude
phot_column = catalog[colname]
num_sources = len(phot_column)
... | 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 number of sources to keep regardless of `bright_l... | 4.102029 | 3.302634 | 1.242048 |
if 'sipwcs' in filename:
sciname = 'sipwcs'
else:
sciname = 'sci'
wcslin = build_reference_wcs([filename], sciname=sciname)
if clean_wcs:
wcsbase = wcslin.wcs
customwcs = build_hstwcs(wcsbase.crval[0], wcsbase.crval[1], wcsbase.crpix[0],
... | 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
of the undistorted WCS.
clean_wcs : bool
Spe... | 3.496007 | 3.467791 | 1.008137 |
hstwcs = wcsutil.HSTWCS(filename, ext=ext)
if hstwcs.naxis1 is None:
hstwcs.naxis1 = int(hstwcs.wcs.crpix[0] * 2.) # Assume crpix is center of chip
hstwcs.naxis2 = int(hstwcs.wcs.crpix[1] * 2.)
return hstwcs | 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. | 2.691509 | 2.80813 | 0.95847 |
wcsout = wcsutil.HSTWCS()
wcsout.wcs.crval = np.array([crval1, crval2])
wcsout.wcs.crpix = np.array([crpix1, crpix2])
wcsout.naxis1 = naxis1
wcsout.naxis2 = naxis2
wcsout.wcs.cd = buildRotMatrix(orientat) * [-1, 1] * pscale / 3600.0
# Synchronize updates with astropy.wcs objects
wcs... | 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. | 2.385273 | 2.46378 | 0.968135 |
# start with limits of WCS shape
if hasattr(wcs, 'naxis1'):
naxis1 = wcs.naxis1
naxis2 = wcs.naxis2
elif hasattr(wcs, 'pixel_shape'):
naxis1, naxis2 = wcs.pixel_shape
else:
naxis1 = wcs._naxis1
naxis2 = wcs._naxis2
maskx = np.bitwise_or(x < 0, x > naxis1)... | 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 defined.
x, y : ndarray
arrays ... | 2.616979 | 2.566099 | 1.019828 |
# Interpret input image to generate initial source catalog and WCS
if isinstance(image, str):
image = pf.open(image)
numSci = countExtn(image, extname='SCI')
ref_x = refwcs._naxis1
ref_y = refwcs._naxis2
# convert border value into pixels
border_pixels = int(border / refwcs.psca... | 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.HSTWCS`
Reference WCS for coordinate frame of image.
... | 2.677021 | 2.642776 | 1.012958 |
open_file = False
if isinstance(image, str):
hdulist = pf.open(image)
open_file = True
elif isinstance(image, pf.HDUList):
hdulist = image
else:
log.info("Wrong type of input, {}, for build_wcscat...".format(type(image)))
raise ValueError
wcs_catalogs = ... | 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 group this image should be associated with; primarily
... | 3.311304 | 2.806833 | 1.17973 |
f = open(fileutil.osfn(shiftfile))
shift_lines = [x.strip() for x in f.readlines()]
f.close()
# interpret header of shift file
for line in shift_lines:
if 'refimage' in line or 'reference' in line:
refimage = line.split(':')[-1]
refimage = refimage[:refimage.fin... | 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 this fit. If
a value of None is given, it will automatically use 'TW... | 3.30555 | 3.353846 | 0.9856 |
x0 = imcrpix[0]
y0 = imcrpix[1]
p = np.asarray([[x0, y0],
[x0 - hx, y0],
[x0 - hx * 0.5, y0],
[x0 + hx * 0.5, y0],
[x0 + hx, y0],
[x0, y0 - hy],
[x0, y0 - hy * 0.5],
... | def linearize(wcsim, wcsima, wcsref, imcrpix, f, shift, hx=1.0, hy=1.0) | linearization using 5-point formula for first order derivative | 2.312346 | 2.292825 | 1.008514 |
# Start by insuring that the correct value of 'orientat' has been computed
new_wcs.setOrient()
fimg_open=False
if not isinstance(image, fits.HDUList):
fimg = fits.open(image, mode='update', memmap=False)
fimg_open = True
fimg_update = True
else:
fimg = image
... | 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
Filename of image with WCS that needs to be updated
extnum : int
Extension numb... | 4.963619 | 5.022029 | 0.988369 |
wnames = list(wcsutil.altwcs.wcsnames(fimg, ext=extnum).values())
if wcsname not in wnames:
uniqname = wcsname
else:
# setup pattern to match
rpatt = re.compile(wcsname+'_\d')
index = 0
for wname in wnames:
rmatch = rpatt.match(wname)
if r... | 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
PyFITS object of image with WCS information to be updated
extn... | 4.237802 | 4.750978 | 0.891985 |
if not can_parallel:
return 1
# Give priority to their specified cfg value, over the actual cpu count
if usr_config_value is not None:
if num_tasks is None:
return usr_config_value
else:
# usr_config_value may be needlessly high
return min(us... | def get_pool_size(usr_config_value, num_tasks) | Determine size of thread/process-pool for parallel processing.
This examines the cpu_count to decide and return the right pool
size to use. Also take into account the user's wishes via the config
object value, if specified. On top of that, don't allow the pool size
returned to be any higher than the n... | 5.229695 | 4.542332 | 1.151324 |
if logfile == "INDEF":
if not is_blank(default):
logname = fileutil.buildNewRootname(default, '.log')
else:
logname = DEFAULT_LOGNAME
elif logfile not in [None, "" , " "]:
if logfile.endswith('.log'):
logname = logfile
else:
l... | def init_logging(logfile=DEFAULT_LOGNAME, default=None, level=logging.INFO) | Set up logger for capturing stdout/stderr messages.
Must be called prior to writing any messages that you want to log. | 4.374034 | 4.392302 | 0.995841 |
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_logging and a filename was given...
print('No trailer file saved...')
... | def end_logging(filename=None) | Close log file and restore system defaults. | 8.043685 | 8.193849 | 0.981674 |
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:
val = num
return filename[0:val] | def findrootname(filename) | Return the rootname of the given file. | 3.718534 | 3.755351 | 0.990196 |
if filename is not None and filename.strip() != '':
if os.path.exists(filename) and clobber: os.remove(filename) | def removeFileSafely(filename,clobber=True) | Delete the file specified, but only if it exists and clobber is True. | 3.20979 | 3.16811 | 1.013156 |
if sys.version_info[0] >= 3:
from tkinter.messagebox import showwarning
else:
from tkMessageBox import showwarning
if display:
msg = 'No valid input files found! '+\
'Please check the value for the "input" parameter.'
showwarning(parent=parent,message=msg, title... | def displayEmptyInputWarningBox(display=True, parent=None) | Displays a warning box for the 'input' parameter. | 4.982515 | 4.433644 | 1.123797 |
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'] == extname:
num_sci += 1
if num_sci == 0:
extname = 'PRIMARY'
num_sci = 1
hdu_list.close()
... | def count_sci_extensions(filename) | Return the number of SCI extensions and the EXTNAME from a input MEF file. | 2.991931 | 2.634947 | 1.13548 |
uniq = True
numsci,extname = count_sci_extensions(fname)
wnames = altwcs.wcsnames(fname,ext=(extname,1))
if wcsname in wnames.values():
uniq = False
return uniq | def verifyUniqueWcsname(fname,wcsname) | Report whether or not the specified WCSNAME already exists in the file | 10.450668 | 10.759377 | 0.971308 |
updated = True
numsci,extname = count_sci_extensions(fname)
for n in range(1,numsci+1):
hdr = fits.getheader(fname, extname=extname, extver=n, memmap=False)
if 'wcsname' not in hdr:
updated = False
break
return updated | 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. | 4.842686 | 3.760391 | 1.287814 |
valid = True
# start by trying to see whether the code can even find the file
if is_blank(refimage):
valid=True
return valid
refroot,extroot = fileutil.parseFilename(refimage)
if not os.path.exists(refroot):
valid = False
return valid
# if a MEF has been s... | 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 itself. If either test fails, it returns
a ... | 5.757493 | 4.328832 | 1.330034 |
rootname,extroot = fileutil.parseFilename(filename)
extnum = None
if extroot is None:
fimg = fits.open(rootname, memmap=False)
for i,extn in enumerate(fimg):
if 'crval1' in extn.header:
refwcs = wcsutil.HSTWCS('{}[{}]'.format(rootname,i))
if r... | 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 first extension which
conta... | 3.024672 | 2.756594 | 1.09725 |
badfiles = []
archive_dir = False
for img in filelist:
fname = fileutil.osfn(img)
if 'OrIg_files' in os.path.split(fname)[0]:
archive_dir = True
try:
fp = open(fname,mode='a')
fp.close()
except IOError as e:
if e.errno == e... | 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. | 4.492291 | 4.282643 | 1.048953 |
plist = []
for par in configObj.keys():
if isinstance(configObj[par],configobj.Section):
plist.extend(getFullParList(configObj[par]))
else:
plist.append(par)
return plist | def getFullParList(configObj) | Return a single list of all parameter names included in the configObj
regardless of which section the parameter was stored | 2.190701 | 2.336761 | 0.937495 |
# check to see whether any input parameters are unexpected.
# Any unexpected parameters provided on input should be reported and
# the code should stop
plist = getFullParList(configObj)
extra_pars = []
for kw in input_dict:
if kw not in plist:
extra_pars.append(kw)
i... | 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. | 4.531107 | 4.556181 | 0.994497 |
step_kws = {'7a': 'final_wcs', '3a': 'driz_sep_wcs'}
stepname = getSectionName(configObj,step)
finalParDict = configObj[stepname].copy()
del finalParDict[step_kws[step]]
# interpret input_dict to find any parameters for this step specified by the user
user_pars = {}
for kw in finalParD... | 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. | 5.31234 | 4.679241 | 1.1353 |
if configObj is None:
# Start by grabbing the default values without using the GUI
# This insures that all subsequent use of the configObj includes
# all parameters and their last saved values
configObj = teal.load(taskname)
elif isinstance(configObj,str):
if configO... | 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
The valid values for 'configObj' would be::
None ... | 6.928693 | 6.409406 | 1.081019 |
for key in configObj.keys():
if key.find('STEP '+str(stepnum)+':') >= 0:
return key | def getSectionName(configObj,stepnum) | Return section label based on step number. | 3.866924 | 3.571114 | 1.082834 |
if sys.version_info[0] >= 3:
from tkinter.messagebox import showwarning
else:
from tkMessageBox import showwarning
ans = {'yes':True,'no':False}
if ans[display]:
msg = 'Setting "updatewcs=yes" will result '+ \
'in all input WCS values to be recomputed '+ \
... | def displayMakewcsWarningBox(display=True, parent=None) | Displays a warning box for the 'makewcs' parameter. | 6.689938 | 6.386334 | 1.04754 |
if log is not None:
def output(msg):
log.info(msg)
else:
def output(msg):
print(msg)
if not paramDictionary:
output('No parameters were supplied')
else:
for key in sorted(paramDictionary):
if all or (not isinstance(paramDictionar... | def printParams(paramDictionary, all=False, log=None) | Print nicely the parameters from the dictionary. | 3.02665 | 3.006906 | 1.006566 |
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) | Return True if the input is a comma separated list of names. | 3.055888 | 2.944109 | 1.037967 |
f = open(inputFilelist[1:])
# check the first line in order to determine whether
# IVM files have been specified in a second column...
lines = f.readline()
f.close()
# If there is a second column...
if len(line.split()) == 2:
# ...parse out the names of the IVM files as well
... | def loadFileList(inputFilelist) | Open up the '@ file' and read in the science and possible
ivm filenames from the first two columns. | 8.168549 | 6.563791 | 1.244486 |
names=fileList.split(',')
fileList=[]
for item in names:
fileList.append(item)
return fileList | def readCommaList(fileList) | Return a list of the files with the commas removed. | 3.868208 | 3.432045 | 1.127085 |
newfilelist = []
if removed_files == []:
return filelist, ivmlist
else:
sci_ivm = list(zip(filelist, ivmlist))
for f in removed_files:
result=[sci_ivm.remove(t) for t in sci_ivm if t[0] == f ]
ivmlist = [el[1] for el in sci_ivm]
newfilelist = [el[0] ... | 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. | 3.181778 | 3.194584 | 0.995992 |
if 'expstart' in primary_hdr:
exphdr = primary_hdr
else:
exphdr = header
if 'EXPSTART' in exphdr:
expstart = float(exphdr['EXPSTART'])
expend = float(exphdr['EXPEND'])
else:
expstart = 0.
expend = 0.0
return (expstart,expend) | def get_expstart(header,primary_hdr) | shouldn't this just be defined in the instrument subclass of imageobject? | 2.106129 | 2.106677 | 0.99974 |
expnames = []
exptimes = []
start = []
end = []
for img in imageObjectList:
expnames += img.getKeywordList('_expname')
exptimes += img.getKeywordList('_exptime')
start += img.getKeywordList('_expstart')
end += img.getKeywordList('_expend')
exptime = 0.
e... | 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. | 2.684264 | 2.668788 | 1.005799 |
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) | Determine the range spanned by an array of pixel positions. | 2.209141 | 2.137024 | 1.033746 |
if angle:
_rotm = fileutil.buildRotMatrix(angle)
# Rotate about the center
_corners = np.dot(corners, _rotm)
else:
# If there is no rotation, simply return original values
_corners = corners
return computeRange(_corners) | def getRotatedSize(corners, angle) | Determine the size of a rotated (meta)image. | 8.1059 | 7.898274 | 1.026287 |
fin = open(infile,'r')
outarr = []
for l in fin.readlines():
l = l.strip()
if len(l) == 0 or len(l.split()) < len(cols) or (len(l) > 0 and l[0] == '#' or (l.find("INDEF") > -1)): continue
for i in range(10):
lnew = l.replace(" "," ")
if lnew == l: break... | 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 numpy arrays
(DEFAULT- [0,1,2,3]).
Returns
-----... | 2.648438 | 2.709009 | 0.977641 |
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(coords)[0]:
# Open FITS file with table
ftab = fits.open(coords, memmap=False)
# deter... | def parse_colnames(colnames,coords=None) | Convert colnames input into list of column numbers. | 3.130208 | 3.067324 | 1.020501 |
# Insure that at least a data-array has been provided to create the file
assert(dataArray is not None), "Please supply a data array for createFiles"
try:
# Create the output file
fitsobj = fits.HDUList()
if header is not None:
try:
del(header['NAXIS1... | 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. | 2.619873 | 2.560848 | 1.023049 |
if not isinstance(taskname, str):
return taskname
indx = taskname.rfind('.')
if indx >= 0:
base_taskname = taskname[(indx+1):]
pkg_name = taskname[:indx]
else:
base_taskname = taskname
pkg_name = ''
assert(True if packagename is None else (pa... | 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 of the right-most dot. If a dot is not found, it will return... | 2.836988 | 3.302225 | 0.859114 |
ptime = _ptime()
print('==== Processing Step ',key,' started at ',ptime[0])
self.steps[key] = {'start':ptime}
self.order.append(key) | def addStep(self,key) | Add information about a new step to the dict of steps
The value 'ptime' is the output from '_ptime()' containing
both the formatted and unformatted time for the start of the
step. | 9.8302 | 6.479679 | 1.517081 |
ptime = _ptime()
if key is not None:
self.steps[key]['end'] = ptime
self.steps[key]['elapsed'] = ptime[1] - self.steps[key]['start'][1]
self.end = ptime
print('==== Processing Step ',key,' finished at ',ptime[0])
print('') | 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. | 5.311592 | 4.875955 | 1.089344 |
self.end = _ptime()
total_time = 0
print(ProcSteps.__report_header)
for step in self.order:
if 'elapsed' in self.steps[step]:
_time = self.steps[step]['elapsed']
else:
_time = 0.0
total_time += _time
... | def reportTimes(self) | Print out a formatted summary of the elapsed times for all the
performed steps. | 4.054724 | 3.594251 | 1.128114 |
# If called from interactive user-interface, configObj will not be
# defined yet, so get defaults using EPAR/TEAL.
#
# Also insure that the input_dict (user-specified values) are folded in
# with a fully populated configObj instance.
configObj = util.getDefaultConfigObj(__taskname__,configO... | def run(configObj=None, input_dict={}, loadOnly=False) | Build DQ masks from all input images, then apply static mask(s). | 12.554996 | 11.999645 | 1.046281 |
# Insure that input imageObject is a list
if not isinstance(imageObjectList, list):
imageObjectList = [imageObjectList]
for img in imageObjectList:
img.buildMask(configObj['single'], configObj['bits']) | def buildDQMasks(imageObjectList,configObj) | Build DQ masks for all input images. | 4.967379 | 5.139841 | 0.966446 |
return bitfield_to_boolean_mask(dqarr, bitvalue, good_mask_value=1,
dtype=np.uint8) | def buildMask(dqarr, bitvalue) | Builds a bit-mask from an input DQ array and a bitvalue flag | 8.059976 | 8.834796 | 0.912299 |
# If no bitvalue is set or rootname given, assume no mask is desired
# However, this name would be useful as the output mask from
# other processing, such as MultiDrizzle, so return it anyway.
#if bitvalue == None or rootname == None:
# return None
# build output name
maskname = ou... | 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. | 4.02938 | 3.95649 | 1.018423 |
# insure detnum is a string
if type(detnum) != type(''):
detnum = repr(detnum)
_funcroot = '_func_Shadow_WF'
# build template shadow mask's filename
# If an old version of the maskfile was present, remove it and rebuild it.
if fileutil.findFile(maskname):
fileutil.removeF... | def buildShadowMaskImage(dqfile,detnum,extnum,maskname,bitvalue=None,binned=1) | Builds mask image from WFPC2 shadow calibrations.
detnum - string value for 'DETECTOR' detector | 3.614674 | 3.583806 | 1.008613 |
single_coord = False
# Only use value provided in `coords` if nothing has been specified for coordfile
if coords is not None and coordfile is None:
coordfile = coords
warnings.simplefilter('always',DeprecationWarning)
warnings.warn("Please update calling code to pass in `coordfi... | def xy2rd(input,x=None,y=None,coords=None, coordfile=None,colnames=None,separator=None,
hms=True, precision=6,output=None,verbose=True) | Primary interface to perform coordinate transformations from
pixel to sky coordinates using STWCS and full distortion models
read from the input image header. | 3.270715 | 3.239259 | 1.009711 |
maskarr = None
if maskname is not None:
if isinstance(maskname, str):
# working with file on disk (default case)
if os.path.exists(maskname):
mask = fileutil.openImage(maskname, memmap=False)
maskarr = mask[0].data.astype(np.bool)
... | def mergeDQarray(maskname,dqarr) | Merge static or CR mask with mask created from DQ array on-the-fly here. | 3.413404 | 3.282161 | 1.039987 |
paramDict={"build":True,
"single":True,
"stepsize":10,
"in_units":"cps",
"wt_scl":1.,
"pixfrac":1.,
"kernel":"square",
"fillval":999.,
"maskval": None,
"rot":0.,
"scale":... | 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. | 4.800765 | 2.401552 | 1.999026 |
# 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:
maskval = np.nan
else:
maskval = float(maskval) # just to be clear and absolutely s... | def interpret_maskval(paramDict) | Apply logic for interpreting final_maskval value... | 6.984269 | 5.792294 | 1.205786 |
maskval = interpret_maskval(paramDict)
# Check for unintialized inputs
here = _outsci is None and _outwht is None and _outctx is None
if _outsci is None:
_outsci=np.empty(output_wcs.array_shape, dtype=np.float32)
if single:
_outsci.fill(0)
else:
_ou... | def run_driz_img(img,chiplist,output_wcs,outwcs,template,paramDict,single,
num_in_prod,build,_versions,_numctx,_nplanes,chipIdxCopy,
_outsci,_outwht,_outctx,_hdrlist,wcsmap) | Perform the drizzle operation on a single image.
This is separated out from :py:func:`run_driz` so as to keep together
the entirety of the code which is inside the loop over
images. See the :py:func:`run_driz` code for more documentation. | 3.365938 | 3.396059 | 0.991131 |
# Insure that the fillval parameter gets properly interpreted for use with tdriz
if util.is_blank(fillval):
fillval = 'INDEF'
else:
fillval = str(fillval)
if in_units == 'cps':
expscale = 1.0
else:
expscale = expin
# Compute what plane of the context image ... | def do_driz(insci, input_wcs, inwht,
output_wcs, outsci, outwht, outcon,
expin, in_units, wt_scl,
wcslin_pscale=1.0,uniqid=1, pixfrac=1.0, kernel='square',
fillval="INDEF", stepsize=10,wcsmap=None) | Core routine for performing 'drizzle' operation on a single input image
All input values will be Python objects such as ndarrays, instead
of filenames.
File handling (input and output) will be performed by calling routine. | 5.088443 | 5.120265 | 0.993785 |
# This function corrects bugs and provides improvements over the pyregion's
# ShapeList.write method in the following:
#
# 1. ShapeList.write crashes if regions have no comments;
# 2. ShapeList.write converts 'exclude' ("-") regions to normal regions ("+");
# 3. ShapeList.write does not sup... | def _regwrite(shapelist,outfile) | Writes the current shape list out as a region file | 3.830586 | 3.755006 | 1.020128 |
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) | Check if the region list contains shapes in image-like coordinates | 6.970549 | 5.096334 | 1.367757 |
# Parse out any extension specified in filename
_indx1 = filename.find('[')
_indx2 = filename.find(']')
if _indx1 > 0:
# check for closing square bracket:
if _indx2 < _indx1:
raise RuntimeError("Incorrect extension specification in file " \
... | def extension_from_filename(filename) | Parse out filename from any specified extensions.
Returns rootname and string version of extension name. | 4.228765 | 4.111446 | 1.028535 |
if isinstance(img, str):
img = fits.open(img, memmap=False)
img.close()
elif not isinstance(img, fits.HDUList):
raise TypeError("Argument 'img' must be either a file name (string) " \
"or a `astropy.io.fits.HDUList` object.")
if extname is None:
... | def count_extensions(img, extname='SCI') | Return the number of 'extname' extensions. 'img' can be either a file
name, an HDU List object (from fits), or None (to get the number of all
HDU headers. | 2.622525 | 2.619855 | 1.001019 |
if isinstance(img, str):
img = fits.open(img, memmap=False)
img.close()
elif not isinstance(img, fits.HDUList):
raise TypeError("Argument 'img' must be either a file name (string) " \
"or a fits.HDUList object.")
# when extver is None - return the range... | def get_extver_list(img, extname='SCI') | Return a list of all extension versions of 'extname' extensions.
'img' can be either a file name or a HDU List object (from fits). | 2.952188 | 2.889096 | 1.021838 |
default_extn = 1 if isinstance(extname, str) else 0
if isinstance(extvers, list):
extv = [default_extn if ext is None else ext for ext in extvers]
else:
extv = [default_extn if extvers is None else extvers]
extv_in_fits = get_extver_list(img, extname)
return set(extv).issubse... | def _check_FITS_extvers(img, extname, extvers) | Returns True if all (except None) extension versions specified by the
argument 'extvers' and that are of the type specified by the argument
'extname' are present in the 'img' FITS file. Returns False if some of the
extension versions for a given EXTNAME cannot be found in the FITS image. | 3.339234 | 3.292598 | 1.014164 |
category_generator_mapping = {'single exposure product': single_exposure_product_filename_generator,
'filter product': filter_product_filename_generator,
'total detection product': total_detection_product_filename_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 generated.
Parameters
----------
product_catego... | 4.404574 | 4.142764 | 1.063197 |
proposal_id = obs_info[0]
visit_id = obs_info[1]
instrument = obs_info[2]
detector = obs_info[3]
filter = obs_info[4]
ipppssoot = obs_info[5]
product_filename_dict = {}
product_filename_dict["image"] = "hst_{}_{}_{}_{}_{}_{}_{}.fits".format(proposal_id,visit_id,instrument,detector,... | 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, and ipppssoot
nn : string
the single-exposure image number (... | 2.505399 | 1.83565 | 1.364856 |
proposal_id = obs_info[0]
visit_id = obs_info[1]
instrument = obs_info[2]
detector = obs_info[3]
filter = obs_info[4]
product_filename_dict = {}
product_filename_dict["image"] = "hst_{}_{}_{}_{}_{}.fits".format(proposal_id,visit_id,instrument,detector,filter)
product_filename_dict[... | 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 : string
the single-exposure image number (NOTE: only used in
... | 2.525966 | 1.927433 | 1.310534 |
proposal_id = obs_info[0]
visit_id = obs_info[1]
instrument = obs_info[2]
detector = obs_info[3]
product_filename_dict = {}
product_filename_dict["image"] = "hst_{}_{}_{}_{}.fits".format(proposal_id, visit_id, instrument, detector)
product_filename_dict["source catalog"] = product_file... | 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
nn : string
the single-exposure image number (NOTE: only used in
... | 2.862987 | 2.137231 | 1.339578 |
group_num = obs_info[0]
instrument = obs_info[1]
detector = obs_info[2]
filter = obs_info[3]
product_filename_dict = {}
product_filename_dict["image"] = "hst_mos_{}_{}_{}_{}.fits".format(group_num,instrument,detector,filter)
product_filename_dict["source catalog"] = product_filename_di... | 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
nn : string
the single-exposure image number (NOTE: only used in
... | 2.84828 | 2.302074 | 1.237267 |
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) | Compute default reference WCS from list of Catalog objects. | 4.471758 | 4.514741 | 0.990479 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.