Source
Check that if the number of elements in the factors array is fewer than the number of axes then the remaining axes are not rebinned
##########################################################################
# test_task_imrebin.py
#
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA.
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
# [Add the link to the JIRA ticket here once it exists]
#
# Based on the requirements listed in plone found here:
# # https://casadocs.readthedocs.io/en/stable/api/tt/casatasks.analysis.imrebin.html
#
#
##########################################################################
import sys
import os
import unittest
import shutil
import numpy as np
import casatools
from casatasks import imrebin, casalog
_tb = casatools.table()
### DATA ###
datapath = casatools.ctsys.resolve('unittest/imrebin/orion_tfeather.im/')
stokespath = casatools.ctsys.resolve('unittest/imrebin/image_input_processor.im/')
tb = casatools.table()
ia = casatools.image()
def makeImage():
imagename = "gen.im"
ia.fromshape(imagename, [10, 10, 10])
bb = ia.getchunk()
for i in range(10):
bb[i,5,:] = i
bb[i,0:5,:] = i+1
bb[i,6:10,:] = i+2
ia.putchunk(bb)
ia.done()
return imagename
def makeDegImage():
imagename = "gendeg.im"
ia.fromshape(imagename, [10, 10, 1, 1])
bb = ia.getchunk()
for i in range(10):
bb[i,5,:] = i
bb[i,0:5,:] = i+1
bb[i,6:10,:] = i+2
ia.putchunk(bb)
ia.done()
def makeFloatImage():
imagename = "genfloat.im"
ia.fromshape(imagename, [10, 10, 10])
bb = ia.getchunk()
for i in range(10):
bb[i,5,:] = i+.3
bb[i,0:5,:] = i+1.3
bb[i,6:10,:] = i+2.3
ia.putchunk(bb)
ia.done()
return imagename
def makeCompImage():
imagename = "gencomp.im"
putArr = np.array([[complex(j,2) for i in range(10)] for j in range(10)])
ia.fromarray(outfile=imagename, pixels=putArr)
ia.done()
return imagename