Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Reinecke
ducc
Commits
4d2da493
Commit
4d2da493
authored
Sep 13, 2020
by
Martin Reinecke
Browse files
tweak MS reader
parent
7313728c
Pipeline
#82359
passed with stages
in 12 minutes and 49 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
python/demos/wgridder_bench.py
View file @
4d2da493
...
@@ -98,26 +98,29 @@ def read_ms_i(name):
...
@@ -98,26 +98,29 @@ def read_ms_i(name):
while
start
<
nrow
:
while
start
<
nrow
:
stop
=
min
(
nrow
,
start
+
step
)
stop
=
min
(
nrow
,
start
+
step
)
realstop
=
realstart
+
np
.
sum
(
active_rows
[
start
:
stop
])
realstop
=
realstart
+
np
.
sum
(
active_rows
[
start
:
stop
])
if
realstop
==
realstart
:
if
realstop
>
realstart
:
start
=
stop
allrows
=
stop
-
start
==
realstop
-
realstart
realstart
=
realstop
tvis
=
t
.
getcol
(
"DATA"
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
continue
tvis
=
np
.
sum
(
tvis
,
axis
=-
1
)
tvis
=
t
.
getcol
(
"DATA"
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
if
not
allrows
:
tvis
=
np
.
sum
(
tvis
,
axis
=-
1
)
tvis
=
tvis
[
active_rows
[
start
:
stop
]]
tvis
=
tvis
[
active_rows
[
start
:
stop
]][:,
active_channels
]
tvis
=
tvis
[:,
active_channels
]
tflags
=
t
.
getcol
(
'FLAG'
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
tflags
=
t
.
getcol
(
'FLAG'
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
tflags
=
np
.
any
(
tflags
.
astype
(
np
.
bool
),
axis
=-
1
)
tflags
=
np
.
any
(
tflags
.
astype
(
np
.
bool
),
axis
=-
1
)
tflags
=
tflags
[
active_rows
[
start
:
stop
]][:,
active_channels
]
if
not
allrows
:
twgt
=
t
.
getcol
(
weightcol
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
tflags
=
tflags
[
active_rows
[
start
:
stop
]]
twgt
=
1
/
np
.
sum
(
1
/
twgt
,
axis
=-
1
)
tflags
=
tflags
[:,
active_channels
]
twgt
=
twgt
[
active_rows
[
start
:
stop
]]
twgt
=
t
.
getcol
(
weightcol
,
startrow
=
start
,
nrow
=
stop
-
start
)[...,
ind
]
if
fullwgt
:
twgt
=
1
/
np
.
sum
(
1
/
twgt
,
axis
=-
1
)
twgt
=
twgt
[:,
active_channels
]
if
not
allrows
:
tflags
[
twgt
==
0
]
=
True
twgt
=
twgt
[
active_rows
[
start
:
stop
]]
if
fullwgt
:
vis
[
realstart
:
realstop
]
=
tvis
twgt
=
twgt
[:,
active_channels
]
wgt
[
realstart
:
realstop
]
=
twgt
tflags
[
twgt
==
0
]
=
True
flags
[
realstart
:
realstop
]
=
tflags
vis
[
realstart
:
realstop
]
=
tvis
wgt
[
realstart
:
realstop
]
=
twgt
flags
[
realstart
:
realstop
]
=
tflags
start
,
realstart
=
stop
,
realstop
start
,
realstart
=
stop
,
realstop
uvw
=
t
.
getcol
(
"UVW"
)[
active_rows
]
uvw
=
t
.
getcol
(
"UVW"
)[
active_rows
]
...
@@ -126,7 +129,7 @@ def read_ms_i(name):
...
@@ -126,7 +129,7 @@ def read_ms_i(name):
print
(
'# Channels: {} ({} fully flagged)'
.
format
(
nchan
,
nchan
-
vis
.
shape
[
1
]))
print
(
'# Channels: {} ({} fully flagged)'
.
format
(
nchan
,
nchan
-
vis
.
shape
[
1
]))
print
(
'# Correlations: {}'
.
format
(
ncorr
))
print
(
'# Correlations: {}'
.
format
(
ncorr
))
print
(
'Full weights'
if
fullwgt
else
'Row-only weights'
)
print
(
'Full weights'
if
fullwgt
else
'Row-only weights'
)
nflagged
=
np
.
sum
(
flags
)
+
(
nrow
-
vis
.
shape
[
0
]
)
*
nchan
+
(
nchan
-
vis
.
shape
[
1
]
)
*
nrow
nflagged
=
np
.
sum
(
flags
)
+
(
nrow
-
nrealrows
)
*
nchan
+
(
nchan
-
nrealchan
)
*
nrow
print
(
"{} % flagged"
.
format
(
nflagged
/
(
nrow
*
nchan
)
*
100
))
print
(
"{} % flagged"
.
format
(
nflagged
/
(
nrow
*
nchan
)
*
100
))
freq
=
freq
[
active_channels
]
freq
=
freq
[
active_channels
]
...
@@ -144,7 +147,8 @@ def read_ms_i(name):
...
@@ -144,7 +147,8 @@ def read_ms_i(name):
def
main
():
def
main
():
# ms, fov_deg = '/home/martin/ms/supernovashell.55.7+3.4.spw0.ms', 2.
# ms, fov_deg = '/home/martin/ms/supernovashell.55.7+3.4.spw0.ms', 2.
# ms, fov_deg = '/home/martin/ms/1052736496-averaged.ms', 45.
# ms, fov_deg = '/home/martin/ms/1052736496-averaged.ms', 45.
ms
,
fov_deg
=
'/home/martin/ms/1052735056_cleaned.ms'
,
45.
ms
,
fov_deg
=
'/home/martin/ms/1052735056.ms'
,
45.
# ms, fov_deg = '/home/martin/ms/cleaned_G330.89-0.36.ms', 2.
uvw
,
freq
,
vis
,
wgt
,
flags
=
read_ms_i
(
ms
)
uvw
,
freq
,
vis
,
wgt
,
flags
=
read_ms_i
(
ms
)
npixdirty
=
1200
npixdirty
=
1200
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment