Source
+ " from the axes list and just copying the input spectral information to the output image",
from __future__ import absolute_import
import os
import sys
import shutil
# get is_CASA6 and is_python3
from casatasks.private.casa_transition import *
if is_CASA6:
from casatools import image, coordsys, quanta
from casatasks import casalog
from .ialib import write_image_history
else:
from taskinit import *
from ialib import write_image_history
image = iatool
coordsys = cstool
quanta = qatool
def imregrid(
imagename, template, output, asvelocity, axes, shape,
interpolation, decimate, replicate, overwrite
):
_myia = None
outia = None
csys = None
try:
casalog.origin('imregrid')
if hasattr(template, 'lower') and not template.lower() == "get":
# First check to see if the output file exists. If it
# does then we abort. CASA doesn't allow files to be
# over-written, just a policy.
if len(output) < 1:
output = imagename + '.regridded'
casalog.post("output was not specified - defaulting to\n\t"
+ output, 'INFO')
_myia = image()
_myia.dohistory(False)
# Figure out what the user wants.
if not isinstance(template, dict):
if template.lower() == 'get':
_myia.open(imagename)
csys = _myia.coordsys()
shape = _myia.shape()
_myia.done()
return {'csys': csys.torecord(), 'shap': shape}
elif template.upper() in (
'J2000', 'B1950', 'B1950_VLA', 'GALACTIC',
'HADEC', 'AZEL', 'AZELSW', 'AZELNE', 'ECLIPTIC',
'MECLIPTIC', 'TECLIPTIC', 'SUPERGAL'
):
outia = _imregrid_to_new_ref_frame(
_myia, imagename, template, output, axes,
shape, overwrite, interpolation, decimate
)
try:
param_names = imregrid.__code__.co_varnames[:imregrid.__code__.co_argcount]
if is_python3:
vars = locals( )
param_vals = [vars[p] for p in param_names]
else:
param_vals = [eval(p) for p in param_names]
write_image_history(