Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nnpdf
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Emanuele Roberto Nocera
nnpdf
Commits
f1c514a9
Commit
f1c514a9
authored
3 years ago
by
andreab1997
Browse files
Options
Downloads
Patches
Plain Diff
Separated loops in make_replica
parent
0b070c4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1557
Fix the chi2 computation in the report when there is a thcovmat
,
!1528
Fit with theory covmat with n3fit
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
validphys2/src/validphys/pseudodata.py
+13
-11
13 additions, 11 deletions
validphys2/src/validphys/pseudodata.py
with
13 additions
and
11 deletions
validphys2/src/validphys/pseudodata.py
+
13
−
11
View file @
f1c514a9
...
...
@@ -151,21 +151,23 @@ def make_replica(groups_dataset_inputs_loaded_cd_with_cuts, replica_mcseed, dat
#construct covmat
covmat
=
dataset_inputs_total_covmat
covmat_sqrt
=
sqrt_covmat
(
covmat
)
#Loading the data
pseudodatas
=
[]
check_positive_masks
=
[]
for
cd
in
groups_dataset_inputs_loaded_cd_with_cuts
:
# copy here to avoid mutating the central values.
pseudodata
=
cd
.
central_values
.
to_numpy
()
pseudodatas
.
append
(
pseudodata
)
if
"
ASY
"
in
cd
.
commondataproc
:
check_positive_masks
.
append
(
np
.
zeros_like
(
pseudodata
,
dtype
=
bool
))
else
:
check_positive_masks
.
append
(
np
.
ones_like
(
pseudodata
,
dtype
=
bool
))
# The inner while True loop is for ensuring a positive definite
# pseudodata replica
all_pseudodata
=
[]
while
True
:
pseudodatas
=
[]
check_positive_masks
=
[]
for
cd
in
groups_dataset_inputs_loaded_cd_with_cuts
:
# copy here to avoid mutating the central values.
pseudodata
=
cd
.
central_values
.
to_numpy
()
pseudodatas
.
append
(
pseudodata
)
if
"
ASY
"
in
cd
.
commondataproc
:
check_positive_masks
.
append
(
np
.
zeros_like
(
pseudodata
,
dtype
=
bool
))
else
:
check_positive_masks
.
append
(
np
.
ones_like
(
pseudodata
,
dtype
=
bool
))
shifts
=
covmat_sqrt
@
rng
.
normal
(
size
=
covmat
.
shape
[
1
])
all_pseudodata
=
(
np
.
concatenate
(
pseudodatas
,
axis
=
0
)
+
shifts
)
if
np
.
all
(
all_pseudodata
[
np
.
concatenate
(
check_positive_masks
,
axis
=
0
)]
>=
0
):
...
...
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