Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
d11f0851
Commit
d11f0851
authored
Jul 19, 2017
by
Theo Steininger
Browse files
Added logarithmic to CriticalPowerEnergy.at
parent
1d10be46
Pipeline
#15148
passed with stages
in 13 minutes and 3 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/library/critical_filter/critical_power_energy.py
View file @
d11f0851
...
...
@@ -53,24 +53,28 @@ class CriticalPowerEnergy(Energy):
default : None
"""
# ---Overwritten properties and methods---
def
__init__
(
self
,
position
,
m
,
D
=
None
,
alpha
=
1.0
,
q
=
0.
,
smoothness_prior
=
0.
,
logarithmic
=
True
,
samples
=
3
,
w
=
None
):
super
(
CriticalPowerEnergy
,
self
).
__init__
(
position
=
position
)
self
.
m
=
m
self
.
D
=
D
self
.
samples
=
samples
self
.
smoothness_prior
=
np
.
float
(
smoothness_prior
)
self
.
alpha
=
Field
(
self
.
position
.
domain
,
val
=
alpha
)
self
.
q
=
Field
(
self
.
position
.
domain
,
val
=
q
)
self
.
T
=
SmoothnessOperator
(
domain
=
self
.
position
.
domain
[
0
],
strength
=
self
.
smoothness_prior
,
strength
=
smoothness_prior
,
logarithmic
=
logarithmic
)
self
.
rho
=
self
.
position
.
domain
[
0
].
rho
self
.
_w
=
w
if
w
is
not
None
else
None
# ---Mandatory properties and methods---
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
m
,
D
=
self
.
D
,
alpha
=
self
.
alpha
,
q
=
self
.
q
,
smoothness_prior
=
self
.
smoothness_prior
,
logarithmic
=
self
.
logarithmic
,
w
=
self
.
w
,
samples
=
self
.
samples
)
@
property
...
...
@@ -94,6 +98,16 @@ class CriticalPowerEnergy(Energy):
T
=
self
.
T
)
return
curvature
# ---Added properties and methods---
@
property
def
logarithmic
(
self
):
return
self
.
T
.
logarithmic
@
property
def
smoothness_prior
(
self
):
return
self
.
T
.
strength
@
property
def
w
(
self
):
if
self
.
_w
is
None
:
...
...
nifty/operators/laplace_operator/laplace_operator.py
View file @
d11f0851
...
...
@@ -48,7 +48,9 @@ class LaplaceOperator(EndomorphicOperator):
if
not
isinstance
(
self
.
domain
[
0
],
PowerSpace
):
raise
TypeError
(
"The domain must contain exactly one PowerSpace."
)
if
logarithmic
:
self
.
_logarithmic
=
bool
(
logarithmic
)
if
self
.
logarithmic
:
self
.
positions
=
self
.
domain
[
0
].
kindex
.
copy
()
self
.
positions
[
1
:]
=
np
.
log
(
self
.
positions
[
1
:])
self
.
positions
[
0
]
=
-
1.
...
...
@@ -78,6 +80,10 @@ class LaplaceOperator(EndomorphicOperator):
def
self_adjoint
(
self
):
return
False
@
property
def
logarithmic
(
self
):
return
self
.
_logarithmic
def
_times
(
self
,
x
,
spaces
):
spaces
=
utilities
.
cast_axis_to_tuple
(
spaces
,
len
(
x
.
domain
))
if
spaces
is
None
:
...
...
nifty/operators/smoothness_operator/smoothness_operator.py
View file @
d11f0851
...
...
@@ -20,7 +20,7 @@ class SmoothnessOperator(EndomorphicOperator):
Parameters
----------
s
igma
: float,
s
trength
: float,
Specifies the strength of the SmoothnessOperator
logarithmic : boolean,
Whether smoothness is calculated on a logarithmic scale or linear scale
...
...
@@ -83,6 +83,10 @@ class SmoothnessOperator(EndomorphicOperator):
# ---Added properties and methods---
@
property
def
logarithmic
(
self
):
return
self
.
_laplace
.
logarithmic
@
property
def
strength
(
self
):
return
self
.
_strength
Theo Steininger
@theos
mentioned in issue
#170 (closed)
·
Jul 19, 2017
mentioned in issue
#170 (closed)
mentioned in issue #170
Toggle commit list
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