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
f7cf5ded
Commit
f7cf5ded
authored
Jan 14, 2019
by
Philipp Arras
Browse files
Cosmetics and fixups
parent
9c813309
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty5/domains/log_rg_space.py
View file @
f7cf5ded
...
...
@@ -16,11 +16,10 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from
functools
import
reduce
import
numpy
as
np
from
..
import
dobj
from
..field
import
Field
from
..sugar
import
exp
from
.structured_domain
import
StructuredDomain
...
...
nifty5/library/amplitude_operator.py
View file @
f7cf5ded
...
...
@@ -32,16 +32,16 @@ def _create_cepstrum_amplitude_field(domain, cepstrum):
q_array
=
domain
.
get_k_array
()
# Fill all non-zero modes
no_zero_modes
=
(
slice
(
1
,
None
),
)
*
dim
ks
=
q_array
[(
slice
(
None
),
)
+
no_zero_modes
]
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
]
=
cepstrum
(
ks
)
# Fill zero-mode subspaces
for
i
in
range
(
dim
):
fst_dims
=
(
slice
(
None
),
)
*
i
sl
=
fst_dims
+
(
slice
(
1
,
None
),
)
sl2
=
fst_dims
+
(
0
,
)
fst_dims
=
(
slice
(
None
),)
*
i
sl
=
fst_dims
+
(
slice
(
1
,
None
),)
sl2
=
fst_dims
+
(
0
,)
cepstrum_field
[
sl2
]
=
np
.
sum
(
cepstrum_field
[
sl
],
axis
=
i
)
return
Field
.
from_global_data
(
domain
,
cepstrum_field
)
...
...
nifty5/operators/slope_operator.py
View file @
f7cf5ded
...
...
@@ -33,20 +33,13 @@ class SlopeOperator(LinearOperator):
Parameters
----------
domain : domain or DomainTuple, shape=(2,)
It has to be an UnstructuredDomain.
The domain of the slope mean and the y-intercept mean.
target : domain or DomainTuple
The output domain has to a LogRGSpace
sigmas : np.array, shape=(2,)
The slope variance and the y-intercept variance.
target : LogRGSpace
The target of the operator which needs to be one-dimensional.
"""
def
__init__
(
self
,
target
):
if
not
isinstance
(
target
,
LogRGSpace
):
raise
TypeError
if
len
(
target
.
shape
)
!=
1
:
raise
ValueError
(
"Slope Operator only works for ndim == 1"
)
if
not
isinstance
(
target
,
LogRGSpace
)
or
not
len
(
target
.
shape
)
!=
1
:
raise
TypeError
(
"Slope Operator only works for ndim == 1"
)
self
.
_domain
=
DomainTuple
.
make
(
UnstructuredDomain
((
2
,)))
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
...
...
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