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
csst-sims
csst_msc_sim
Commits
1742c3e2
Commit
1742c3e2
authored
Oct 26, 2024
by
Wei Chengliang
Browse files
update codestyle-PEP8
parent
5254ae80
Pipeline
#7104
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
observation_sim/instruments/chip/effects.py
View file @
1742c3e2
...
@@ -267,8 +267,12 @@ def PRNU_Img(xsize, ysize, sigma=0.01, seed=202101):
...
@@ -267,8 +267,12 @@ def PRNU_Img(xsize, ysize, sigma=0.01, seed=202101):
return
prnuimg
return
prnuimg
def
NonLinear_f
(
x
,
beta_1
,
beta_2
):
return
x
-
beta_1
*
x
*
x
+
beta_2
*
x
*
x
*
x
def
NonLinearity
(
GSImage
,
beta1
=
5E-7
,
beta2
=
0
):
def
NonLinearity
(
GSImage
,
beta1
=
5E-7
,
beta2
=
0
):
NonLinear_f
=
lambda
x
,
beta_1
,
beta_2
:
x
-
beta_1
*
x
*
x
+
beta_2
*
x
*
x
*
x
#
NonLinear_f = lambda x, beta_1, beta_2: x - beta_1*x*x + beta_2*x*x*x
GSImage
.
applyNonlinearity
(
NonLinear_f
,
beta1
,
beta2
)
GSImage
.
applyNonlinearity
(
NonLinear_f
,
beta1
,
beta2
)
return
GSImage
return
GSImage
...
@@ -561,7 +565,7 @@ def CTEModelColRow(img, trail_direction='up', direction='column', threshold=27):
...
@@ -561,7 +565,7 @@ def CTEModelColRow(img, trail_direction='up', direction='column', threshold=27):
def
getYValue
(
collection
,
x
):
def
getYValue
(
collection
,
x
):
index
=
0
index
=
0
if
(
collection
.
shape
[
1
]
==
2
):
if
(
collection
.
shape
[
1
]
==
2
):
while
(
x
>
collection
[
index
,
0
]
and
index
<
collection
.
shape
[
0
]):
while
(
x
>
collection
[
index
,
0
]
and
index
<
collection
.
shape
[
0
]):
index
=
index
+
1
index
=
index
+
1
if
(
index
==
collection
.
shape
[
0
]
or
index
==
0
):
if
(
index
==
collection
.
shape
[
0
]
or
index
==
0
):
return
0
return
0
...
@@ -615,11 +619,11 @@ def defineEnergyForCR(cr_event_size, seed=12345):
...
@@ -615,11 +619,11 @@ def defineEnergyForCR(cr_event_size, seed=12345):
random
.
seed
(
seed
)
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
)
energys
[
i
]
=
pow
(
10
,
energy_index
)
energys
[
i
]
=
pow
(
10
,
energy_index
)
return
energys
return
energys
def
convCR
(
CRmap
=
None
,
addPSF
=
None
,
sp_n
=
4
):
def
convCR
(
CRmap
=
None
,
addPSF
=
None
,
sp_n
=
4
):
sh
=
CRmap
.
shape
sh
=
CRmap
.
shape
...
@@ -691,8 +695,8 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2
...
@@ -691,8 +695,8 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2
# ---------------------------------
# ---------------------------------
for
i
in
np
.
arange
(
cr_event_size
):
for
i
in
np
.
arange
(
cr_event_size
):
xPos
=
round
((
xLen
-
1
)
*
np
.
random
.
random
())
;
xPos
=
round
((
xLen
-
1
)
*
np
.
random
.
random
())
yPos
=
round
((
yLen
-
1
)
*
np
.
random
.
random
())
;
yPos
=
round
((
yLen
-
1
)
*
np
.
random
.
random
())
cr_lens
=
int
(
cr_size
[
i
]);
cr_lens
=
int
(
cr_size
[
i
]);
if
cr_lens
==
0
:
if
cr_lens
==
0
:
continue
continue
...
...
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