Loading observation_sim/instruments/chip/effects.py +162 −164 Original line number Diff line number Diff line Loading @@ -37,11 +37,11 @@ def DefectivePixels(GSImage, IfHotPix=True, IfDeadPix=True, fraction=1E-4, seed= # Hot Pixel > 20e-/s # Dead Pixel < 70%*Mean rgf = Generator(PCG64(int(seed*1.1))) if IfHotPix==True and IfDeadPix==True: if IfHotPix is True and IfDeadPix is True: HotFraction = rgf.random() # fraction in total bad pixels elif IfHotPix==False and IfDeadPix==False: elif IfHotPix is False and IfDeadPix is False: return GSImage elif IfHotPix==True: elif IfHotPix is True: HotFraction = 1 else: HotFraction = 0 Loading @@ -62,9 +62,9 @@ def DefectivePixels(GSImage, IfHotPix=True, IfDeadPix=True, fraction=1E-4, seed= rgh = Generator(PCG64(int(seed*1.2))) rgd = Generator(PCG64(int(seed*1.3))) if IfHotPix==True: if IfHotPix is True: GSImage.array[YPositHot, XPositHot] += rgh.gamma(2, 25*150, size=NPixHot) if IfDeadPix==True: if IfDeadPix is True: GSImage.array[YPositDead, XPositDead] = rgd.random(NPixDead)*(mean-biaslevel)*0.7+biaslevel+rgp.standard_normal()*5 return GSImage Loading Loading @@ -272,8 +272,7 @@ def NonLinearity(GSImage, beta1=5E-7, beta2=0): return GSImage ######################################## Saturation & Bleeding Start ############################### #Saturation & Bleeding Start# def BleedingTrail(aa, yy): if aa < 0.2: aa = 0.2 Loading @@ -289,6 +288,7 @@ def BleedingTrail(aa, yy): return trail_frac def MakeTrail(imgarr, satuyxtuple, charge, fullwell=9e4, direction='up', trailcutfrac=0.9): ''' direction: "up" or "down". For "up", bleeds along Y-decreasing direction; for "down", bleeds along Y-increasing direction. Loading Loading @@ -418,7 +418,7 @@ def SaturBloom(GSImage, nsect_x=1, nsect_y=1, fullwell=9e4): return GSImage ################################# Saturation & Bleeding End #################################### # Saturation & Bleeding End # def readout16(GSImage, rowi=0, coli=0, overscan_value=0): Loading Loading @@ -681,7 +681,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 CRmap = np.zeros([yLen, xLen]); ## produce conv kernel # produce conv kernel from astropy.modeling.models import Gaussian2D o_size = 4 sp_n = 8 Loading @@ -694,7 +694,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 addPSF = addPSF_(xp, yp) convKernel = addPSF/addPSF.sum() ################################# #--------------------------------- for i in np.arange(cr_event_size): Loading Loading @@ -730,8 +730,6 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 sly = slice(ypix[oky].min(), ypix[oky].max()+1) slx = slice(xpix[okx].min(), xpix[okx].max()+1) CRmap[sly, slx] += crMatrix_n[oky, :][:, okx] return CRmap.astype(np.int32), cr_event_size Loading Loading
observation_sim/instruments/chip/effects.py +162 −164 Original line number Diff line number Diff line Loading @@ -37,11 +37,11 @@ def DefectivePixels(GSImage, IfHotPix=True, IfDeadPix=True, fraction=1E-4, seed= # Hot Pixel > 20e-/s # Dead Pixel < 70%*Mean rgf = Generator(PCG64(int(seed*1.1))) if IfHotPix==True and IfDeadPix==True: if IfHotPix is True and IfDeadPix is True: HotFraction = rgf.random() # fraction in total bad pixels elif IfHotPix==False and IfDeadPix==False: elif IfHotPix is False and IfDeadPix is False: return GSImage elif IfHotPix==True: elif IfHotPix is True: HotFraction = 1 else: HotFraction = 0 Loading @@ -62,9 +62,9 @@ def DefectivePixels(GSImage, IfHotPix=True, IfDeadPix=True, fraction=1E-4, seed= rgh = Generator(PCG64(int(seed*1.2))) rgd = Generator(PCG64(int(seed*1.3))) if IfHotPix==True: if IfHotPix is True: GSImage.array[YPositHot, XPositHot] += rgh.gamma(2, 25*150, size=NPixHot) if IfDeadPix==True: if IfDeadPix is True: GSImage.array[YPositDead, XPositDead] = rgd.random(NPixDead)*(mean-biaslevel)*0.7+biaslevel+rgp.standard_normal()*5 return GSImage Loading Loading @@ -272,8 +272,7 @@ def NonLinearity(GSImage, beta1=5E-7, beta2=0): return GSImage ######################################## Saturation & Bleeding Start ############################### #Saturation & Bleeding Start# def BleedingTrail(aa, yy): if aa < 0.2: aa = 0.2 Loading @@ -289,6 +288,7 @@ def BleedingTrail(aa, yy): return trail_frac def MakeTrail(imgarr, satuyxtuple, charge, fullwell=9e4, direction='up', trailcutfrac=0.9): ''' direction: "up" or "down". For "up", bleeds along Y-decreasing direction; for "down", bleeds along Y-increasing direction. Loading Loading @@ -418,7 +418,7 @@ def SaturBloom(GSImage, nsect_x=1, nsect_y=1, fullwell=9e4): return GSImage ################################# Saturation & Bleeding End #################################### # Saturation & Bleeding End # def readout16(GSImage, rowi=0, coli=0, overscan_value=0): Loading Loading @@ -681,7 +681,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 CRmap = np.zeros([yLen, xLen]); ## produce conv kernel # produce conv kernel from astropy.modeling.models import Gaussian2D o_size = 4 sp_n = 8 Loading @@ -694,7 +694,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 addPSF = addPSF_(xp, yp) convKernel = addPSF/addPSF.sum() ################################# #--------------------------------- for i in np.arange(cr_event_size): Loading Loading @@ -730,8 +730,6 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 sly = slice(ypix[oky].min(), ypix[oky].max()+1) slx = slice(xpix[okx].min(), xpix[okx].max()+1) CRmap[sly, slx] += crMatrix_n[oky, :][:, okx] return CRmap.astype(np.int32), cr_event_size Loading