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
Neel Shah
NIFTy
Commits
215c49a4
Commit
215c49a4
authored
Jun 06, 2017
by
Martin Reinecke
Browse files
better documentation
parent
662203ec
Changes
1
Hide whitespace changes
Inline
Sidebyside
nifty/spaces/power_space/power_space.py
View file @
215c49a4
...
...
@@ 45,9 +45,14 @@ class PowerSpace(Space):
(If binbounds has n entries, there will be n+1 bins, the first bin
starting at inf, the last bin ending at +inf.)
(default : None)
if binbounds == None
:
if binbounds == None:
Calculates the bounds from the kindex while applying the
logarithmic and nbin keywords.
Note: if "bindounds" is not None, both "logarithmic" and "nbin" must be
None!
Note: if "binbounds", "logarithmic", and "nbin" are all None, then
"natural" binning is performed, i.e. there will be one bin for every
distinct kvector length.
Attributes

...
...
@@ 93,11 +98,16 @@ class PowerSpace(Space):
dists
=
self
.
_harmonic_partner
.
get_distance_array
(
distribution_strategy
)
# sanity check
if
binbounds
is
not
None
and
not
(
nbin
is
None
and
logarithmic
is
None
):
raise
ValueError
(
"if binbounds is defined, nbin and logarithmic must be None"
)
self
.
_binbounds
=
None
if
logarithmic
is
None
and
nbin
is
None
and
binbounds
is
None
:
# compute the "natural" binning, i.e. there
# is one bin for every distinct kvector length
tmp
=
dists
.
unique
()
tmp
=
dists
.
unique
()
# expensive!
tol
=
1e12
*
tmp
[

1
]
# remove all points that are closer than tol to their right
# neighbors.
...
...
@@ 142,7 +152,7 @@ class PowerSpace(Space):
distribution_strategy
=
distribution_strategy
)
self
.
_pindex
.
set_local_data
(
np
.
searchsorted
(
bb
,
dists
.
get_local_data
()))
bb
,
dists
.
get_local_data
()))
# also expensive!
self
.
_rho
=
self
.
_pindex
.
bincount
().
get_full_data
()
self
.
_kindex
=
self
.
_pindex
.
bincount
(
weights
=
dists
).
get_full_data
()
/
self
.
_rho
...
...
Write
Preview
Supports
Markdown
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