Commit ff6171e5 authored by Chen Yili's avatar Chen Yili
Browse files

Upload New File

parent 96847a33
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()
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