Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
f1fd78b3
Commit
f1fd78b3
authored
13 years ago
by
Ger van Diepen
Browse files
Options
Downloads
Patches
Plain Diff
Task #2699
Flush subtable before putting it as a table keyword
parent
974f71af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CEP/Imager/ImageLofar/src/addImagingInfo
+14
-7
14 additions, 7 deletions
CEP/Imager/ImageLofar/src/addImagingInfo
with
14 additions
and
7 deletions
CEP/Imager/ImageLofar/src/addImagingInfo
+
14
−
7
View file @
f1fd78b3
...
@@ -21,7 +21,8 @@ def addSubTable (image, msName, subName, removeColumns=[]):
...
@@ -21,7 +21,8 @@ def addSubTable (image, msName, subName, removeColumns=[]):
if
len
(
subNameOut
)
<
6
or
subNameOut
[:
6
]
!=
"
LOFAR_
"
:
if
len
(
subNameOut
)
<
6
or
subNameOut
[:
6
]
!=
"
LOFAR_
"
:
subNameOut
=
"
LOFAR_
"
+
subNameOut
subNameOut
=
"
LOFAR_
"
+
subNameOut
subtab
=
sel
.
copy
(
image
.
name
()
+
"
/
"
+
subNameOut
,
deep
=
True
)
subtab
=
sel
.
copy
(
image
.
name
()
+
"
/
"
+
subNameOut
,
deep
=
True
)
image
.
putkeyword
(
subNameOut
,
subtab
)
print
subtab
.
name
()
image
.
putkeyword
(
"
ATTRGROUPS.
"
+
subNameOut
,
subtab
)
print
"
Added subtable
"
,
subNameOut
,
"
containing
"
,
subtab
.
nrows
(),
"
rows
"
print
"
Added subtable
"
,
subNameOut
,
"
containing
"
,
subtab
.
nrows
(),
"
rows
"
subtab
.
close
()
subtab
.
close
()
sel
.
close
()
sel
.
close
()
...
@@ -31,7 +32,9 @@ def addQualityTable (image):
...
@@ -31,7 +32,9 @@ def addQualityTable (image):
# Create the table using TaQL.
# Create the table using TaQL.
tab
=
pt
.
taql
(
"
create table
'"
+
image
.
name
()
+
"
/LOFAR_QUALITY
'
"
+
tab
=
pt
.
taql
(
"
create table
'"
+
image
.
name
()
+
"
/LOFAR_QUALITY
'
"
+
"
QUALITY_MEASURE string, VALUE string, FLAG_ROW bool
"
)
"
QUALITY_MEASURE string, VALUE string, FLAG_ROW bool
"
)
image
.
putkeyword
(
"
LOFAR_QUALITY
"
,
tab
)
tab
.
flush
()
print
tab
.
name
()
image
.
putkeyword
(
"
ATTRGROUPS.
"
+
"
LOFAR_QUALITY
"
,
tab
)
tab
.
close
()
tab
.
close
()
print
"
Added subtable LOFAR_QUALITY containing 0 rows
"
print
"
Added subtable LOFAR_QUALITY containing 0 rows
"
...
@@ -63,7 +66,7 @@ def addOriginTable (image, msNames):
...
@@ -63,7 +66,7 @@ def addOriginTable (image, msNames):
subtab
=
pt
.
table
(
image
.
name
()
+
"
/
"
+
"
LOFAR_ORIGIN
"
,
readonly
=
False
,
subtab
=
pt
.
table
(
image
.
name
()
+
"
/
"
+
"
LOFAR_ORIGIN
"
,
readonly
=
False
,
ack
=
False
)
ack
=
False
)
obstab
.
close
()
obstab
.
close
()
image
.
putkeyword
(
"
LOFAR_ORIGIN
"
,
subtab
)
image
.
putkeyword
(
"
ATTRGROUPS.
"
+
"
LOFAR_ORIGIN
"
,
subtab
)
# Set the correct units of columns to update.
# Set the correct units of columns to update.
subtab
.
putcolkeyword
(
"
CHANNEL_WIDTH
"
,
"
QuantumUnits
"
,
[
"
Hz
"
])
subtab
.
putcolkeyword
(
"
CHANNEL_WIDTH
"
,
"
QuantumUnits
"
,
[
"
Hz
"
])
subtab
.
putcolkeyword
(
"
EXPOSURE
"
,
"
QuantumUnits
"
,
[
"
s
"
])
subtab
.
putcolkeyword
(
"
EXPOSURE
"
,
"
QuantumUnits
"
,
[
"
s
"
])
...
@@ -76,7 +79,6 @@ def addOriginTable (image, msNames):
...
@@ -76,7 +79,6 @@ def addOriginTable (image, msNames):
# Get SUBBAND from MS name.
# Get SUBBAND from MS name.
for
i
in
range
(
len
(
msNames
)):
for
i
in
range
(
len
(
msNames
)):
t
=
pt
.
table
(
msNames
[
i
],
ack
=
False
)
t
=
pt
.
table
(
msNames
[
i
],
ack
=
False
)
print
"
opened
"
,
msNames
[
i
]
subtab
.
putcell
(
"
EXPOSURE
"
,
i
,
t
.
getcell
(
"
EXPOSURE
"
,
0
))
subtab
.
putcell
(
"
EXPOSURE
"
,
i
,
t
.
getcell
(
"
EXPOSURE
"
,
0
))
t1
=
pt
.
table
(
t
.
getkeyword
(
"
SPECTRAL_WINDOW
"
),
ack
=
False
)
t1
=
pt
.
table
(
t
.
getkeyword
(
"
SPECTRAL_WINDOW
"
),
ack
=
False
)
numchan
=
t1
.
getcell
(
"
NUM_CHAN
"
,
0
)
numchan
=
t1
.
getcell
(
"
NUM_CHAN
"
,
0
)
...
@@ -126,7 +128,8 @@ def addSourceTable (image, sourcedbName, times):
...
@@ -126,7 +128,8 @@ def addSourceTable (image, sourcedbName, times):
tab
.
putcolkeyword
(
"
SHAPE
"
,
"
QuantumUnits
"
,
[
"
rad
"
,
"
rad
"
,
"
rad
"
])
tab
.
putcolkeyword
(
"
SHAPE
"
,
"
QuantumUnits
"
,
[
"
rad
"
,
"
rad
"
,
"
rad
"
])
tab
.
putcolkeyword
(
"
TIME
"
,
"
MEASINFO
"
,
{
"
Ref
"
:
"
UTC
"
,
"
type
"
:
"
epoch
"
})
tab
.
putcolkeyword
(
"
TIME
"
,
"
MEASINFO
"
,
{
"
Ref
"
:
"
UTC
"
,
"
type
"
:
"
epoch
"
})
tab
.
putcolkeyword
(
"
DIRECTION
"
,
"
MEASINFO
"
,
{
"
Ref
"
:
"
J2000
"
,
"
type
"
:
"
direction
"
})
tab
.
putcolkeyword
(
"
DIRECTION
"
,
"
MEASINFO
"
,
{
"
Ref
"
:
"
J2000
"
,
"
type
"
:
"
direction
"
})
image
.
putkeyword
(
"
LOFAR_SOURCE
"
,
tab
)
tab
.
flush
()
image
.
putkeyword
(
"
ATTRGROUPS.
"
+
"
LOFAR_SOURCE
"
,
tab
)
# Get all parameters from the source parmdb.
# Get all parameters from the source parmdb.
midtime
=
(
times
[
0
]
+
times
[
1
])
/
2
midtime
=
(
times
[
0
]
+
times
[
1
])
/
2
inttime
=
times
[
1
]
-
times
[
0
]
inttime
=
times
[
1
]
-
times
[
0
]
...
@@ -160,7 +163,6 @@ def addSourceTable (image, sourcedbName, times):
...
@@ -160,7 +163,6 @@ def addSourceTable (image, sourcedbName, times):
tab
.
putcell
(
"
SPINX
"
,
row
,
vals
[
6
]);
tab
.
putcell
(
"
SPINX
"
,
row
,
vals
[
6
]);
tab
.
putcell
(
"
REF_FREQUENCY
"
,
row
,
vals
[
7
]);
tab
.
putcell
(
"
REF_FREQUENCY
"
,
row
,
vals
[
7
]);
tab
.
putcell
(
"
SHAPE
"
,
row
,
vals
[
8
:
11
]);
tab
.
putcell
(
"
SHAPE
"
,
row
,
vals
[
8
:
11
]);
print
name
,
vals
row
+=
1
row
+=
1
# Ready.
# Ready.
tab
.
close
()
tab
.
close
()
...
@@ -186,7 +188,7 @@ def updateObsTable (image, msName, minbl, maxbl):
...
@@ -186,7 +188,7 @@ def updateObsTable (image, msName, minbl, maxbl):
obstab
.
putcell
(
"
OBSERVATION_END
"
,
0
,
maxtime
[
0
]);
obstab
.
putcell
(
"
OBSERVATION_END
"
,
0
,
maxtime
[
0
]);
obstab
.
putcell
(
"
TIME_RANGE
"
,
0
,
(
mintime
[
0
],
maxtime
[
0
]));
obstab
.
putcell
(
"
TIME_RANGE
"
,
0
,
(
mintime
[
0
],
maxtime
[
0
]));
obstab
.
putcell
(
"
FILENAME
"
,
0
,
os
.
path
.
basename
(
image
.
name
()))
obstab
.
putcell
(
"
FILENAME
"
,
0
,
os
.
path
.
basename
(
image
.
name
()))
obstab
.
putcell
(
"
FILETYPE
"
,
0
,
"
img
"
)
obstab
.
putcell
(
"
FILETYPE
"
,
0
,
"
sky
"
)
pt
.
taql
(
"
update
'"
+
obstab
.
name
()
+
"'
set FILEDATE = mjd(date()),
"
+
pt
.
taql
(
"
update
'"
+
obstab
.
name
()
+
"'
set FILEDATE = mjd(date()),
"
+
"
RELEASE_DATE = mjd(date()+365)
"
)
"
RELEASE_DATE = mjd(date()+365)
"
)
# Determine minimum and maximum baseline length
# Determine minimum and maximum baseline length
...
@@ -217,6 +219,11 @@ def updateObsTable (image, msName, minbl, maxbl):
...
@@ -217,6 +219,11 @@ def updateObsTable (image, msName, minbl, maxbl):
"""
Add all imaging info
"""
"""
Add all imaging info
"""
def
addImagingInfo
(
imageName
,
msNames
,
sourcedbName
,
minbl
=
0.
,
maxbl
=
0.
):
def
addImagingInfo
(
imageName
,
msNames
,
sourcedbName
,
minbl
=
0.
,
maxbl
=
0.
):
image
=
pt
.
table
(
imageName
,
readonly
=
False
,
ack
=
False
)
image
=
pt
.
table
(
imageName
,
readonly
=
False
,
ack
=
False
)
# Check if ATTRGROUPS already exists.
# If not, add it as an empty dict.
if
"
ATTRGROUPS
"
in
image
.
fieldnames
():
raise
Exception
(
"
addImagingInfo already done (keyword ATTRGROUPS already exists)
"
)
image
.
putkeyword
(
"
ATTRGROUPS
"
,
{})
# Add all subtables while removing obsolete columns
# Add all subtables while removing obsolete columns
addSubTable
(
image
,
msNames
[
0
],
"
POINTING
"
)
addSubTable
(
image
,
msNames
[
0
],
"
POINTING
"
)
addSubTable
(
image
,
msNames
[
0
],
"
FIELD
"
)
addSubTable
(
image
,
msNames
[
0
],
"
FIELD
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment