Commit 56130009 authored by Zhang Xin's avatar Zhang Xin
Browse files

Issue39:fix cr energy random seed

parent 0a7d5af0
...@@ -613,11 +613,11 @@ def selectCosmicRayCollection(attachedSizes, xLen, yLen,cr_pixelRatio,CR_max_siz ...@@ -613,11 +613,11 @@ def selectCosmicRayCollection(attachedSizes, xLen, yLen,cr_pixelRatio,CR_max_siz
return CRs[0:cr_event_num]; return CRs[0:cr_event_num];
def defineEnergyForCR(cr_event_size): def defineEnergyForCR(cr_event_size,seed = 12345):
import random import random
sigma = 0.6 / 2.355; sigma = 0.6 / 2.355;
mean = 3.3; mean = 3.3;
random.seed(seed)
energys = np.zeros(cr_event_size); energys = np.zeros(cr_event_size);
for i in np.arange(cr_event_size): for i in np.arange(cr_event_size):
energy_index = random.normalvariate(mean,sigma); energy_index = random.normalvariate(mean,sigma);
...@@ -677,7 +677,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 ...@@ -677,7 +677,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2
cr_size = selectCosmicRayCollection(attachedSizes, xLen, yLen, cr_pixelRatio, CR_max_size); cr_size = selectCosmicRayCollection(attachedSizes, xLen, yLen, cr_pixelRatio, CR_max_size);
cr_event_size = cr_size.shape[0]; cr_event_size = cr_size.shape[0];
cr_energys = defineEnergyForCR(cr_event_size); cr_energys = defineEnergyForCR(cr_event_size,seed = seed);
CRmap = np.zeros([yLen, xLen]); CRmap = np.zeros([yLen, xLen]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment