Source
#vis='/lustre/naasc/sciops/comm/rindebet/pipeline/root/2013.1.01194.S_2016_05_23T02_55_30.859/SOUS_uid___A001_X11f_X4a/GOUS_uid___A001_X11f_X4b/MOUS_uid___A001_X11f_X4c/working/uid___A002_X960614_X1379.ms',
##########################################################################
# test_plotbandpass.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.
#
# [https://open-jira.nrao.edu/browse/CAS-9912]
#
#
##########################################################################
import sys
import os
import unittest
import shutil
import numpy as np
from filecmp import dircmp
import struct
CASA6 = False
try:
import casatools
from casatasks import plotbandpass
CASA6 = True
except ImportError:
from __main__ import *
from tasks import *
from taskinit import *
def pngWidthHeight(filename):
"""
Reads the width and height of a png image (in pixels).
-Todd Hunter
"""
if (os.path.exists(filename) == False):
print("Cannot find file = ", filename)
return Exception("{} not Found".format(filename)), False
f = open(filename, 'rb')
data = f.read()
f.close()
if CASA6:
if (data[12:16].decode("utf-8") == 'IHDR'):
w, h = struct.unpack('>LL', data[16:24])
width = int(w)
height = int(h)
else:
if (data[:8] == '\211PNG\r\n\032\n'and (data[12:16] == 'IHDR')):
w, h = struct.unpack('>LL', data[16:24])
width = int(w)
height = int(h)
#else: