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_cpic_sim
Commits
ff6171e5
Commit
ff6171e5
authored
Apr 16, 2024
by
Chen Yili
Browse files
Upload New File
parent
96847a33
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/test_camera.py
0 → 100644
View file @
ff6171e5
import
unittest
from
CpicImgSim.camera
import
EMCCD
import
numpy
as
np
class
TestEMCCD
(
unittest
.
TestCase
):
def
test_emccd_normal
(
self
):
emccd
=
EMCCD
()
emccd
.
switch
[
'flat'
]
=
True
emccd
.
switch
[
'dark'
]
=
True
emccd
.
switch
[
'stripe'
]
=
True
emccd
.
switch
[
'cic'
]
=
True
emccd
.
switch
[
'cte'
]
=
True
emccd
.
switch
[
'badcolumn'
]
=
True
emccd
.
switch
[
'nonlinear'
]
=
True
emccd
.
switch
[
'cosmicray'
]
=
True
emccd
.
switch
[
'blooming'
]
=
True
image_focal
=
np
.
zeros
(
emccd
.
flat_shape
)
+
1000
iamge_cosmic_ray
=
np
.
zeros
(
emccd
.
dark_shape
)
emgain
=
10
expt
=
10
image
=
emccd
.
readout
(
image_focal
,
emgain
,
expt
,
iamge_cosmic_ray
)
self
.
assertEqual
(
image
.
shape
[
0
],
emccd
.
image_shape
[
0
])
self
.
assertEqual
(
image
.
shape
[
1
],
emccd
.
image_shape
[
1
])
def
test_emccd_allclose
(
self
):
emccd
=
EMCCD
()
emccd
.
switch
[
'flat'
]
=
False
emccd
.
switch
[
'dark'
]
=
False
emccd
.
switch
[
'stripe'
]
=
False
emccd
.
switch
[
'cic'
]
=
False
emccd
.
switch
[
'cte'
]
=
False
emccd
.
switch
[
'badcolumn'
]
=
False
emccd
.
switch
[
'nonlinear'
]
=
False
emccd
.
switch
[
'cosmicray'
]
=
False
emccd
.
switch
[
'blooming'
]
=
False
image_focal
=
np
.
zeros
(
emccd
.
flat_shape
)
+
1000
emgain
=
10
expt
=
10
image
=
emccd
.
readout
(
image_focal
,
emgain
,
expt
)
self
.
assertEqual
(
image
.
shape
[
0
],
emccd
.
image_shape
[
0
])
self
.
assertEqual
(
image
.
shape
[
1
],
emccd
.
image_shape
[
1
])
def
test_emccd_blooming
(
self
):
import
numpy
as
np
emccd
=
EMCCD
()
emccd
.
switch
[
'flat'
]
=
True
emccd
.
switch
[
'dark'
]
=
True
,
emccd
.
switch
[
'stripe'
]
=
True
emccd
.
switch
[
'cic'
]
=
True
emccd
.
switch
[
'cte'
]
=
True
emccd
.
switch
[
'badcolumn'
]
=
True
emccd
.
switch
[
'nonlinear'
]
=
True
emccd
.
switch
[
'cosmicray'
]
=
True
emccd
.
switch
[
'blooming'
]
=
True
image_focal
=
np
.
zeros
(
emccd
.
flat_shape
)
+
1000
image_focal
[
100
:
200
,
100
:
200
]
=
500_000
iamge_cosmic_ray
=
np
.
zeros
(
emccd
.
dark_shape
)
emgain
=
10
expt
=
10
image
=
emccd
.
readout
(
image_focal
,
emgain
,
expt
,
iamge_cosmic_ray
)
self
.
assertEqual
(
image
.
shape
[
0
],
emccd
.
image_shape
[
0
])
self
.
assertEqual
(
image
.
shape
[
1
],
emccd
.
image_shape
[
1
])
if
__name__
==
'__main__'
:
unittest
.
main
()
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