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
ift
NIFTy
Commits
3f665e63
Commit
3f665e63
authored
May 17, 2017
by
Martin Reinecke
Browse files
PEP8
parent
ae096b86
Pipeline
#12582
passed with stage
in 5 minutes and 6 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
nifty/plotting/plots/heatmaps/glmollweide.py
View file @
3f665e63
...
@@ -33,7 +33,8 @@ class GLMollweide(Heatmap):
...
@@ -33,7 +33,8 @@ class GLMollweide(Heatmap):
def
_mollweidehelper
(
xsize
):
def
_mollweidehelper
(
xsize
):
xsize
=
int
(
xsize
)
xsize
=
int
(
xsize
)
ysize
=
int
(
xsize
/
2
)
ysize
=
int
(
xsize
/
2
)
res
=
np
.
full
(
shape
=
(
ysize
,
xsize
),
fill_value
=
np
.
nan
,
dtype
=
np
.
float64
)
res
=
np
.
full
(
shape
=
(
ysize
,
xsize
),
fill_value
=
np
.
nan
,
dtype
=
np
.
float64
)
xc
=
(
xsize
-
1
)
*
0.5
xc
=
(
xsize
-
1
)
*
0.5
yc
=
(
ysize
-
1
)
*
0.5
yc
=
(
ysize
-
1
)
*
0.5
u
,
v
=
np
.
meshgrid
(
np
.
arange
(
xsize
),
np
.
arange
(
ysize
))
u
,
v
=
np
.
meshgrid
(
np
.
arange
(
xsize
),
np
.
arange
(
ysize
))
...
@@ -45,17 +46,17 @@ class GLMollweide(Heatmap):
...
@@ -45,17 +46,17 @@ class GLMollweide(Heatmap):
theta
=
0.5
*
np
.
pi
-
(
theta
=
0.5
*
np
.
pi
-
(
np
.
arcsin
(
2
/
np
.
pi
*
(
np
.
arcsin
(
t1
)
+
t1
*
np
.
sqrt
((
1.
-
t1
)
*
(
1
+
t1
)))))
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
)
phi
=
-
0.5
*
np
.
pi
*
u
[
mask
]
/
np
.
maximum
(
np
.
sqrt
((
1
-
t1
)
*
(
1
+
t1
)),
1e-6
)
phi
=
np
.
where
(
phi
<
0
,
phi
+
2
*
np
.
pi
,
phi
)
phi
=
np
.
where
(
phi
<
0
,
phi
+
2
*
np
.
pi
,
phi
)
return
res
,
mask
,
theta
,
phi
return
res
,
mask
,
theta
,
phi
def
_mollview
(
self
,
x
,
nlat
,
nlon
,
xsize
=
800
):
def
_mollview
(
self
,
x
,
nlat
,
nlon
,
xsize
=
800
):
res
,
mask
,
theta
,
phi
=
self
.
_mollweidehelper
(
xsize
)
res
,
mask
,
theta
,
phi
=
self
.
_mollweidehelper
(
xsize
)
x
=
np
.
reshape
(
x
,
(
nlat
,
nlon
))
x
=
np
.
reshape
(
x
,
(
nlat
,
nlon
))
ra
=
np
.
linspace
(
0
,
2
*
np
.
pi
,
nlon
+
1
)
ra
=
np
.
linspace
(
0
,
2
*
np
.
pi
,
nlon
+
1
)
dec
=
pyHealpix
.
GL_thetas
(
nlat
)
dec
=
pyHealpix
.
GL_thetas
(
nlat
)
ilat
=
self
.
_find_closest
(
dec
,
theta
)
ilat
=
self
.
_find_closest
(
dec
,
theta
)
ilon
=
self
.
_find_closest
(
ra
,
phi
)
ilon
=
self
.
_find_closest
(
ra
,
phi
)
ilon
=
np
.
where
(
ilon
==
nlon
,
0
,
ilon
)
ilon
=
np
.
where
(
ilon
==
nlon
,
0
,
ilon
)
res
[
mask
]
=
x
[
ilat
,
ilon
]
res
[
mask
]
=
x
[
ilat
,
ilon
]
return
res
return
res
nifty/plotting/plots/heatmaps/hpmollweide.py
View file @
3f665e63
...
@@ -23,7 +23,8 @@ class HPMollweide(Heatmap):
...
@@ -23,7 +23,8 @@ class HPMollweide(Heatmap):
def
_mollweidehelper
(
xsize
):
def
_mollweidehelper
(
xsize
):
xsize
=
int
(
xsize
)
xsize
=
int
(
xsize
)
ysize
=
int
(
xsize
/
2
)
ysize
=
int
(
xsize
/
2
)
res
=
np
.
full
(
shape
=
(
ysize
,
xsize
),
fill_value
=
np
.
nan
,
dtype
=
np
.
float64
)
res
=
np
.
full
(
shape
=
(
ysize
,
xsize
),
fill_value
=
np
.
nan
,
dtype
=
np
.
float64
)
xc
=
(
xsize
-
1
)
*
0.5
xc
=
(
xsize
-
1
)
*
0.5
yc
=
(
ysize
-
1
)
*
0.5
yc
=
(
ysize
-
1
)
*
0.5
u
,
v
=
np
.
meshgrid
(
np
.
arange
(
xsize
),
np
.
arange
(
ysize
))
u
,
v
=
np
.
meshgrid
(
np
.
arange
(
xsize
),
np
.
arange
(
ysize
))
...
@@ -35,7 +36,7 @@ class HPMollweide(Heatmap):
...
@@ -35,7 +36,7 @@ class HPMollweide(Heatmap):
theta
=
0.5
*
np
.
pi
-
(
theta
=
0.5
*
np
.
pi
-
(
np
.
arcsin
(
2
/
np
.
pi
*
(
np
.
arcsin
(
t1
)
+
t1
*
np
.
sqrt
((
1.
-
t1
)
*
(
1
+
t1
)))))
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
)
phi
=
-
0.5
*
np
.
pi
*
u
[
mask
]
/
np
.
maximum
(
np
.
sqrt
((
1
-
t1
)
*
(
1
+
t1
)),
1e-6
)
phi
=
np
.
where
(
phi
<
0
,
phi
+
2
*
np
.
pi
,
phi
)
phi
=
np
.
where
(
phi
<
0
,
phi
+
2
*
np
.
pi
,
phi
)
return
res
,
mask
,
theta
,
phi
return
res
,
mask
,
theta
,
phi
def
_mollview
(
self
,
x
,
xsize
=
800
):
def
_mollview
(
self
,
x
,
xsize
=
800
):
...
@@ -45,5 +46,5 @@ class HPMollweide(Heatmap):
...
@@ -45,5 +46,5 @@ class HPMollweide(Heatmap):
ptg
[:,
0
]
=
theta
ptg
[:,
0
]
=
theta
ptg
[:,
1
]
=
phi
ptg
[:,
1
]
=
phi
base
=
pyHealpix
.
Healpix_Base
(
int
(
np
.
sqrt
(
x
.
size
/
12
)),
"RING"
)
base
=
pyHealpix
.
Healpix_Base
(
int
(
np
.
sqrt
(
x
.
size
/
12
)),
"RING"
)
res
[
mask
]
=
x
[
base
.
ang2pix
(
ptg
)]
res
[
mask
]
=
x
[
base
.
ang2pix
(
ptg
)]
return
res
return
res
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