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
cbd33338
Commit
cbd33338
authored
Mar 18, 2016
by
csongor
Browse files
Minor fixes
parent
a23a9950
Changes
2
Hide whitespace changes
Inline
Side-by-side
lm/nifty_lm.py
View file @
cbd33338
...
...
@@ -590,7 +590,7 @@ class lm_space(point_space):
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: unsupported transformation."
))
return
self
.
cast
(
Tx
.
astype
(
codomain
.
dtype
))
return
codomain
.
cast
(
Tx
.
astype
(
codomain
.
dtype
))
def
calc_smooth
(
self
,
x
,
sigma
=
0
,
**
kwargs
):
"""
...
...
@@ -651,17 +651,17 @@ class lm_space(point_space):
# power spectrum
if
self
.
dtype
==
np
.
dtype
(
'complex64'
):
if
gc
[
'use_libsharp'
]:
return
self
.
cast
(
gl
.
anaalm_f
(
x
,
lmax
=
lmax
,
mmax
=
mmax
)
)
return
gl
.
anaalm_f
(
np
.
array
(
x
)
,
lmax
=
lmax
,
mmax
=
mmax
)
else
:
return
self
.
cast
(
hp
.
alm2cl
(
x
.
copy
(
d
type
=
np
.
complex128
),
alms2
=
None
,
return
hp
.
alm2cl
(
np
.
array
(
x
).
as
type
(
np
.
complex128
),
alms2
=
None
,
lmax
=
lmax
,
mmax
=
mmax
,
lmax_out
=
lmax
,
nspec
=
None
).
copy
(
d
type
=
np
.
float32
)
)
nspec
=
None
).
as
type
(
np
.
float32
)
else
:
if
gc
[
'use_healpy'
]:
return
self
.
cast
(
hp
.
alm2cl
(
np
.
array
(
x
),
alms2
=
None
,
lmax
=
lmax
,
mmax
=
mmax
,
lmax_out
=
lmax
,
nspec
=
None
)
)
return
hp
.
alm2cl
(
np
.
array
(
x
),
alms2
=
None
,
lmax
=
lmax
,
mmax
=
mmax
,
lmax_out
=
lmax
,
nspec
=
None
)
else
:
return
self
.
cast
(
gl
.
anaalm
(
x
,
lmax
=
lmax
,
mmax
=
mmax
)
)
return
gl
.
anaalm
(
np
.
array
(
x
)
,
lmax
=
lmax
,
mmax
=
mmax
)
def
get_plot
(
self
,
x
,
title
=
""
,
vmin
=
None
,
vmax
=
None
,
power
=
True
,
norm
=
None
,
cmap
=
None
,
cbar
=
True
,
other
=
None
,
legend
=
False
,
...
...
@@ -956,9 +956,9 @@ class gl_space(point_space):
self
.
discrete
=
False
self
.
harmonic
=
False
self
.
distances
=
tuple
(
self
.
cast
(
gl
.
vol
(
self
.
paradict
[
'nlat'
],
self
.
distances
=
tuple
(
gl
.
vol
(
self
.
paradict
[
'nlat'
],
nlon
=
self
.
paradict
[
'nlon'
]
).
astype
(
np
.
float
))
)
).
astype
(
np
.
float
))
self
.
comm
=
self
.
_parse_comm
(
comm
)
@
property
...
...
@@ -1269,18 +1269,18 @@ class gl_space(point_space):
mmax
=
codomain
.
paradict
[
'mmax'
]
if
self
.
dtype
==
np
.
dtype
(
'float32'
):
Tx
=
self
.
cast
(
gl
.
map2alm_f
(
np
.
array
(
x
),
Tx
=
gl
.
map2alm_f
(
np
.
array
(
x
),
nlat
=
nlat
,
nlon
=
nlon
,
lmax
=
lmax
,
mmax
=
mmax
)
)
lmax
=
lmax
,
mmax
=
mmax
)
else
:
Tx
=
self
.
cast
(
gl
.
map2alm
(
np
.
array
(
x
),
Tx
=
gl
.
map2alm
(
np
.
array
(
x
),
nlat
=
nlat
,
nlon
=
nlon
,
lmax
=
lmax
,
mmax
=
mmax
)
)
lmax
=
lmax
,
mmax
=
mmax
)
else
:
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: unsupported transformation."
))
return
Tx
.
copy
(
d
type
=
codomain
.
dtype
)
return
codomain
.
cast
(
Tx
.
as
type
(
codomain
.
dtype
)
)
def
calc_smooth
(
self
,
x
,
sigma
=
0
,
**
kwargs
):
"""
...
...
@@ -1312,7 +1312,7 @@ class gl_space(point_space):
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: invalid sigma."
))
# smooth
nlat
=
self
.
paradict
[
'nlat'
]
return
self
.
cast
(
gl
.
smoothmap
(
x
,
return
self
.
cast
(
gl
.
smoothmap
(
np
.
array
(
x
)
,
nlat
=
nlat
,
nlon
=
self
.
paradict
[
'nlon'
],
lmax
=
nlat
-
1
,
mmax
=
nlat
-
1
,
fwhm
=
0.0
,
sigma
=
sigma
))
...
...
@@ -1342,15 +1342,15 @@ class gl_space(point_space):
lmax
=
nlat
-
1
mmax
=
nlat
-
1
if
self
.
dtype
==
np
.
dtype
(
'float32'
):
return
self
.
cast
(
gl
.
anafast_f
(
np
.
array
(
x
),
return
gl
.
anafast_f
(
np
.
array
(
x
),
nlat
=
nlat
,
nlon
=
nlon
,
lmax
=
lmax
,
mmax
=
mmax
,
alm
=
False
)
)
alm
=
False
)
else
:
return
self
.
cast
(
gl
.
anafast
(
np
.
array
(
x
),
return
gl
.
anafast
(
np
.
array
(
x
),
nlat
=
nlat
,
nlon
=
nlon
,
lmax
=
lmax
,
mmax
=
mmax
,
alm
=
False
)
)
alm
=
False
)
def
get_plot
(
self
,
x
,
title
=
""
,
vmin
=
None
,
vmax
=
None
,
power
=
False
,
unit
=
""
,
norm
=
None
,
cmap
=
None
,
cbar
=
True
,
other
=
None
,
...
...
@@ -1838,17 +1838,17 @@ class hp_space(point_space):
if
self
.
discrete
:
x
=
self
.
calc_weight
(
x
,
power
=-
0.5
)
# transform
Tx
=
self
.
cast
(
hp
.
map2alm
(
x
.
copy
(
dtype
=
np
.
float64
),
Tx
=
hp
.
map2alm
(
x
.
copy
(
dtype
=
np
.
float64
),
lmax
=
codomain
.
paradict
[
'lmax'
],
mmax
=
codomain
.
paradict
[
'mmax'
],
iter
=
niter
,
pol
=
True
,
use_weights
=
False
,
datapath
=
None
)
)
datapath
=
None
)
else
:
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: unsupported transformation."
))
return
Tx
.
copy
(
d
type
=
codomain
.
dtype
)
return
codomain
.
cast
(
Tx
.
as
type
(
codomain
.
dtype
)
)
def
calc_smooth
(
self
,
x
,
sigma
=
0
,
niter
=
0
,
**
kwargs
):
"""
...
...
@@ -1924,9 +1924,9 @@ class hp_space(point_space):
lmax
=
3
*
nside
-
1
mmax
=
lmax
# power spectrum
return
self
.
cast
(
hp
.
anafast
(
x
,
map2
=
None
,
nspec
=
None
,
lmax
=
lmax
,
mmax
=
mmax
,
return
hp
.
anafast
(
np
.
array
(
x
)
,
map2
=
None
,
nspec
=
None
,
lmax
=
lmax
,
mmax
=
mmax
,
iter
=
niter
,
alm
=
False
,
pol
=
True
,
use_weights
=
False
,
datapath
=
None
)
)
datapath
=
None
)
def
get_plot
(
self
,
x
,
title
=
""
,
vmin
=
None
,
vmax
=
None
,
power
=
False
,
unit
=
""
,
norm
=
None
,
cmap
=
None
,
cbar
=
True
,
other
=
None
,
legend
=
False
,
...
...
nifty_power_indices.py
View file @
cbd33338
...
...
@@ -249,7 +249,7 @@ class power_indices(object):
return
result
def
_compute_indices
(
self
,
nkdict
):
if
self
.
datamodel
in
[
'np'
,
'not'
]:
if
self
.
datamodel
in
[
'np'
]:
return
self
.
_compute_indices_np
(
nkdict
)
elif
self
.
datamodel
in
self
.
allowed_distribution_strategies
:
return
self
.
_compute_indices_d2o
(
nkdict
)
...
...
@@ -694,6 +694,15 @@ class lm_power_indices(power_indices):
l
=
index
-
self
.
lmax
*
m
+
m
*
(
m
-
1
)
//
2
return
l
,
m
def
_compute_indices
(
self
,
nkdict
):
if
self
.
datamodel
in
[
'np'
,
'not'
]:
return
self
.
_compute_indices_np
(
nkdict
)
elif
self
.
datamodel
in
self
.
allowed_distribution_strategies
:
return
self
.
_compute_indices_d2o
(
nkdict
)
else
:
raise
ValueError
(
about
.
_errors
.
cstring
(
'ERROR: Datamodel is not supported.'
))
def
_compute_indices_d2o
(
self
,
nkdict
):
"""
Internal helper function which computes pindex, kindex, rho and pundex
...
...
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