Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
f7144b0a
Commit
f7144b0a
authored
May 17, 2017
by
Martin Reinecke
Browse files
return the correct data type
parent
fe8c2918
Pipeline
#12575
passed with stage
in 5 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/plotting/plots/heatmaps/hpmollweide.py
View file @
f7144b0a
...
...
@@ -4,7 +4,6 @@ from nifty import dependency_injector as gdi
from
heatmap
import
Heatmap
import
numpy
as
np
pylab
=
gdi
.
get
(
'pylab'
)
pyHealpix
=
gdi
.
get
(
'pyHealpix'
)
...
...
@@ -23,17 +22,25 @@ class HPMollweide(Heatmap):
super
(
HPMollweide
,
self
).
__init__
(
data
,
color_map
,
webgl
,
smoothing
)
def
_mollview
(
self
,
x
,
xsize
=
800
):
f
=
pylab
.
figure
(
None
,
figsize
=
(
8.5
,
5.4
))
nside
=
int
(
np
.
sqrt
(
x
.
size
//
12
))
base
=
pyHealpix
.
Healpix_Base
(
nside
,
"RING"
)
ra
=
np
.
linspace
(
-
np
.
pi
,
np
.
pi
,
xsize
)
dec
=
np
.
linspace
(
-
np
.
pi
/
2
,
np
.
pi
/
2
,
xsize
/
2
)
X
,
Y
=
np
.
meshgrid
(
ra
,
dec
)
dims
=
X
.
shape
+
(
2
,)
ptg
=
np
.
empty
(
dims
,
dtype
=
np
.
float64
)
ptg
[:,
:,
0
]
=
0.5
*
np
.
pi
-
Y
ptg
[:,
:,
1
]
=
X
+
np
.
pi
Z
=
x
[
base
.
ang2pix
(
ptg
)]
ax
=
f
.
add_subplot
(
111
,
projection
=
'mollweide'
)
ax
.
pcolormesh
(
X
,
Y
,
Z
,
rasterized
=
True
)
return
f
xsize
=
int
(
xsize
)
ysize
=
int
(
xsize
/
2
)
res
=
np
.
full
(
shape
=
(
ysize
,
xsize
),
fill_value
=
np
.
nan
,
dtype
=
np
.
float64
)
xc
=
(
xsize
-
1
)
*
0.5
yc
=
(
ysize
-
1
)
*
0.5
i
,
j
=
np
.
meshgrid
(
np
.
arange
(
xsize
),
np
.
arange
(
ysize
))
u
=
2
*
(
i
-
xc
)
/
(
xc
/
1.02
)
v
=
(
j
-
yc
)
/
(
yc
/
1.02
)
mask
=
np
.
where
((
u
*
u
*
0.25
+
v
*
v
)
<=
1.
)
t1
=
v
[
mask
]
theta
=
0.5
*
np
.
pi
-
(
np
.
arcsin
(
2
/
np
.
pi
*
(
np
.
arcsin
(
t1
)
+
t1
*
np
.
sqrt
((
1.
-
t1
)
*
(
1
+
t1
)))))
phi
=
-
0.5
*
np
.
pi
*
u
[
mask
]
/
np
.
maximum
(
np
.
sqrt
((
1
-
t1
)
*
(
1
+
t1
)),
1e-6
)
ptg
=
np
.
empty
((
phi
.
size
,
2
),
dtype
=
np
.
float64
)
ptg
[:,
0
]
=
theta
ptg
[:,
1
]
=
phi
base
=
pyHealpix
.
Healpix_Base
(
int
(
np
.
sqrt
(
x
.
size
/
12
)),
"RING"
)
res
[
mask
]
=
x
[
base
.
ang2pix
(
ptg
)]
#for i in range(mask[0].size):
# res[mask[1][i], mask[0][i]] = x[base.ang2pix(ptg[i])]
return
res
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment