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
6 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetics
parent
a8eea18a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show 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,13 +23,14 @@ from helpers import (checkerboard_response, generate_gaussian_data,
...
@@ -23,13 +23,14 @@ from helpers import (checkerboard_response, generate_gaussian_data,
np
.
random
.
seed
(
42
)
np
.
random
.
seed
(
42
)
position_space
=
ift
.
RGSpace
(
[
256
,
256
]
)
position_space
=
ift
.
RGSpace
(
2
*
(
256
,)
)
harmonic_space
=
position_space
.
get_default_codomain
()
harmonic_space
=
position_space
.
get_default_codomain
()
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
target
=
position_space
)
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
target
=
position_space
)
power_space
=
ift
.
PowerSpace
(
harmonic_space
)
power_space
=
ift
.
PowerSpace
(
harmonic_space
)
# Set up an amplitude operator for the field
# Set up generative model
dct
=
{
A
=
ift
.
SLAmplitude
(
**
{
'
target
'
:
power_space
,
'
target
'
:
power_space
,
'
n_pix
'
:
64
,
# 64 spectral bins
'
n_pix
'
:
64
,
# 64 spectral bins
# Smoothness of spectrum
# Smoothness of spectrum
...
@@ -40,8 +41,7 @@ dct = {
...
@@ -40,8 +41,7 @@ dct = {
'
sv
'
:
.
6
,
# low variance of power-law slope
'
sv
'
:
.
6
,
# low variance of power-law slope
'
im
'
:
-
2
,
# y-intercept mean, in-/decrease for more/less contrast
'
im
'
:
-
2
,
# y-intercept mean, in-/decrease for more/less contrast
'
iv
'
:
2.
# y-intercept variance
'
iv
'
:
2.
# y-intercept variance
}
})
A
=
ift
.
SLAmplitude
(
**
dct
)
signal
=
ift
.
CorrelatedField
(
position_space
,
A
)
signal
=
ift
.
CorrelatedField
(
position_space
,
A
)
R
=
checkerboard_response
(
position_space
)
R
=
checkerboard_response
(
position_space
)
...
@@ -57,12 +57,11 @@ plot_prior_samples_2d(5, signal, R, signal, A, 'gauss', N=N)
...
@@ -57,12 +57,11 @@ plot_prior_samples_2d(5, signal, R, signal, A, 'gauss', N=N)
likelihood
=
ift
.
GaussianEnergy
(
likelihood
=
ift
.
GaussianEnergy
(
mean
=
data
,
inverse_covariance
=
N
.
inverse
)(
signal_response
)
mean
=
data
,
inverse_covariance
=
N
.
inverse
)(
signal_response
)
# S
OLVE INFERENCE PROBLEM
# S
olve inference problem
ic_sampling
=
ift
.
GradientNormController
(
iteration_limit
=
100
)
ic_sampling
=
ift
.
GradientNormController
(
iteration_limit
=
100
)
ic_newton
=
ift
.
GradInfNormController
(
ic_newton
=
ift
.
GradInfNormController
(
name
=
'
Newton
'
,
tol
=
1e-6
,
iteration_limit
=
30
)
name
=
'
Newton
'
,
tol
=
1e-6
,
iteration_limit
=
30
)
minimizer
=
ift
.
NewtonCG
(
ic_newton
)
minimizer
=
ift
.
NewtonCG
(
ic_newton
)
H
=
ift
.
StandardHamiltonian
(
likelihood
,
ic_sampling
)
H
=
ift
.
StandardHamiltonian
(
likelihood
,
ic_sampling
)
initial_mean
=
ift
.
MultiField
.
full
(
H
.
domain
,
0.
)
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