Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Liu Dezi
csst_msc_sim
Commits
56130009
Commit
56130009
authored
May 06, 2024
by
Zhang Xin
Browse files
Issue39:fix cr energy random seed
parent
0a7d5af0
Changes
1
Hide whitespace changes
Inline
Side-by-side
ObservationSim/Instrument/Chip/Effects.py
View file @
56130009
...
...
@@ -613,11 +613,11 @@ def selectCosmicRayCollection(attachedSizes, xLen, yLen,cr_pixelRatio,CR_max_siz
return
CRs
[
0
:
cr_event_num
];
def
defineEnergyForCR
(
cr_event_size
):
def
defineEnergyForCR
(
cr_event_size
,
seed
=
12345
):
import
random
sigma
=
0.6
/
2.355
;
mean
=
3.3
;
random
.
seed
(
seed
)
energys
=
np
.
zeros
(
cr_event_size
);
for
i
in
np
.
arange
(
cr_event_size
):
energy_index
=
random
.
normalvariate
(
mean
,
sigma
);
...
...
@@ -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_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
]);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment