Skip to content

do what genrep says in makereplica

Emanuele Roberto Nocera requested to merge hotfix_make_replica_genrep into master

Created by: scarlehoff

I've noticed make_replica is not honoring genrep (which was not an argument to make_replica and so the replicas were always generated). This PR fixes that.

Code that reproduce the problem:

from validphys.api import API
import numpy as np
t0 = API.make_replica(
    dataset_inputs=[{"dataset":"NMC"}, {"dataset": "NMCPD"}],
    use_cuts="nocuts",
    theoryid=53,
    replica=1,
    mcseed=123,
    genrep=False,
    )
tnot = API.make_replica(
    dataset_inputs=[{"dataset":"NMC"}, {"dataset": "NMCPD"}],
    use_cuts="nocuts",
    theoryid=53,
    replica=1,
    mcseed=321,
    genrep=False,
    )
np.allclose(t0, tnot)

False

What was happening before if genrep is used is that numpy is seeded with None and then a random non-reproducible replica is generated, so basically worsts case scenario. After this PR this code returns True (since no replica is generated).

Merge request reports

Loading