Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nifty_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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_tutorial
Commits
ee9facdf
Commit
ee9facdf
authored
5 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetics
parent
a8eea18a
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
3_critical_filter_solution.py
+16
-17
16 additions, 17 deletions
3_critical_filter_solution.py
with
16 additions
and
17 deletions
3_critical_filter_solution.py
+
16
−
17
View file @
ee9facdf
...
...
@@ -23,25 +23,25 @@ from helpers import (checkerboard_response, generate_gaussian_data,
np
.
random
.
seed
(
42
)
position_space
=
ift
.
RGSpace
(
[
256
,
256
]
)
position_space
=
ift
.
RGSpace
(
2
*
(
256
,)
)
harmonic_space
=
position_space
.
get_default_codomain
()
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
target
=
position_space
)
power_space
=
ift
.
PowerSpace
(
harmonic_space
)
# Set up
an amplitude operator for the fi
el
d
dct
=
{
'
target
'
:
power_space
,
'
n_pix
'
:
64
,
# 64 spectral bins
# Smoothness of spectrum
'
a
'
:
10
,
# relatively high variance of spectral curvature
'
k0
'
:
.
2
,
#
quefrency mode below w
hi
c
h
cepstrum flattens
# Power-law part of spectrum
'
sm
'
:
-
4
,
# preferred power-law slope
'
s
v
'
:
.
6
,
#
low variance of
power-law slope
'
im
'
:
-
2
,
#
y-intercept mean, in-/decrease for more/less contrast
'
i
v
'
:
2.
# y-intercept
variance
}
A
=
ift
.
SLAmplitude
(
**
dct
)
# Set up
generative mod
el
A
=
ift
.
SLAmplitude
(
**
{
'
target
'
:
power_space
,
'
n_pix
'
:
64
,
# 64 spectral bins
# Smoothness of spectrum
'
a
'
:
10
,
#
relatively
hi
g
h
variance of spectral curvature
'
k0
'
:
.
2
,
# quefrency mode below which cepstrum flattens
# Power-law part of spectrum
'
s
m
'
:
-
4
,
#
preferred
power-law slope
'
sv
'
:
.
6
,
#
low variance of power-law slope
'
i
m
'
:
-
2
,
# y-intercept
mean, in-/decrease for more/less contrast
'
iv
'
:
2.
# y-intercept variance
}
)
signal
=
ift
.
CorrelatedField
(
position_space
,
A
)
R
=
checkerboard_response
(
position_space
)
...
...
@@ -57,12 +57,11 @@ plot_prior_samples_2d(5, signal, R, signal, A, 'gauss', N=N)
likelihood
=
ift
.
GaussianEnergy
(
mean
=
data
,
inverse_covariance
=
N
.
inverse
)(
signal_response
)
# S
OLVE INFERENCE PROBLEM
# S
olve inference problem
ic_sampling
=
ift
.
GradientNormController
(
iteration_limit
=
100
)
ic_newton
=
ift
.
GradInfNormController
(
name
=
'
Newton
'
,
tol
=
1e-6
,
iteration_limit
=
30
)
minimizer
=
ift
.
NewtonCG
(
ic_newton
)
H
=
ift
.
StandardHamiltonian
(
likelihood
,
ic_sampling
)
initial_mean
=
ift
.
MultiField
.
full
(
H
.
domain
,
0.
)
...
...
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