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
c0bedf7c
Commit
c0bedf7c
authored
May 20, 2020
by
Martin Reinecke
Browse files
Merge branch 'various_pa' into 'NIFTy_6'
Various pa See merge request
!487
parents
fd208746
8662faa1
Pipeline
#75329
passed with stages
in 8 minutes and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/library/correlated_fields.py
View file @
c0bedf7c
...
...
@@ -531,7 +531,16 @@ class CorrelatedFieldMaker:
self
.
_a
.
append
(
amp
)
self
.
_target_subdomains
.
append
(
target_subdomain
)
def
_finalize_from_op
(
self
):
def
finalize
(
self
,
prior_info
=
100
):
"""Finishes model construction process and returns the constructed
operator.
Parameters
----------
prior_info : integer
How many prior samples to draw for property verification statistics
If zero, skips calculating and displaying statistics.
"""
n_amplitudes
=
len
(
self
.
_a
)
if
self
.
_total_N
>
0
:
hspace
=
makeDomain
(
...
...
@@ -562,19 +571,8 @@ class CorrelatedFieldMaker:
pd
=
PowerDistributor
(
co
.
target
,
pp
,
amp_space
)
a
.
append
(
co
.
adjoint
@
pd
@
self
.
_a
[
ii
])
corr
=
reduce
(
mul
,
a
)
return
ht
(
azm
*
corr
*
ducktape
(
hspace
,
None
,
self
.
_prefix
+
'xi'
))
op
=
ht
(
azm
*
corr
*
ducktape
(
hspace
,
None
,
self
.
_prefix
+
'xi'
))
def
finalize
(
self
,
prior_info
=
100
):
"""Finishes model construction process and returns the constructed
operator.
Parameters
----------
prior_info : integer
How many prior samples to draw for property verification statistics
If zero, skips calculating and displaying statistics.
"""
op
=
self
.
_finalize_from_op
()
if
self
.
_offset_mean
is
not
None
:
offset
=
self
.
_offset_mean
# Deviations from this offset must not be considered here as they
...
...
nifty6/plot.py
View file @
c0bedf7c
...
...
@@ -405,7 +405,7 @@ def _plot2D(f, ax, **kwargs):
ax
.
set_ylabel
(
kwargs
.
pop
(
"ylabel"
,
""
))
dom
=
dom
[
x_space
]
if
not
have_rgb
:
cmap
=
kwargs
.
pop
(
"c
olor
map"
,
plt
.
rcParams
[
'image.cmap'
])
cmap
=
kwargs
.
pop
(
"cmap"
,
plt
.
rcParams
[
'image.cmap'
])
if
isinstance
(
dom
,
RGSpace
):
nx
,
ny
=
dom
.
shape
...
...
@@ -417,7 +417,7 @@ def _plot2D(f, ax, **kwargs):
else
:
im
=
ax
.
imshow
(
f
.
val
.
T
,
extent
=
[
0
,
nx
*
dx
,
0
,
ny
*
dy
],
vmin
=
kwargs
.
get
(
"
z
min"
),
vmax
=
kwargs
.
get
(
"
z
max"
),
vmin
=
kwargs
.
get
(
"
v
min"
),
vmax
=
kwargs
.
get
(
"
v
max"
),
cmap
=
cmap
,
origin
=
"lower"
,
**
norm
,
**
aspect
)
plt
.
colorbar
(
im
)
_limit_xy
(
**
kwargs
)
...
...
@@ -453,7 +453,7 @@ def _plot2D(f, ax, **kwargs):
if
have_rgb
:
plt
.
imshow
(
res
,
origin
=
"lower"
)
else
:
plt
.
imshow
(
res
,
vmin
=
kwargs
.
get
(
"
z
min"
),
vmax
=
kwargs
.
get
(
"
z
max"
),
plt
.
imshow
(
res
,
vmin
=
kwargs
.
get
(
"
v
min"
),
vmax
=
kwargs
.
get
(
"
v
max"
),
norm
=
norm
.
get
(
'norm'
),
cmap
=
cmap
,
origin
=
"lower"
)
plt
.
colorbar
(
orientation
=
"horizontal"
)
return
...
...
@@ -518,7 +518,7 @@ class Plot(object):
Label for the y axis.
[xyz]min, [xyz]max: float
Limits for the values to plot.
c
olor
map: string
cmap: string
Color map to use for the plot (if it is a 2D plot).
linewidth: float or list of floats
Line width.
...
...
test/test_plot.py
View file @
c0bedf7c
...
...
@@ -53,7 +53,7 @@ def test_plots():
plot
.
output
(
title
=
'Three plots'
,
name
=
next
(
name
))
plot
=
ift
.
Plot
()
plot
.
add
(
field_hp
,
title
=
'HP planck-color'
,
c
olor
map
=
'Planck-like'
)
plot
.
add
(
field_hp
,
title
=
'HP planck-color'
,
cmap
=
'Planck-like'
)
plot
.
add
(
field_rg1_2
,
title
=
'1d rg'
)
plot
.
add
(
field_ps
)
plot
.
add
(
field_gl
,
title
=
'GL'
)
...
...
Write
Preview
Supports
Markdown
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