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
9b3d6274
Commit
9b3d6274
authored
3 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
nifty5 -> nifty7 (5/n)
parent
8c9884c9
No related branches found
No related tags found
1 merge request
!2
Draft: Nifty5 to nifty7
Pipeline
#107684
failed
3 years ago
Stage: build_docker
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
3_more_examples.py
+21
-18
21 additions, 18 deletions
3_more_examples.py
helpers/responses.py
+1
-1
1 addition, 1 deletion
helpers/responses.py
with
22 additions
and
19 deletions
3_more_examples.py
+
21
−
18
View file @
9b3d6274
...
...
@@ -28,21 +28,24 @@ for mode in [0, 1]:
power_space
=
ift
.
PowerSpace
(
harmonic_space
)
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
target
=
position_space
)
# Set up an amplitude operator for the field
dct
=
{
'
target
'
:
power_space
,
'
n_pix
'
:
64
,
# 64 spectral bins
# Spectral smoothness (affects Gaussian process part)
'
a
'
:
10
,
# relatively high variance of spectral curvature
'
k0
'
:
.
2
,
# quefrency mode below which cepstrum flattens
# Power-law part of spectrum:
'
sm
'
:
-
4
,
# preferred power-law slope
'
sv
'
:
.
6
,
# low variance of power-law slope
'
im
'
:
-
3
,
# y-intercept mean, in-/decrease for more/less contrast
'
iv
'
:
2.
# y-intercept variance
args
=
{
'
offset_mean
'
:
0
,
'
offset_std
'
:
(
1e-3
,
1e-6
),
# Amplitude of field fluctuations
'
fluctuations
'
:
(
1.
,
0.8
),
# 1.0, 1e-2
# Exponent of power law power spectrum component
'
loglogavgslope
'
:
(
-
3.
,
1
),
# -6.0, 1
# Amplitude of integrated Wiener process power spectrum component
'
flexibility
'
:
(
2
,
1.
),
# 1.0, 0.5
# How ragged the integrated Wiener process component is
'
asperity
'
:
(
0.5
,
0.4
)
# 0.1, 0.5
}
A
=
ift
.
S
LA
mpl
itude
(
**
dct
)
correlated_field
=
ift
.
CorrelatedField
(
position_space
,
A
)
correlated_field
=
ift
.
S
i
mpl
eCorrelatedField
(
position_space
,
**
args
)
A
=
correlated_field
.
amplitude
dct
=
{}
if
mode
==
0
:
...
...
@@ -64,8 +67,8 @@ for mode in [0, 1]:
# Solve inference problem
ic_sampling
=
ift
.
GradientNormController
(
iteration_limit
=
100
)
ic_newton
=
ift
.
GradInfNormController
(
name
=
'
Newton
'
,
tol
=
1e-6
,
iteration_limit
=
5
0
)
ic_newton
=
ift
.
GradInfNormController
(
name
=
'
Newton
'
,
tol
=
1e-6
,
iteration_limit
=
1
0
)
minimizer
=
ift
.
NewtonCG
(
ic_newton
)
H
=
ift
.
StandardHamiltonian
(
likelihood
,
ic_sampling
)
initial_mean
=
ift
.
MultiField
.
full
(
H
.
domain
,
0.
)
...
...
@@ -73,9 +76,9 @@ for mode in [0, 1]:
N_samples
=
5
for
_
in
range
(
5
):
# Draw new samples and minimize KL
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_samples
)
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_samples
,
True
)
KL
,
convergence
=
minimizer
(
KL
)
mean
=
KL
.
position
N_posterior_samples
=
30
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_posterior_samples
)
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_posterior_samples
,
True
)
h
.
plot_reconstruction_2d
(
data
,
ground_truth
,
KL
,
signal
,
R
,
A
,
name
[
mode
])
This diff is collapsed.
Click to expand it.
helpers/responses.py
+
1
−
1
View file @
9b3d6274
...
...
@@ -44,7 +44,7 @@ def exposure_response(position_space):
exposure
[:,
x_shape
*
4
//
5
:
x_shape
]
*=
.
1
exposure
[:,
x_shape
//
2
:
x_shape
*
3
//
2
]
*=
3.
exposure
=
ift
.
Field
.
makeField
(
position_space
,
exposure
)
exposure
=
ift
.
makeField
(
position_space
,
exposure
)
E
=
ift
.
makeOp
(
exposure
)
G
=
ift
.
GeometryRemover
(
E
.
target
)
return
G
@
E
...
...
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