Commit d1bf1786 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

remove the read noise terms (first add to then minus from base image) from...

remove the read noise terms (first add to then minus from base image) from possion noise generation.
parent b6277b5d
...@@ -156,7 +156,8 @@ def get_poisson(seed=0, sky_level=0.): ...@@ -156,7 +156,8 @@ def get_poisson(seed=0, sky_level=0.):
return rng_poisson, poisson_noise return rng_poisson, poisson_noise
def get_base_img(img, read_noise, readout_time, dark_noise, exptime=150.): def get_base_img(img, read_noise, readout_time, dark_noise, exptime=150.):
base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time) # base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time)
base_level = dark_noise*(exptime+0.5*readout_time)
base_img = base_level * np.ones_like(img.array) base_img = base_level * np.ones_like(img.array)
return base_img return base_img
...@@ -169,17 +170,17 @@ def add_poisson(img, chip, exptime=150., seed=0, sky_level=0., poisson_noise=Non ...@@ -169,17 +170,17 @@ def add_poisson(img, chip, exptime=150., seed=0, sky_level=0., poisson_noise=Non
base_img = get_base_img(img=img, read_noise=read_noise, readout_time=chip.readout_time, dark_noise=dark_noise, exptime=exptime) base_img = get_base_img(img=img, read_noise=read_noise, readout_time=chip.readout_time, dark_noise=dark_noise, exptime=exptime)
img += base_img img += base_img
img.addNoise(poisson_noise) img.addNoise(poisson_noise)
img -= read_noise**2 # img -= read_noise**2
return img, base_img return img, base_img
def add_brighter_fatter(img): def add_brighter_fatter(img):
#Inital dynamic lib #Inital dynamic lib
try: try:
with pkg_resources.files('ObservationSim.Instrument.Chip.libBF').joinpath("libmoduleBF.so") as lib_path: with pkg_resources.files('ObservationSim.Instrument.Chip.lib_bf').joinpath("libmoduleBF.so") as lib_path:
print('--1', lib_path) print('--1', lib_path)
lib_bf = ctypes.CDLL(lib_path) lib_bf = ctypes.CDLL(lib_path)
except AttributeError: except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.Chip.libBF', "libmoduleBF.so") as lib_path: with pkg_resources.path('ObservationSim.Instrument.Chip.lib_bf', "libmoduleBF.so") as lib_path:
lib_bf = ctypes.CDLL(lib_path) lib_bf = ctypes.CDLL(lib_path)
lib_bf.addEffects.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.c_int] lib_bf.addEffects.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.c_int]
......
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