Skip to content
GitLab
Menu
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
be037fd2
Commit
be037fd2
authored
Apr 09, 2021
by
Philipp Arras
Browse files
Streamline
parent
b98cb6b5
Pipeline
#97930
passed with stages
in 12 minutes and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/getting_started_density.py
View file @
be037fd2
...
@@ -49,19 +49,16 @@ def density_estimator(domain, pad=1.0, cf_fluctuations=None, cf_azm_uniform=None
...
@@ -49,19 +49,16 @@ def density_estimator(domain, pad=1.0, cf_fluctuations=None, cf_azm_uniform=None
domain_padded
=
[]
domain_padded
=
[]
for
d_scl
,
d
in
zip
(
dom_scaling
,
domain
):
for
d_scl
,
d
in
zip
(
dom_scaling
,
domain
):
if
not
isinstance
(
d
,
ift
.
RGSpace
)
or
d
.
harmonic
:
if
not
isinstance
(
d
,
ift
.
RGSpace
)
or
d
.
harmonic
:
te
=
(
te
=
[
f
"unexpected domain encountered in `domain`:
{
domain
}
"
]
f
"unexpected domain encountered in `domain`:
{
domain
}
\n
"
te
+=
"expected a non-harmonic `ift.RGSpace`"
"expected a non-harmonic `ift.RGSpace`"
raise
TypeError
(
"
\n
"
.
join
(
te
))
)
raise
TypeError
(
te
)
shape_padded
=
tuple
((
d_scl
*
np
.
array
(
d
.
shape
)).
astype
(
int
))
shape_padded
=
tuple
((
d_scl
*
np
.
array
(
d
.
shape
)).
astype
(
int
))
domain_padded
.
append
(
ift
.
RGSpace
(
shape_padded
,
distances
=
d
.
distances
))
domain_padded
.
append
(
ift
.
RGSpace
(
shape_padded
,
distances
=
d
.
distances
))
domain_padded
=
ift
.
DomainTuple
.
make
(
domain_padded
)
domain_padded
=
ift
.
DomainTuple
.
make
(
domain_padded
)
# Set up the signal model
# Set up the signal model
prefix
=
"de_"
# density estimator
azm_offset_mean
=
0.0
# The zero-mode should be inferred only from the data
azm_offset_mean
=
0.
# The zero-mode should be inferred only from the data
cfmaker
=
ift
.
CorrelatedFieldMaker
(
""
)
cfmaker
=
ift
.
CorrelatedFieldMaker
(
prefix
)
for
i
,
d
in
enumerate
(
domain_padded
):
for
i
,
d
in
enumerate
(
domain_padded
):
if
isinstance
(
cf_fluctuations
,
(
list
,
tuple
)):
if
isinstance
(
cf_fluctuations
,
(
list
,
tuple
)):
cf_fl
=
cf_fluctuations
[
i
]
cf_fl
=
cf_fluctuations
[
i
]
...
@@ -126,7 +123,7 @@ if __name__ == "__main__":
...
@@ -126,7 +123,7 @@ if __name__ == "__main__":
title
=
"Ground Truth"
,
title
=
"Ground Truth"
,
)
)
plot
.
add
(
ift
.
Field
.
from_raw
(
plotting_domain
,
data
.
val
),
title
=
"Data"
)
plot
.
add
(
ift
.
Field
.
from_raw
(
plotting_domain
,
data
.
val
),
title
=
"Data"
)
plot
.
output
(
ny
=
1
,
nx
=
3
,
xsize
=
10
,
ysize
=
10
,
name
=
filename
.
format
(
"setup"
))
plot
.
output
(
ny
=
1
,
nx
=
3
,
xsize
=
10
,
ysize
=
3
,
name
=
filename
.
format
(
"setup"
))
print
(
"Setup saved as"
,
filename
.
format
(
"setup"
))
print
(
"Setup saved as"
,
filename
.
format
(
"setup"
))
# Minimization parameters
# Minimization parameters
...
@@ -206,6 +203,5 @@ if __name__ == "__main__":
...
@@ -206,6 +203,5 @@ if __name__ == "__main__":
ift
.
Field
.
from_raw
(
plotting_domain_expanded
,
ift
.
sqrt
(
sc_unsliced
.
var
).
val
),
ift
.
Field
.
from_raw
(
plotting_domain_expanded
,
ift
.
sqrt
(
sc_unsliced
.
var
).
val
),
title
=
"Posterior Unsliced Standard Deviation"
,
title
=
"Posterior Unsliced Standard Deviation"
,
)
)
filename_res
=
filename
.
format
(
"results"
)
plot
.
output
(
xsize
=
15
,
ysize
=
15
,
name
=
filename
.
format
(
"results"
))
plot
.
output
(
ny
=
2
,
nx
=
2
,
xsize
=
15
,
ysize
=
15
,
name
=
filename_res
)
print
(
"Saved results as"
,
filename
.
format
(
"results"
))
print
(
"Saved results as '{}'."
.
format
(
filename_res
))
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