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
Merge requests
!2
Draft: Nifty5 to nifty7
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Draft: Nifty5 to nifty7
nifty5_to_nifty7
into
master
Overview
0
Commits
13
Pipelines
7
Changes
11
Merged
Philipp Arras
requested to merge
nifty5_to_nifty7
into
master
3 years ago
Overview
0
Commits
13
Pipelines
7
Changes
11
Expand
0
0
Merge request reports
Compare
master
version 6
aab304b5
3 years ago
version 5
51829a68
3 years ago
version 4
5c07f3af
3 years ago
version 3
ebcf17a0
3 years ago
version 2
d25aa77f
3 years ago
version 1
880f85dd
3 years ago
master (base)
and
latest version
latest version
5d255035
13 commits,
3 years ago
version 6
aab304b5
12 commits,
3 years ago
version 5
51829a68
11 commits,
3 years ago
version 4
5c07f3af
10 commits,
3 years ago
version 3
ebcf17a0
9 commits,
3 years ago
version 2
d25aa77f
8 commits,
3 years ago
version 1
880f85dd
6 commits,
3 years ago
11 files
+
240
−
243
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
11
Search (e.g. *.vue) (Ctrl+P)
helpers/generate_data.py
+
14
−
14
Options
@@ -11,42 +11,42 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-201
9
Max-Planck-Society
# Copyright(C) 2013-20
2
1 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
import
nifty
5
as
ift
import
nifty
7
as
ift
def
generate_gaussian_data
(
signal_response
,
noise_covariance
):
ground_truth
=
ift
.
from_random
(
'
normal
'
,
signal_response
.
domain
)
d
=
signal_response
(
ground_truth
)
+
noise_covariance
.
draw_sample
(
)
ground_truth
=
ift
.
from_random
(
signal_response
.
domain
)
d
=
signal_response
(
ground_truth
)
+
noise_covariance
.
draw_sample
_with_dtype
(
np
.
float64
)
return
d
,
ground_truth
def
generate_poisson_data
(
signal_response
):
ground_truth
=
ift
.
from_random
(
'
normal
'
,
signal_response
.
domain
)
rate
=
signal_response
(
ground_truth
).
to_global_data
()
ground_truth
=
ift
.
from_random
(
signal_response
.
domain
)
rate
=
signal_response
(
ground_truth
).
val
d
=
np
.
random
.
poisson
(
rate
)
return
ift
.
from_global_data
(
signal_response
.
target
,
d
),
ground_truth
return
ift
.
makeField
(
signal_response
.
target
,
d
),
ground_truth
def
generate_bernoulli_data
(
signal_response
):
ground_truth
=
ift
.
from_random
(
'
normal
'
,
signal_response
.
domain
)
rate
=
signal_response
(
ground_truth
).
to_global_data
()
ground_truth
=
ift
.
from_random
(
signal_response
.
domain
)
rate
=
signal_response
(
ground_truth
).
val
d
=
np
.
random
.
binomial
(
1
,
rate
)
return
ift
.
from_global_data
(
signal_response
.
target
,
d
),
ground_truth
return
ift
.
makeField
(
signal_response
.
target
,
d
),
ground_truth
def
generate_wf_data
(
domain
,
spectrum
):
harmonic_space
=
domain
.
get_default_codomain
()
HT
=
ift
.
Har
tley
Operator
(
harmonic_space
,
target
=
domain
)
N
=
ift
.
ScalingOperator
(
0.1
,
domain
)
HT
=
ift
.
Har
monicTransform
Operator
(
harmonic_space
,
target
=
domain
)
N
=
ift
.
ScalingOperator
(
domain
,
0.1
)
S_k
=
ift
.
create_power_operator
(
harmonic_space
,
spectrum
)
s
=
HT
(
S_k
.
draw_sample
()).
to_global_data
()
d
=
s
+
N
.
draw_sample
().
to_global_data
()
s
=
HT
(
S_k
.
draw_sample
_with_dtype
(
np
.
float64
)).
val
d
=
s
+
N
.
draw_sample
_with_dtype
(
np
.
float64
).
val
return
d
,
s
Loading