Skip to content
GitLab
Explore
Sign in
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
27d58065
Commit
27d58065
authored
10 years ago
by
Wouter Klijn
Browse files
Options
Downloads
Patches
Plain Diff
Task #7058: COmmit the changes in imager_prepare
parent
4cc003c6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
+21
-10
21 additions, 10 deletions
CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py
+12
-1
12 additions, 1 deletion
CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py
with
33 additions
and
11 deletions
CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
+
21
−
10
View file @
27d58065
...
...
@@ -227,6 +227,22 @@ class imager_prepare(LOFARnodeTCP):
catch_segfaults
(
cmd
,
working_dir
,
environment
,
logger
,
cleanup
=
None
,
usageStats
=
self
.
resourceMonitor
)
def
_get_nchan_from_ms
(
self
,
file
):
"""
Wrapper for pt call to retrieve the number of channels in a ms
Uses Pyrap functionality throws
'
random
'
exceptions.
"""
# open the datasetassume same nchan for all sb
table
=
pt
.
table
(
file
)
#
# get the data column, get description, get the
# shape, first index returns the number of channels
nchan
=
str
(
pt
.
tablecolumn
(
table
,
'
DATA
'
).
getdesc
()[
"
shape
"
][
0
])
return
nchan
def
_run_dppp
(
self
,
working_dir
,
time_slice_dir_path
,
slices_per_image
,
processed_ms_map
,
subbands_per_image
,
collected_ms_dir_name
,
parset
,
ndppp
):
...
...
@@ -251,6 +267,7 @@ class imager_prepare(LOFARnodeTCP):
# filling with zeros
ndppp_input_ms
=
[]
nchan_known
=
False
for
item
in
processed_ms_map
[
start_slice_range
:
end_slice_range
]:
if
item
.
skip
:
ndppp_input_ms
.
append
(
"
SKIPPEDSUBBAND
"
)
...
...
@@ -258,16 +275,10 @@ class imager_prepare(LOFARnodeTCP):
# From the first non skipped filed get the nchan
if
not
nchan_known
:
try
:
# Automatically average the number of channels in
# the output to 1
# open the datasetassume same nchan for all sb
table
=
pt
.
table
(
item
.
file
)
#
# get the data column, get description, get the
# shape, first index returns the number of channels
nchan_input
=
str
(
pt
.
tablecolumn
(
table
,
'
DATA
'
).
getdesc
()[
"
shape
"
][
0
])
# We want toAutomatically average the number
# of channels in the output to 1, get the current
# nr of channels
nchan_input
=
self
.
_get_nchan_from_ms
(
item
.
file
)
nchan_known
=
True
# corrupt input measurement set
...
...
This diff is collapsed.
Click to expand it.
CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py
+
12
−
1
View file @
27d58065
...
...
@@ -12,6 +12,7 @@ from lofarpipe.support.utilities import create_directory
from
lofarpipe.recipes.nodes.imager_prepare
import
imager_prepare
\
as
imager_prepare_node
from
logger
import
logger
from
lofarpipe.support.data_map
import
DataMap
class
ImagerPrepareTestWrapper
(
imager_prepare_node
):
"""
...
...
@@ -29,6 +30,9 @@ class ImagerPrepareTestWrapper(imager_prepare_node):
def
_dppp_call
(
self
,
working_dir
,
ndppp
,
cmd
,
environment
):
self
.
dppp_call_vars
=
(
working_dir
,
ndppp
,
cmd
,
environment
)
def
_get_nchan_from_ms
(
self
,
file
):
return
4
class
ImagerPrepareTest
(
unittest
.
TestCase
):
"""
...
...
@@ -104,6 +108,11 @@ class ImagerPrepareTest(unittest.TestCase):
(
"
lce072
"
,
"
test_file_path2
"
),
(
"
lce072
"
,
"
test_file_path3
"
),
(
"
lce072
"
,
"
test_file_path4
"
)]
input_datamap
=
DataMap
()
for
entry
in
input_map
:
input_datamap
.
append
(
entry
)
subbands_per_image
=
2
collected_ms_dir_name
=
""
fp
=
open
(
os
.
path
.
join
(
self
.
test_path
,
"
parset
"
),
'
w
'
)
...
...
@@ -115,7 +124,7 @@ class ImagerPrepareTest(unittest.TestCase):
sut
=
ImagerPrepareTestWrapper
()
output
=
sut
.
_run_dppp
(
working_dir
,
time_slice_dir_path
,
slices_per_image
,
input_map
,
subbands_per_image
,
collected_ms_dir_name
,
parset
,
input_
data
map
,
subbands_per_image
,
collected_ms_dir_name
,
parset
,
ndppp
)
# The output should contain two timeslices ms prepended with the time_slice_dir_path
...
...
@@ -127,6 +136,7 @@ class ImagerPrepareTest(unittest.TestCase):
# Two parset should be written in the time_slice_dir_path
parset_1_content_expected
=
[(
'
replace
'
,
'
uselogger
'
,
'
True
'
),
(
'
replace
'
,
'
avg1.freqstep
'
,
'
4
'
),
(
'
replace
'
,
'
msin
'
,
"
[
'
test_file_path1
'
,
'
test_file_path2
'
]
"
),
(
'
replace
'
,
'
msout
'
,
'
{0}
'
.
format
(
os
.
path
.
join
(
time_slice_dir_path
,
"
time_slice_0.dppp.ms
"
)))]
...
...
@@ -138,6 +148,7 @@ class ImagerPrepareTest(unittest.TestCase):
# Two parset should be written in the time_slice_dir_path
parset_2_content_expected
=
[(
'
replace
'
,
'
uselogger
'
,
'
True
'
),
(
'
replace
'
,
'
avg1.freqstep
'
,
'
4
'
),
(
'
replace
'
,
'
msin
'
,
"
[
'
test_file_path3
'
,
'
test_file_path4
'
]
"
),
(
'
replace
'
,
'
msout
'
,
'
{0}
'
.
format
(
os
.
path
.
join
(
time_slice_dir_path
,
"
time_slice_1.dppp.ms
"
)))]
...
...
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