You need to sign in or sign up before continuing.
Commit cdf5fb1f authored by Wei Chengliang's avatar Wei Chengliang
Browse files

pep8 coding style

parent 0efad3cf
Pipeline #11604 passed with stage
in 0 seconds
......@@ -239,10 +239,10 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
with pkg_resources.path('observation_sim.instruments.data.ccd', histfile) as dark_histogram:
hist_dc = np.load(dark_histogram)
hist = stats.rv_histogram((hist_dc['counts'], hist_dc['bins']), density=True)
xsize= chip.npix_x
ysize= chip.npix_y
xsize = chip.npix_x
ysize = chip.npix_y
seed = chip.chipID
samples= hist.rvs(size=xsize*ysize, random_state=seed)
samples = hist.rvs(size=xsize*ysize, random_state=seed)
map_dc = np.reshape(samples, [ysize, xsize])
base_img1 = map_dc*exptime
......@@ -251,10 +251,10 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
map_temp[:, :xsize] = map_dc[:ysize//2, :]
map_temp[:, xsize:] = map_dc[:ysize//2-1:-1, :]
dt= readout_time/(ysize/2.)
dt = readout_time/(ysize/2.)
A = map_temp
A_adjusted= np.vstack([np.zeros((1, A.shape[1])), A[:-1]])
cumsum_A = np.cumsum(A_adjusted, axis=0)
A_adjusted = np.vstack([np.zeros((1, A.shape[1])), A[:-1]])
cumsum_A = np.cumsum(A_adjusted, axis=0)
B = cumsum_A * dt
base_img2 = np.vstack([B[:, :xsize], B[::-1, xsize:]])
del hist_dc
......@@ -274,8 +274,7 @@ def add_poisson(img, chip, exptime=150., seed=0, sky_level=0., poisson_noise=Non
read_noise = chip.read_noise
if dark_noise is None:
dark_noise = chip.dark_noise
base_img, map_dc = get_base_img(img=img, chip=chip, read_noise=read_noise, readout_time=chip.readout_time,
dark_noise=dark_noise, exptime=exptime, InputDark=InputDark)
base_img, map_dc = get_base_img(img=img, chip=chip, read_noise=read_noise, readout_time=chip.readout_time, dark_noise=dark_noise, exptime=exptime, InputDark=InputDark)
img += base_img
img.addNoise(poisson_noise)
# img -= read_noise**2
......
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