Commit 278e6746 authored by Jorrit Schaap's avatar Jorrit Schaap
parents 45677961 3d65c382
......@@ -1648,6 +1648,7 @@ LCS/Messaging/test/tLofarMessages.cc -text
LCS/Messaging/test/tLofarMessages.log_prop -text
LCS/Messaging/test/tLofarMessages.sh -text
LCS/Messaging/test/tMessaging.cc -text
LCS/Messaging/test/tMessaging.sh -text
LCS/Messaging/test/tTimeOut.cc -text
LCS/PyCommon/CMakeLists.txt -text
LCS/PyCommon/__init__.py -text
......@@ -4313,10 +4314,10 @@ SAS/DataManagement/Cleanup/CleanupService/__init__.py -text
SAS/DataManagement/Cleanup/CleanupService/cleanupservice -text
SAS/DataManagement/Cleanup/CleanupService/cleanupservice.ini -text
SAS/DataManagement/Cleanup/CleanupService/service.py -text
SAS/DataManagement/Cleanup/test/CMakeLists.txt -text
SAS/DataManagement/Cleanup/test/test_cleanup_service_and_rpc.py -text
SAS/DataManagement/Cleanup/test/test_cleanup_service_and_rpc.run -text
SAS/DataManagement/Cleanup/test/test_cleanup_service_and_rpc.sh -text
SAS/DataManagement/Cleanup/CleanupService/test/CMakeLists.txt -text
SAS/DataManagement/Cleanup/CleanupService/test/test_cleanup_service_and_rpc.py -text
SAS/DataManagement/Cleanup/CleanupService/test/test_cleanup_service_and_rpc.run -text
SAS/DataManagement/Cleanup/CleanupService/test/test_cleanup_service_and_rpc.sh -text
SAS/DataManagement/DataManagementCommon/CMakeLists.txt -text
SAS/DataManagement/DataManagementCommon/__init__.py -text
SAS/DataManagement/DataManagementCommon/config.py -text
......@@ -4611,13 +4612,16 @@ SAS/OTDB_Services/doc/package.dox -text
SAS/OTDB_Services/otdbrpc.py -text
SAS/OTDB_Services/setCorrelatorHeadNode -text
SAS/OTDB_Services/test/CMakeLists.txt -text
SAS/OTDB_Services/test/t_TreeService.in.unittest_db.dump.gz -text svneol=unset#application/x-gzip
SAS/OTDB_Services/test/t_TreeService.py -text
SAS/OTDB_Services/test/t_TreeService.run -text svneol=unset#application/x-shellscript
SAS/OTDB_Services/test/t_TreeService.sh -text svneol=unset#application/x-shellscript
SAS/OTDB_Services/test/t_TreeStatusEvents.in.unittest_db.dump.gz -text
SAS/OTDB_Services/test/t_TreeStatusEvents.py -text
SAS/OTDB_Services/test/t_TreeStatusEvents.run -text svneol=unset#application/x-shellscript
SAS/OTDB_Services/test/t_TreeStatusEvents.sh -text svneol=unset#application/x-shellscript
SAS/OTDB_Services/test/unittest_db.dump.gz -text svneol=unset#application/x-gzip
SAS/OTDB_Services/treeService -text
SAS/OTDB_Services/treeStatusEvents -text
SAS/QPIDInfrastructure/CMakeLists.txt -text
SAS/QPIDInfrastructure/README -text
SAS/QPIDInfrastructure/bin/CMakeLists.txt -text
......
......@@ -30,7 +30,7 @@ class SolverPlot:
def save_plot(self):
file_choices = "PNG (*.png)|*.png"
path = unicode(QFileDialog.getSaveFileName(self,
path = str(QFileDialog.getSaveFileName(self,
'Save file', '',
file_choices))
if path:
......
......@@ -20,6 +20,6 @@
#
# $Id: __init__.py 12729 2009-03-02 13:39:59Z diepen $
from solfetch import fetch
from solplot import normalize, plot, unwrap, unwrap_windowed
from solflag import flag
from .solfetch import fetch
from .solplot import normalize, plot, unwrap, unwrap_windowed
from .solflag import flag
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Script that creates (if not already present) MODEL_DATA and CORRECTED_DATA
# columns in a MS
......@@ -20,7 +20,7 @@ import pyrap.tables as pt
# This script does not do any command argument parsing with getopt
# Simply: 1st argument (sys.arg[1]) is the MS to add the columns to
if sys.argc != 2:
print "usage: ", sys.argv[0], "<MSfile>"
print("usage: ", sys.argv[0], "<MSfile>")
sys.exit(0)
else:
filename = sys.argv[1]
......@@ -55,7 +55,7 @@ def addClearcalColumns(filename):
# Check if MODEL_DATA column is already present
if hasColumn(table, "MODEL_DATA") == False:
print "addClearcalColumns() adding MODEL_DATA" # DEBUG
print("addClearcalColumns() adding MODEL_DATA") # DEBUG
table.addcolumn("MODEL_DATA")
nFreq=getNFreqs(table)
......@@ -67,7 +67,7 @@ def addClearcalColumns(filename):
# Check if CORRECTED_DATA column is already present
if hasColumn(table, "CORRECTED_DATA") == False:
print "addClearcalColumns() adding CORRECTED_DATA" # DEBUG
print("addClearcalColumns() adding CORRECTED_DATA") # DEBUG
table.addcolumn("CORRECTED_DATA")
......@@ -75,7 +75,7 @@ def addClearcalColumns(filename):
# specified in the gds
#
def executeGDS(filename):
print "executeGDS()" # DEBUG
print("executeGDS()") # DEBUG
MSfilenames=parseGD(filename)
multipleFiles(MSfilenames)
......@@ -93,7 +93,7 @@ def getNFreqs(table):
# returns list of individual MS filenames
#
def parseGDS(gdsFilename):
print "parseGDS()" # DEBUG
print("parseGDS()") # DEBUG
MSfilenames=[]
......@@ -114,7 +114,7 @@ def parseGDS(gdsFilename):
pos=line.find("=")+2 # because it is " = " with space
MSfilename.append(line[pos:])
print "parseGDS() MSfilenames = ", MSfilenames # DEBUG
print("parseGDS() MSfilenames = ", MSfilenames) # DEBUG
return MSfilenames # return list of filenames
......@@ -123,7 +123,7 @@ def parseGDS(gdsFilename):
#
def multipleFiles(MSfilenames):
if not isinstance(MSfilename, list):
print "multipleFiles() MSfilenames is not a list"
print("multipleFiles() MSfilenames is not a list")
else:
for filename in MSfilenames:
addClearcalColumns(filename)
#!/usr/bin/env python
#!/usr/bin/env python3
# Script that adds imaging columns to a MS
#
......@@ -11,15 +11,15 @@ import sys
try:
import pyrap.tables as pt
except ImportError:
print "addImagingColumns.py: could not import pyrap.tables"
print "WARN: No imaging columns added"
print("addImagingColumns.py: could not import pyrap.tables")
print("WARN: No imaging columns added")
sys.exit(1)
if len(sys.argv)> 2:
print "addImagingColumns.py: Too many arguments"
print("addImagingColumns.py: Too many arguments")
sys.exit(1)
elif len(sys.argv)==1:
print "addImagingColumns.py: No MS given"
print("addImagingColumns.py: No MS given")
sys.exit(1)
else:
filename=sys.argv[1] # MS filename is by default first sys.argv
......
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
import numpy
......@@ -85,8 +85,8 @@ def build_index(available, requested, mandatory=True):
# For example: [4,2,9,11] => [1,0,2,3]
#
def renumber(sequence):
index = sorted(range(len(sequence)), key=lambda x: sequence[x])
return sorted(range(len(index)), key=lambda x: index[x])
index = sorted(list(range(len(sequence))), key=lambda x: sequence[x])
return sorted(list(range(len(index))), key=lambda x: index[x])
# Load pixel data from the input CASA image and create a slice that contains
# only the requested axes in order. Zero is used as the coordinate for each
......@@ -124,7 +124,7 @@ def main(options, args):
# Make sure Stokes I is available.
if stokes_index[0] is None:
print "error: incompatible CLEAN component image format: Stokes I unavailable."
print("error: incompatible CLEAN component image format: Stokes I unavailable.")
sys.exit(1)
# Find locations of all CLEAN components (pixels with non-zero flux).
......@@ -133,13 +133,13 @@ def main(options, args):
# Compute statistics.
total_component_count = len(components[0])
print "info: total number of CLEAN components: %d" % total_component_count
print("info: total number of CLEAN components: %d" % total_component_count)
if total_component_count == 0:
print "error: no CLEAN components found in CASA image:", args[0]
print("error: no CLEAN components found in CASA image:", args[0])
sys.exit(1)
total_component_flux = numpy.sum(component_flux[components])
print "info: total flux in CLEAN components: %.2f Jy" % total_component_flux
print("info: total flux in CLEAN components: %.2f Jy" % total_component_flux)
have_mask = not options.mask is None
if have_mask:
......@@ -149,13 +149,13 @@ def main(options, args):
# Sanity check mask image dimensions.
if mask.shape != component_flux.shape:
print "error: CASA mask image should have the same dimensions as the CLEAN component image."
print("error: CASA mask image should have the same dimensions as the CLEAN component image.")
sys.exit(1)
# Find islands in the mask image.
(island_label, island_count) = scipy.ndimage.measurements.label(mask)
if island_count == 0:
print "error: no islands found in CASA mask image:", options.mask
print("error: no islands found in CASA mask image:", options.mask)
sys.exit(1)
# Assign CLEAN components to the corresponding (co-located) islands and
......@@ -185,15 +185,15 @@ def main(options, args):
total_flux += flux
# Prune islands that do not contain any CLEAN components.
islands = filter(lambda x: len(x[1]) > 0, islands)
islands = [x for x in islands if len(x[1]) > 0]
# Print total number of non-empty island.
print "info: total number of non-empty islands: %d" % len(islands)
print "info: total flux in non-empty islands: %.2f Jy" % total_flux
print("info: total number of non-empty islands: %d" % len(islands))
print("info: total flux in non-empty islands: %.2f Jy" % total_flux)
# Determine clip level.
clip_flux = options.clip_level / 100.0 * total_flux
print "info: clipping at: %.2f Jy" % clip_flux
print("info: clipping at: %.2f Jy" % clip_flux)
# Sort islands by absolute flux (descending).
islands = sorted(islands, key = lambda x: abs(x[0]), reverse = True)
......@@ -211,16 +211,16 @@ def main(options, args):
component_count += len(island[1])
patches.append(island[1])
print "info: number of non-empty islands selected: %d" % len(patches),
print("info: number of non-empty islands selected: %d" % len(patches), end=' ')
if len(islands) > 0:
print "(%.2f%%)" % ((100.0 * len(patches)) / len(islands))
print("(%.2f%%)" % ((100.0 * len(patches)) / len(islands)))
else:
print "(100.00%)"
print("(100.00%)")
if len(patches) == 0:
print "warning: no non-empty islands selected; you may need to raise the clip level (option -c)."
print("warning: no non-empty islands selected; you may need to raise the clip level (option -c).")
print "info: number of CLEAN components in selected non-empty islands: %d (%.2f%%)" % (component_count, (100.0 * component_count) / total_component_count)
print "info: flux in selected non-empty islands: %.2f Jy (%.2f%%)" % (sum_flux, (100.0 * sum_flux) / total_flux)
print("info: number of CLEAN components in selected non-empty islands: %d (%.2f%%)" % (component_count, (100.0 * component_count) / total_component_count))
print("info: flux in selected non-empty islands: %.2f Jy (%.2f%%)" % (sum_flux, (100.0 * sum_flux) / total_flux))
else:
# Without a mask we are selecting CLEAN components, so the total
# absolute flux is equal to the sum of the absolute flux of all CLEAN
......@@ -229,7 +229,7 @@ def main(options, args):
# Determine clip level.
clip_flux = options.clip_level / 100.0 * total_flux
print "info: clipping at: %.2f Jy" % clip_flux
print("info: clipping at: %.2f Jy" % clip_flux)
# Sort CLEAN components on absolute flux (descending).
components = sorted(zip(*components),
......@@ -251,10 +251,10 @@ def main(options, args):
if len(patch) > 0:
patches.append(patch)
print "info: number of CLEAN components selected: %d (%.2f%%)" % (len(patch), (100.0 * len(patch)) / total_component_count)
print("info: number of CLEAN components selected: %d (%.2f%%)" % (len(patch), (100.0 * len(patch)) / total_component_count))
if len(patch) == 0:
print "warning: no CLEAN components selected; you may need to raise the clip level (option -c)."
print "info: flux in selected CLEAN components: %.2f Jy (%.2f%%)" % (sum_flux, (100.0 * sum_flux) / total_flux)
print("warning: no CLEAN components selected; you may need to raise the clip level (option -c).")
<