Change to npz output; add h5 output; change to python script
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
*.npy
|
||||
Samples/
|
||||
*.pyc
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
-4
@@ -4,6 +4,7 @@ from ROOT import *
|
||||
from multiprocessing import Pool
|
||||
from array import array
|
||||
from scipy.stats import gennorm
|
||||
import h5py
|
||||
|
||||
EnergyPerPair = 3.62 # eV
|
||||
FanoFactor = 0.13
|
||||
@@ -184,10 +185,12 @@ def singleProcess(thredIdx):
|
||||
labels[i] = np.array([x_center/pixelSize, y_center/pixelSize, z0, np.sum(_energyArray)])
|
||||
sampleOutputPath = _cfg['sampleOutputPath']
|
||||
element = _cfg['element']
|
||||
np.save(f'{sampleOutputPath}/{element}_{_cfg["sensorCode"]}_{_cfg["hv"]}V_{thredIdx}_samples.npy', samples)
|
||||
np.save(f'{sampleOutputPath}/{element}_{_cfg["sensorCode"]}_{_cfg["hv"]}V_{thredIdx}_labels.npy', labels)
|
||||
### save samples and labels into one npy file
|
||||
np.save(f'{sampleOutputPath}/{element}_{_cfg["sensorCode"]}_{_cfg["hv"]}V_{thredIdx}_samples_labels.npy', (samples, labels))
|
||||
### save samples and labels into npz file
|
||||
np.savez(f'{sampleOutputPath}/{element}_{_cfg["sensorCode"]}_{_cfg["hv"]}V_{thredIdx}.npz', samples=samples, labels=labels)
|
||||
### h5 file
|
||||
with h5py.File(f'{sampleOutputPath}/{element}_{_cfg["sensorCode"]}_{_cfg["hv"]}V_{thredIdx}.h5', 'w') as hf:
|
||||
hf['samples'] = samples
|
||||
hf['labels'] = labels
|
||||
|
||||
def getDriftTime_allpix2_8p23(z0):
|
||||
### unit: V, cm, ns, K
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
import numpy as np
|
||||
from ROOT import *
|
||||
from multiprocessing import Pool
|
||||
from array import array
|
||||
from scipy.stats import gennorm
|
||||
import McGenerator
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
attenuationLengthDict = { ### https://henke.lbl.gov/optical_constants/atten2.html
|
||||
'5keV': 18.0101, '10keV':133.706, '15keV':442.607, '20keV':1037.80, '25keV':1991.45,
|
||||
}
|
||||
element = '15keV'
|
||||
mcConfig = {
|
||||
'element': element,
|
||||
'energy': 15000, ### eV
|
||||
'attenuationLength': attenuationLengthDict[element],
|
||||
'sensorCode': 'Moench040',
|
||||
'nTotalIncident': 10_000_000,
|
||||
'nThread': 16,
|
||||
'Roi': [50, 350, 50, 350],
|
||||
'clusterWidth': 5, ### pixel
|
||||
'pixelSize': 25, ### um
|
||||
'noiseEneFrame': np.ones((400, 400)) * 0,
|
||||
'shotNoiseFactor': 0.0,
|
||||
'calibrationNoise': 0.0,
|
||||
'sensorThickness': 650, ### moench040: 650 um, 34.7 V
|
||||
'T': 273 + 20.0 + 14.8,
|
||||
'zBins': 128,
|
||||
'hv': 150,
|
||||
'depletionVoltage': 34.7,
|
||||
'simulationMethod': 'simu2', ### 'simu1' (cpu) or 'simu2' (gpu)
|
||||
'resultsPath': '/home/xie_x1/MLED/McSimulation/BatchResults',
|
||||
'sampleOutputPath': '/home/xie_x1/MLXID/McGeneration/Samples'
|
||||
}
|
||||
|
||||
McGenerator.init(mcConfig)
|
||||
McGenerator.parameterization()
|
||||
McGenerator.generateFromParameters()
|
||||
Reference in New Issue
Block a user