Skip to content
Snippets Groups Projects
Commit b69e4a0e authored by Ger van Diepen's avatar Ger van Diepen
Browse files

Task #3054 Made it work on CEP2

parent a63e1f30
No related branches found
No related tags found
No related merge requests found
...@@ -33,8 +33,6 @@ if __name__ == "__main__": ...@@ -33,8 +33,6 @@ if __name__ == "__main__":
if len(sys.argv) > 4 and len(sys.argv[4]) > 0: if len(sys.argv) > 4 and len(sys.argv[4]) > 0:
outname = [sys.argv[4]] outname = [sys.argv[4]]
# Expand the parset. # Expand the parset.
print inname, outname
exit
lmt.expandps (sys.argv[1], sys.argv[2], lmt.expandps (sys.argv[1], sys.argv[2],
{'in': [(inname, 'Input_Correlated')], {'in': [(inname, 'Input_Correlated')],
'out': [(outname, 'Output_InstrumentModel')]}) 'out': [(outname, 'Output_InstrumentModel')]})
...@@ -267,9 +267,9 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0): ...@@ -267,9 +267,9 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0):
ps = lofar.parameterset.parameterset (parsetin) ps = lofar.parameterset.parameterset (parsetin)
pskeys = ps.keys() pskeys = ps.keys()
# See if nsubbands parameter is given; otherwise set to 1. # See if nsubbands parameter is given; otherwise set to 1.
havesubbands = true havesubbands = True
if nsubbands <= 0: if nsubbands <= 0:
havesubbands = false havesubbands = False
nsubbands = 1 nsubbands = 1
# Check and initialize. # Check and initialize.
if nodeindex < 0 or nodeindex >= nsubbands: if nodeindex < 0 or nodeindex >= nsubbands:
...@@ -290,13 +290,14 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0): ...@@ -290,13 +290,14 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0):
raise KeyError, "keyword " + keyin + " not found in parset " + parsetin raise KeyError, "keyword " + keyin + " not found in parset " + parsetin
# Get the file name pattern # Get the file name pattern
patterns = ps.getStringVector(keyin) patterns = ps.getStringVector(keyin)
ps.remove (keyin)
else: else:
patterns = keyin patterns = keyin
locs = [] locs = []
names = [] names = []
for patt in patterns: for patt in patterns:
# Get all nodes and file names # Get all nodes and file names
(nodes,files) = findDirs(ps.getString(keyin)) (nodes,files) = findDirs(patt)
##(nodes,files) = (['locus1','locus2'], ['/data/L1/L1a.MS','/data/L1/L1b.MS']) ##(nodes,files) = (['locus1','locus2'], ['/data/L1/L1a.MS','/data/L1/L1b.MS'])
# Split into location (node:dir/) and basename. # Split into location (node:dir/) and basename.
for i in range(len(files)): for i in range(len(files)):
...@@ -315,7 +316,6 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0): ...@@ -315,7 +316,6 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0):
newkey = 'ObsSW.Observation.DataProducts.' + keyout newkey = 'ObsSW.Observation.DataProducts.' + keyout
ps.add (newkey + '.locations', str(locs)); ps.add (newkey + '.locations', str(locs));
ps.add (newkey + '.filenames', str(names)); ps.add (newkey + '.filenames', str(names));
ps.remove (keyin)
# Write nsubbands if needed. # Write nsubbands if needed.
if havesubbands: if havesubbands:
...@@ -333,6 +333,7 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0): ...@@ -333,6 +333,7 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0):
if keyin not in pskeys: if keyin not in pskeys:
raise KeyError, "keyword " + keyin + " not found in parset " + parsetin raise KeyError, "keyword " + keyin + " not found in parset " + parsetin
name = ps.getString(keyin) name = ps.getString(keyin)
ps.remove (keyin)
else: else:
if len(keyin) != 1: if len(keyin) != 1:
raise KeyError, "Output key " + keyin + " is not a string, thus should be a sequence of length 1" raise KeyError, "Output key " + keyin + " is not a string, thus should be a sequence of length 1"
...@@ -361,7 +362,6 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0): ...@@ -361,7 +362,6 @@ def expandps (parsetin, parsetout, keymap, nsubbands=0, nodeindex=0):
newkey = 'ObsSW.Observation.DataProducts.' + keyout newkey = 'ObsSW.Observation.DataProducts.' + keyout
ps.add (newkey + '.locations', str(locs)); ps.add (newkey + '.locations', str(locs));
ps.add (newkey + '.filenames', str(names)); ps.add (newkey + '.filenames', str(names));
ps.remove (keyin)
# Check if all keymap keywords have been processed. # Check if all keymap keywords have been processed.
if nrproc != len(keymap): if nrproc != len(keymap):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment