Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
7972efb5
Commit
7972efb5
authored
Jan 14, 2019
by
Philipp Arras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs
parent
5e5e9454
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
30 deletions
+44
-30
nifty5/domains/log_rg_space.py
nifty5/domains/log_rg_space.py
+25
-13
nifty5/domains/structured_domain.py
nifty5/domains/structured_domain.py
+2
-2
nifty5/library/dynamic_operator.py
nifty5/library/dynamic_operator.py
+7
-7
nifty5/library/smooth_linear_amplitude.py
nifty5/library/smooth_linear_amplitude.py
+10
-8
No files found.
nifty5/domains/log_rg_space.py
View file @
7972efb5
...
...
@@ -24,7 +24,7 @@ from .structured_domain import StructuredDomain
class
LogRGSpace
(
StructuredDomain
):
"""
Represents a logarithmic Cartesian grid.
'''
Represents a logarithmic Cartesian grid.
Parameters
----------
...
...
@@ -38,7 +38,7 @@ class LogRGSpace(StructuredDomain):
harmonic : bool, optional
Whether the space represents a grid in position or harmonic space.
Default: False.
"""
'''
_needed_for_hash
=
[
'_shape'
,
'_bindistances'
,
'_t_0'
,
'_harmonic'
]
def
__init__
(
self
,
shape
,
bindistances
,
t_0
,
harmonic
=
False
):
...
...
@@ -76,6 +76,7 @@ class LogRGSpace(StructuredDomain):
@
property
def
t_0
(
self
):
"""np.ndarray : array of coordinates of pixel ndim*(1,)."""
return
np
.
array
(
self
.
_t_0
)
def
__repr__
(
self
):
...
...
@@ -83,22 +84,32 @@ class LogRGSpace(StructuredDomain):
self
.
shape
,
self
.
harmonic
))
def
get_default_codomain
(
self
):
"""Returns a :class:`LogRGSpace` object representing the (position or
harmonic) partner domain of `self`, depending on `self.harmonic`. The
`bindistances` are transformed and `t_0` stays the same.
Returns
-------
LogRGSpace
The parter domain
"""
codomain_bindistances
=
1.
/
(
self
.
bindistances
*
self
.
shape
)
return
LogRGSpace
(
self
.
shape
,
codomain_bindistances
,
self
.
_t_0
,
True
)
def
get_k_length_array
(
self
):
"""
Produc
es array of distances to origin of the space.
"""
Generat
es array of distances to origin of the space.
Returns
-------
numpy.ndarray
(numpy.float64) with shape self.shape
Distances to origin of the space.
If any index of the array is zero then the distance
is np.nan if self.harmonic True
.
numpy.ndarray
Distances to origin of the space.
If any index of the array is
zero then the distance is np.nan if self.harmonic True.
The dtype is float64, the shape is `self.shape`
.
Raises
------
NotImplementedError: if self.harmonic is False
NotImplementedError
If `self.harmonic` is False.
"""
if
not
self
.
harmonic
:
raise
NotImplementedError
...
...
@@ -106,14 +117,15 @@ class LogRGSpace(StructuredDomain):
return
Field
.
from_global_data
(
self
,
np
.
linalg
.
norm
(
ks
,
axis
=
0
))
def
get_k_array
(
self
):
"""
Produc
es coordinates of the space.
"""
Generat
es coordinates of the space.
Returns
-------
numpy.ndarray(numpy.float64) with shape (len(self.shape),) + self.shape
Coordinates of the space.
If one index of the array is zero the corresponding coordinate is
-np.inf (np.nan) if self.harmonic is False (True).
numpy.ndarray
Coordinates of the space. If one index of the array is zero the
corresponding coordinate is -np.inf (np.nan) if self.harmonic is
False (True).
The dtype is float64 and shape: `(len(self.shape),) + self.shape`.
"""
ndim
=
len
(
self
.
shape
)
k_array
=
np
.
zeros
((
ndim
,)
+
self
.
shape
)
...
...
nifty5/domains/structured_domain.py
View file @
7972efb5
...
...
@@ -50,7 +50,7 @@ class StructuredDomain(Domain):
@
property
def
total_volume
(
self
):
"""float : Total domain volume
"""float : Total domain volume
.
Returns the sum over all the domain's pixel volumes.
"""
...
...
@@ -63,7 +63,7 @@ class StructuredDomain(Domain):
raise
NotImplementedError
def
get_k_length_array
(
self
):
"""k vector lengths, if applicable
,
"""k vector lengths, if applicable
.
Returns the length of the k vector for every pixel.
This method is only implemented for harmonic domains.
...
...
nifty5/library/dynamic_operator.py
View file @
7972efb5
...
...
@@ -147,7 +147,7 @@ def dynamic_operator(domain,
Parameters
----------
domain : RGSpace
The position space in which the Green's function sh
ould
be constructed.
The position space in which the Green's function sh
all
be constructed.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
field is not padded at all.
...
...
@@ -158,9 +158,9 @@ def dynamic_operator(domain,
key : String
key for dynamics encoding parameter.
causal : boolean
Whether or not the Green's function sh
ould
be causal in time.
Whether or not the Green's function sh
all
be causal in time.
minimum_phase: boolean
Whether or not the Green's function sh
ould
be a minimum phase filter.
Whether or not the Green's function sh
all
be a minimum phase filter.
Returns
-------
...
...
@@ -203,8 +203,8 @@ def dynamic_lightcone_operator(domain,
Parameters
----------
domain : RGSpace
The position space in which the Green's function sh
ould
be constructed.
Dim > 1 required
.
The position space in which the Green's function sh
all
be constructed.
It needs to have at least two dimensions
.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
field is not padded at all.
...
...
@@ -221,9 +221,9 @@ def dynamic_lightcone_operator(domain,
quant : float
Quantization of the light cone in pixels.
causal : boolean
Whether or not the Green's function sh
ould
be causal in time.
Whether or not the Green's function sh
all
be causal in time.
minimum_phase: boolean
Whether or not the Green's function sh
ould
be a minimum phase filter.
Whether or not the Green's function sh
all
be a minimum phase filter.
Returns
-------
...
...
nifty5/library/smooth_linear_amplitude.py
View file @
7972efb5
...
...
@@ -51,13 +51,13 @@ def CepstrumOperator(target, a, k0):
that the sqrt-cepstrum is essentially proportional to 1/k**2).
- A field which is symmetric around the pixel in the middle of the space.
This is result of the :class:`SymmetrizingOperator` and needed in order
to
decouple the degrees of freedom at the beginning and the end of the
This is result of the :class:`SymmetrizingOperator` and needed in order
to
decouple the degrees of freedom at the beginning and the end of the
amplitude whenever :class:`CepstrumOperator` is used as in
:class:`SLAmplitude`.
The prior on the zero mode
, or zero subspaces in the case of dim > 1,
is the integral of the prior o
f
all other modes along the corresponding
The prior on the zero mode
(or zero subspaces for more than one dimensions)
is the integral of the prior o
ver
all other modes along the corresponding
axis.
Parameters
...
...
@@ -79,9 +79,11 @@ def CepstrumOperator(target, a, k0):
raise
ValueError
if
len
(
target
)
>
1
or
target
[
0
].
harmonic
:
raise
TypeError
if
isinstance
(
k0
,
float
):
k0
=
(
k0
,
)
*
len
(
target
.
shape
)
elif
len
(
k0
)
!=
len
(
target
.
shape
):
if
isinstance
(
k0
,
(
float
,
int
)):
k0
=
np
.
array
([
k0
]
*
len
(
target
.
shape
))
else
:
k0
=
np
.
array
(
k0
)
if
len
(
k0
)
!=
len
(
target
.
shape
):
raise
ValueError
if
np
.
any
(
np
.
array
(
k0
)
<=
0
):
raise
ValueError
...
...
@@ -98,7 +100,7 @@ def CepstrumOperator(target, a, k0):
no_zero_modes
=
(
slice
(
1
,
None
),)
*
dim
ks
=
q_array
[(
slice
(
None
),)
+
no_zero_modes
]
cepstrum_field
=
np
.
zeros
(
shape
)
cepstrum_field
[
no_zero_modes
]
=
_ceps_kernel
(
dom
,
ks
,
a
,
k0
)
cepstrum_field
[
no_zero_modes
]
=
_ceps_kernel
(
ks
,
a
,
k0
)
# Fill zero-mode subspaces
for
i
in
range
(
dim
):
fst_dims
=
(
slice
(
None
),)
*
i
...
...
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