Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resolve
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
ift
resolve
Commits
6c6919b6
Commit
6c6919b6
authored
Sep 26, 2022
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Fits2field: Add AIPS compatilibity
parent
6f56b77d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!37
Draft: Observation: introduce __hash__
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
resolve/fits.py
+18
-4
18 additions, 4 deletions
resolve/fits.py
with
18 additions
and
4 deletions
resolve/fits.py
+
18
−
4
View file @
6c6919b6
...
...
@@ -64,6 +64,7 @@ def fits2field(file_name, ignore_units=False, from_wsclean=False):
assert
image_data
.
shape
[
0
]
==
1
# Only one Stokes component
image_data
=
image_data
[
0
]
head
=
hdu_list
[
0
].
header
if
len
(
set
([
"
CUNIT1
"
,
"
CUNIT2
"
,
"
CUNIT3
"
])
&
set
(
head
.
keys
()))
>=
1
:
assert
head
[
"
CUNIT1
"
].
strip
()
==
"
deg
"
assert
head
[
"
CUNIT2
"
].
strip
()
==
"
deg
"
assert
head
[
"
CUNIT3
"
].
strip
()
==
"
Hz
"
...
...
@@ -87,7 +88,20 @@ def fits2field(file_name, ignore_units=False, from_wsclean=False):
if
not
ignore_units
:
if
head
[
"
BUNIT
"
].
upper
()
==
"
JY/BEAM
"
:
fac
=
np
.
pi
/
4
/
np
.
log
(
2
)
scale
=
fac
*
head
[
"
BMAJ
"
]
*
head
[
"
BMIN
"
]
*
(
np
.
pi
/
180
)
**
2
if
"
BMIN
"
in
head
:
bmin
,
bmaj
=
head
[
"
BMIN
"
],
head
[
"
BMAJ
"
]
else
:
def
parse
(
lst
,
iden
):
# Can parse strings of the form:
# AIPS CLEAN BMAJ= 2.5976E-04 BMIN= 2.2344E-04 BPA= -58.25
res
=
list
(
filter
(
lambda
ll
:
iden
in
ll
,
lst
))
assert
len
(
res
)
==
1
res
=
list
(
filter
(
lambda
s
:
s
!=
""
,
res
[
0
].
split
(
"
"
)))
return
res
[
res
.
index
(
iden
)
+
1
]
bmaj
=
float
(
parse
(
head
[
"
HISTORY
"
],
"
BMAJ=
"
))
bmin
=
float
(
parse
(
head
[
"
HISTORY
"
],
"
BMIN=
"
))
scale
=
fac
*
bmin
*
bmaj
*
(
np
.
pi
/
180
)
**
2
elif
head
[
"
BUNIT
"
].
upper
()
==
"
JY/PIXEL
"
:
scale
=
abs
(
refs
[
0
][
2
]
*
refs
[
1
][
2
])
else
:
...
...
...
...
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
sign in
to comment