fixed df indexing
This commit is contained in:
+3
-2
@@ -322,6 +322,8 @@ def _run_mini_batch(
|
||||
from G4Calo import __G4System
|
||||
G4System = __G4System()
|
||||
seed = int(batch_seed + counter)
|
||||
#truncate to 32 bit, lower 32 bit are used in G4
|
||||
seed = seed & 0xFFFFFFFF
|
||||
G4System.init(cw, seed) #counter gives random seed offset
|
||||
|
||||
df = G4System.run_batch(nEvents, particleSpec, minEnergy_GeV, maxEnergy_GeV,"")
|
||||
@@ -357,8 +359,6 @@ def run_batch(
|
||||
nevents = [nEventsPerCore if i < nCores - 1 else nEventsLastCore for i in range(nCores)]
|
||||
|
||||
batch_seed = int(time.time()*1000)
|
||||
#truncate to 32 bit, lower 32 bit are used in G4
|
||||
batch_seed = batch_seed & 0xFFFFFFFF
|
||||
|
||||
print(f"Batch seed: {batch_seed}")
|
||||
#use a multiprocessing pool to run the mini batches in parallel
|
||||
@@ -366,6 +366,7 @@ def run_batch(
|
||||
dfs = pool.starmap(_run_mini_batch_silent, [(gd, nevents[i], particleSpec, minEnergy_GeV, maxEnergy_GeV, batch_seed, i) for i in range(nCores)])
|
||||
|
||||
alldf = pd.concat(dfs)
|
||||
alldf.reset_index(drop=True, inplace=True)
|
||||
#convert alldf['total_dep_energy'] to numpy array and check if all non-zero entries are unique
|
||||
non_zero = alldf['total_dep_energy'][alldf['total_dep_energy'] != 0.]
|
||||
n_unique = np.unique(non_zero.to_numpy()).shape[0]
|
||||
|
||||
Reference in New Issue
Block a user