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
a125d264
Commit
a125d264
authored
Feb 16, 2018
by
Martin Reinecke
Browse files
doc work
parent
4d69516c
Pipeline
#25032
passed with stages
in 6 minutes and 29 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty4/domains/gl_space.py
View file @
a125d264
...
...
@@ -98,10 +98,27 @@ class GLSpace(StructuredDomain):
return
self
.
_nlon
def
get_default_codomain
(
self
):
"""Returns a :class:`LMSpace` object, which is capable of storing an
accurate representation of data residing on `self` (if this data is
band-limited).
Returns
-------
LMSpace
The parter domain
"""
from
..
import
LMSpace
return
LMSpace
(
lmax
=
self
.
_nlat
-
1
,
mmax
=
self
.
_nlon
//
2
)
def
check_codomain
(
self
,
codomain
):
"""Raises `TypeError` if `codomain` is not a matching partner domain
for `self`.
Notes
-----
This function only checks whether `codomain` is of type
:class:`LMSpace`.
"""
from
..
import
LMSpace
if
not
isinstance
(
codomain
,
LMSpace
):
raise
TypeError
(
"codomain must be a LMSpace."
)
nifty4/domains/hp_space.py
View file @
a125d264
...
...
@@ -80,10 +80,31 @@ class HPSpace(StructuredDomain):
return
self
.
_nside
def
get_default_codomain
(
self
):
"""Returns a :class:`LMSpace` object, which is capable of storing a
fairly accurate representation of data residing on `self`
Returns
-------
LMSpace
The parter domain
Notes
-----
The `lmax` and `mmax` parameters of the returned :class:`LMSpace` are
set to `2*self.nside`.
"""
from
..
import
LMSpace
return
LMSpace
(
lmax
=
2
*
self
.
nside
)
def
check_codomain
(
self
,
codomain
):
"""Raises `TypeError` if `codomain` is not a matching partner domain
for `self`.
Notes
-----
This function only checks whether `codomain` is of type
:class:`LMSpace`.
"""
from
..
import
LMSpace
if
not
isinstance
(
codomain
,
LMSpace
):
raise
TypeError
(
"codomain must be a LMSpace."
)
nifty4/domains/lm_space.py
View file @
a125d264
...
...
@@ -26,7 +26,8 @@ from .. import dobj
class
LMSpace
(
StructuredDomain
):
"""NIFTy subclass for sets of spherical harmonic coefficients.
Its harmonic partner spaces are :class:`HPSpace` and :class:`GLSpace`.
Its harmonic partner spaces are :class:`~nifty4.domains.hp_space.HPSpace`
and :class:`~nifty4.domains.gl_space.GLSpace`.
Parameters
----------
...
...
@@ -122,10 +123,27 @@ class LMSpace(StructuredDomain):
return
self
.
_mmax
def
get_default_codomain
(
self
):
"""Returns a :class:`~nifty4.domains.gl_space.GLSpace` object, which is
capable of storing an accurate representation of data residing on
`self`.
Returns
-------
GLSpace
The parter domain
"""
from
..
import
GLSpace
return
GLSpace
(
self
.
lmax
+
1
,
self
.
mmax
*
2
+
1
)
def
check_codomain
(
self
,
codomain
):
"""Raises `TypeError` if `codomain` is not a matching partner domain
for `self`.
Notes
-----
This function only checks whether `codomain` is of type
:class:`GLSpace` or :class:`HPSpace`.
"""
from
..
import
GLSpace
,
HPSpace
if
not
isinstance
(
codomain
,
(
GLSpace
,
HPSpace
)):
raise
TypeError
(
"codomain must be a GLSpace or HPSpace."
)
nifty4/domains/rg_space.py
View file @
a125d264
...
...
@@ -150,10 +150,21 @@ class RGSpace(StructuredDomain):
return
lambda
x
:
self
.
_kernel
(
x
,
sigma
)
def
get_default_codomain
(
self
):
"""Returns a :class:`RGSpace` object representing the (position or
harmonic) partner domain of `self`, depending on `self.harmonic`.
Returns
-------
RGSpace
The parter domain
"""
distances
=
1.
/
(
np
.
array
(
self
.
shape
)
*
np
.
array
(
self
.
distances
))
return
RGSpace
(
self
.
shape
,
distances
,
not
self
.
harmonic
)
def
check_codomain
(
self
,
codomain
):
"""Raises `TypeError` if `codomain` is not a matching partner domain
for `self`.
"""
if
not
isinstance
(
codomain
,
RGSpace
):
raise
TypeError
(
"domain is not a RGSpace"
)
...
...
nifty4/domains/structured_domain.py
View file @
a125d264
...
...
@@ -56,6 +56,12 @@ class StructuredDomain(Domain):
return
self
.
scalar_dvol
()
def
total_volume
(
self
):
"""Returns the sum over all the domain's pixel volumes.
Returns
-------
float : sum of all pixel volume elements
"""
tmp
=
self
.
dvol
()
return
self
.
size
*
tmp
if
np
.
isscalar
(
tmp
)
else
np
.
sum
(
tmp
)
...
...
nifty4/domains/unstructured_domain.py
View file @
a125d264
...
...
@@ -21,6 +21,12 @@ from functools import reduce
class
UnstructuredDomain
(
Domain
):
"""A :class:`~nifty4.domains.domain.Domain` subclass for spaces with no
associated geometry.
Typically used for data spaces.
"""
def
__init__
(
self
,
shape
):
super
(
UnstructuredDomain
,
self
).
__init__
()
self
.
_needed_for_hash
+=
[
"_shape"
]
...
...
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