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
872bd200
Commit
872bd200
authored
Jan 17, 2019
by
Philipp Arras
Browse files
Merge branch 'more_docs_pa' into 'NIFTy_5'
Probing docs See merge request ift/nifty-dev!180
parents
3996cb92
189a4e76
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/probing.py
View file @
872bd200
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from
.field
import
Field
from
.field
import
Field
from
.operators.endomorphic_operator
import
EndomorphicOperator
from
.operators.operator
import
Operator
class
StatCalculator
(
object
):
class
StatCalculator
(
object
):
...
@@ -69,6 +71,29 @@ class StatCalculator(object):
...
@@ -69,6 +71,29 @@ class StatCalculator(object):
def
probe_with_posterior_samples
(
op
,
post_op
,
nprobes
):
def
probe_with_posterior_samples
(
op
,
post_op
,
nprobes
):
'''FIXME
Parameters
----------
op : EndomorphicOperator
FIXME
post_op : Operator
FIXME
nprobes : int
Number of samples which shall be drawn.
Returns
-------
List of Field
List of two fields: the mean and the variance.
'''
if
not
isinstance
(
op
,
EndomorphicOperator
):
raise
TypeError
if
post_op
is
not
None
:
if
not
isinstance
(
post_op
,
Operator
):
raise
TypeError
if
post_op
.
domain
is
not
op
.
target
:
raise
ValueError
sc
=
StatCalculator
()
sc
=
StatCalculator
()
for
i
in
range
(
nprobes
):
for
i
in
range
(
nprobes
):
if
post_op
is
None
:
if
post_op
is
None
:
...
@@ -82,6 +107,9 @@ def probe_with_posterior_samples(op, post_op, nprobes):
...
@@ -82,6 +107,9 @@ def probe_with_posterior_samples(op, post_op, nprobes):
def
probe_diagonal
(
op
,
nprobes
,
random_type
=
"pm1"
):
def
probe_diagonal
(
op
,
nprobes
,
random_type
=
"pm1"
):
'''
FIXME
'''
sc
=
StatCalculator
()
sc
=
StatCalculator
()
for
i
in
range
(
nprobes
):
for
i
in
range
(
nprobes
):
input
=
Field
.
from_random
(
random_type
,
op
.
domain
)
input
=
Field
.
from_random
(
random_type
,
op
.
domain
)
...
...
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