Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
57943d67
Commit
57943d67
authored
6 years ago
by
Martin Reinecke
Browse files
Options
Downloads
Patches
Plain Diff
more docs
parent
0aa213dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nifty5/sugar.py
+52
-6
52 additions, 6 deletions
nifty5/sugar.py
with
52 additions
and
6 deletions
nifty5/sugar.py
+
52
−
6
View file @
57943d67
...
...
@@ -52,7 +52,8 @@ def PS_field(pspace, func):
Returns
-------
Field : a field defined on (pspace,) containing the computed function values
Field
A field defined on (pspace,) containing the computed function values
"""
if
not
isinstance
(
pspace
,
PowerSpace
):
raise
TypeError
...
...
@@ -209,6 +210,23 @@ def create_power_operator(domain, power_spectrum, space=None):
def
create_harmonic_smoothing_operator
(
domain
,
space
,
sigma
):
"""
Creates an operator which smoothes a subspace of a harmonic domain.
Parameters
----------
domain: DomainTuple
The total domain and target of the operator
space : int
the index of the subspace on which the operator acts.
This must be a harmonic space
sigma : float
The sigma of the Gaussian smoothing kernel
Returns
-------
DiagonalOperator
The requested smoothing operator
"""
kfunc
=
domain
[
space
].
get_fft_smoothing_kernel_function
(
sigma
)
return
DiagonalOperator
(
kfunc
(
domain
[
space
].
get_k_length_array
()),
domain
,
space
)
...
...
@@ -226,7 +244,8 @@ def full(domain, val):
Returns
-------
Field / MultiField : the newly created uniform field
Field or MultiField
The newly created uniform field
"""
if
isinstance
(
domain
,
(
dict
,
MultiDomain
)):
return
MultiField
.
full
(
domain
,
val
)
...
...
@@ -249,7 +268,8 @@ def from_random(random_type, domain, dtype=np.float64, **kwargs):
Returns
-------
Field / MultiField : the newly created random field
Field or MultiField
The newly created random field
"""
if
isinstance
(
domain
,
(
dict
,
MultiDomain
)):
return
MultiField
.
from_random
(
random_type
,
domain
,
dtype
,
**
kwargs
)
...
...
@@ -274,7 +294,8 @@ def from_global_data(domain, arr, sum_up=False):
Returns
-------
Field / MultiField : the newly created random field
Field or MultiField
The newly created random field
"""
if
isinstance
(
domain
,
(
dict
,
MultiDomain
)):
return
MultiField
.
from_global_data
(
domain
,
arr
,
sum_up
)
...
...
@@ -294,7 +315,8 @@ def from_local_data(domain, arr):
Returns
-------
Field / MultiField : the newly created field
Field or MultiField
The newly created field
"""
if
isinstance
(
domain
,
(
dict
,
MultiDomain
)):
return
MultiField
.
from_local_data
(
domain
,
arr
)
...
...
@@ -311,7 +333,8 @@ def makeDomain(domain):
Returns
-------
DomainTuple / MultiDomain : the newly created domain object
DomainTuple or MultiDomain
The newly created domain object
"""
if
isinstance
(
domain
,
(
MultiDomain
,
dict
)):
return
MultiDomain
.
make
(
domain
)
...
...
@@ -319,6 +342,21 @@ def makeDomain(domain):
def
makeOp
(
input
):
"""
Converts a Field or MultiField to a diagonal operator.
Parameters
----------
input : None, Field or MultiField
- if None, None is returned.
- if Field, a DiagonalOperator with the coefficients given by this
Field is returned.
- if MultiField, a BlockDiagonalOperator with entries given by this
MultiField is returned.
Notes
-----
No volume factors are applied.
"""
if
input
is
None
:
return
None
if
isinstance
(
input
,
Field
):
...
...
@@ -330,6 +368,14 @@ def makeOp(input):
def
domain_union
(
domains
):
"""
Computes the union of multiple DomainTuples/MultiDomains.
Parameters
----------
domains : list of DomainTuple or MultiDomain
- if DomainTuple, all entries must be equal
- if MultiDomain, there must not be any conflicting components
"""
if
isinstance
(
domains
[
0
],
DomainTuple
):
if
any
(
dom
!=
domains
[
0
]
for
dom
in
domains
[
1
:]):
raise
ValueError
(
"
domain mismatch
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment