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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
d55efcee
Commit
d55efcee
authored
Sep 9, 2013
by
David Rafferty
Browse files
Options
Downloads
Patches
Plain Diff
Task #3403: Fix to 2D images with incorrect spectral units.
parent
8604834f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CEP/PyBDSM/src/python/collapse.py
+4
-0
4 additions, 0 deletions
CEP/PyBDSM/src/python/collapse.py
CEP/PyBDSM/src/python/functions.py
+4
-2
4 additions, 2 deletions
CEP/PyBDSM/src/python/functions.py
with
8 additions
and
2 deletions
CEP/PyBDSM/src/python/collapse.py
+
4
−
0
View file @
d55efcee
...
@@ -146,6 +146,7 @@ class Op_collapse(Op):
...
@@ -146,6 +146,7 @@ class Op_collapse(Op):
if
img
.
opts
.
blank_limit
is
not
None
or
check_low
:
if
img
.
opts
.
blank_limit
is
not
None
or
check_low
:
import
scipy
import
scipy
import
sys
if
check_low
:
if
check_low
:
threshold
=
1e-5
threshold
=
1e-5
else
:
else
:
...
@@ -153,7 +154,10 @@ class Op_collapse(Op):
...
@@ -153,7 +154,10 @@ class Op_collapse(Op):
mylogger
.
userinfo
(
mylog
,
"
Blanking pixels with values
"
mylogger
.
userinfo
(
mylog
,
"
Blanking pixels with values
"
"
below %.1e Jy/beam
"
%
(
threshold
,))
"
below %.1e Jy/beam
"
%
(
threshold
,))
bad
=
(
abs
(
image
)
<
threshold
)
bad
=
(
abs
(
image
)
<
threshold
)
original_stdout
=
sys
.
stdout
# keep a reference to STDOUT
sys
.
stdout
=
func
.
NullDevice
()
# redirect the real STDOUT
count
=
scipy
.
signal
.
convolve2d
(
bad
,
N
.
ones
((
3
,
3
)),
mode
=
'
same
'
)
count
=
scipy
.
signal
.
convolve2d
(
bad
,
N
.
ones
((
3
,
3
)),
mode
=
'
same
'
)
sys
.
stdout
=
original_stdout
# turn STDOUT back on
mask_low
=
(
count
>=
5
)
mask_low
=
(
count
>=
5
)
if
check_low
:
if
check_low
:
nlow
=
len
(
N
.
where
(
mask_low
)[
0
])
nlow
=
len
(
N
.
where
(
mask_low
)[
0
])
...
...
This diff is collapsed.
Click to expand it.
CEP/PyBDSM/src/python/functions.py
+
4
−
2
View file @
d55efcee
...
@@ -1209,8 +1209,10 @@ def read_image_from_file(filename, img, indir, quiet=False):
...
@@ -1209,8 +1209,10 @@ def read_image_from_file(filename, img, indir, quiet=False):
# Check for incorrect spectral units. For example, "M/S" is not
# Check for incorrect spectral units. For example, "M/S" is not
# recognized by PyWCS as velocity ("S" is actually Siemens, not
# recognized by PyWCS as velocity ("S" is actually Siemens, not
# seconds).
# seconds). Note that we check CUNIT3 and CUNIT4 even if the
for
i
in
range
(
naxis
):
# image has only 2 axes, as the header may still have these
# entries.
for
i
in
range
(
4
):
key_val_raw
=
hdr
.
get
(
'
CUNIT
'
+
str
(
i
+
1
))
key_val_raw
=
hdr
.
get
(
'
CUNIT
'
+
str
(
i
+
1
))
if
key_val_raw
!=
None
:
if
key_val_raw
!=
None
:
if
'
M/S
'
in
key_val_raw
or
'
m/S
'
in
key_val_raw
or
'
M/s
'
in
key_val_raw
:
if
'
M/S
'
in
key_val_raw
or
'
m/S
'
in
key_val_raw
or
'
M/s
'
in
key_val_raw
:
...
...
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