Loading observation_sim/config/header/ImageHeader.py +20 −16 Original line number Diff line number Diff line Loading @@ -230,16 +230,14 @@ def WCS_def( detector_size_x * x_num + gap_x[0] * gap_x1_num + gap_x[1] * gap_x2_num ) / 2 gap_x_map = np.array( [ gap_x_map = np.array([ [0, 0, 0, 0, 0], [gap_x[0], gap_x[1], gap_x[1], gap_x[1], gap_x[1]], [gap_x[1], gap_x[0], gap_x[0], gap_x[0], gap_x[0]], [gap_x[0], gap_x[0], gap_x[0], gap_x[0], gap_x[0]], [gap_x[0], gap_x[0], gap_x[0], gap_x[0], gap_x[1]], [gap_x[1], gap_x[1], gap_x[1], gap_x[1], gap_x[0]], ] ) ]) j = row_num i = col_num Loading Loading @@ -692,7 +690,8 @@ def generateExtensionHeader( ) t_shutter_os1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_os.unix) datetime .utcfromtimestamp(t_shutter_os.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -701,7 +700,8 @@ def generateExtensionHeader( h_ext["SHTOPEN0"] = t_shutter_os1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_oe1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_oe.unix) datetime .utcfromtimestamp(t_shutter_oe.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -710,7 +710,8 @@ def generateExtensionHeader( h_ext["SHTOPEN1"] = t_shutter_oe1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_co1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_co.unix) datetime .utcfromtimestamp(t_shutter_co.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -719,7 +720,8 @@ def generateExtensionHeader( h_ext["SHTCLOS0"] = t_shutter_co1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_ce1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_ce.unix) datetime .utcfromtimestamp(t_shutter_ce.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -732,7 +734,8 @@ def generateExtensionHeader( # tstart1=tstart.datetime.replace(microsecond=round(tstart.datetime.microsecond, -5)) tstart1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(tstart_read.unix) datetime .utcfromtimestamp(tstart_read.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -742,7 +745,8 @@ def generateExtensionHeader( # tend_read1 = tend_read.datetime.replace(microsecond=round(tend_read.datetime.microsecond, -5)) tend_read1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(tend_read.unix) datetime .utcfromtimestamp(tend_read.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading observation_sim/instruments/chip/chip_utils.py +13 −13 Original line number Diff line number Diff line Loading @@ -380,13 +380,11 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): dx = int(nx / nsecx) dy = int(ny / nsecy) imgt = np.zeros( [ imgt = np.zeros([ int(nsecy * nsecx), int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1), ] ) ]) for iy in range(nsecy): for ix in range(nsecx): if iy % 2 == 0: Loading @@ -397,9 +395,10 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): # chunk1-[1,2,3,4], chunk2-[5,6,7,8], chunk3-[9,10,11,12], chunk4-[13,14,15,16] chunkidx = int(tx + ty * nsecx) imgtemp = np.zeros( [int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1)] ) imgtemp = np.zeros([ int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1), ]) if int(chunkidx / 4) == 0: imgtemp[pre2 : pre2 + dy, pre1 : pre1 + dx] = img[ iy * dy : (iy + 1) * dy, ix * dx : (ix + 1) * dx Loading Loading @@ -429,9 +428,10 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): newimg = galsim.Image( int(nx + (pre1 + over1) * nsecx), int(ny + (pre2 + over2) * nsecy), init_value=0 ) newimg.array[:, :] = np.concatenate( [imgtx1, imgtx2] ) # vstack chunk(1,2) & chunk(4,3) newimg.array[:, :] = np.concatenate([ imgtx1, imgtx2, ]) # vstack chunk(1,2) & chunk(4,3) newimg.wcs = GSImage.wcs return newimg Loading observation_sim/mock_objects/CatalogBase.py +14 −14 Original line number Diff line number Diff line Loading @@ -101,14 +101,12 @@ class CatalogBase(metaclass=ABCMeta): if hasattr(norm_filt, "bandpass_full"): norm_filt = Table( np.array( np.array( [ np.array([ norm_filt.bandpass_full.wave_list * 10.0, norm_filt.bandpass_full.func( norm_filt.bandpass_full.wave_list ), ] ) ]) ).T, names=(["WAVELENGTH", "SENSITIVITY"]), ) Loading @@ -116,9 +114,10 @@ class CatalogBase(metaclass=ABCMeta): else: norm_filt = Table( np.array( np.array( [bandpass.wave_list * 10.0, bandpass.func(bandpass.wave_list)] ) np.array([ bandpass.wave_list * 10.0, bandpass.func(bandpass.wave_list), ]) ).T, names=(["WAVELENGTH", "SENSITIVITY"]), ) Loading @@ -132,9 +131,10 @@ class CatalogBase(metaclass=ABCMeta): eWave=np.ceil(norm_filt[norm_thr_rang_ids][-1][0]), ) sed_photon = copy.copy(sed) sed_photon = np.array( [sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor] ).T sed_photon = np.array([ sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor, ]).T sed_photon = galsim.LookupTable( x=np.array(sed_photon[:, 0]), f=np.array(sed_photon[:, 1] * mu), Loading observation_sim/mock_objects/Quasar.py +4 −3 Original line number Diff line number Diff line Loading @@ -75,9 +75,10 @@ class Quasar(MockObject): sWave=np.floor(normFilter[norm_thr_rang_ids][0][0]), eWave=np.ceil(normFilter[norm_thr_rang_ids][-1][0]), ) sed_photon = np.array( [sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor] ).T sed_photon = np.array([ sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor, ]).T # Convert to galsim.SED object spec = galsim.LookupTable( x=np.array(sed_photon[:, 0]), Loading observation_sim/sim_steps/add_LED_flat.py +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): t_obs_utc = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_obs_renew.unix) datetime .utcfromtimestamp(t_obs_renew.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading Loading
observation_sim/config/header/ImageHeader.py +20 −16 Original line number Diff line number Diff line Loading @@ -230,16 +230,14 @@ def WCS_def( detector_size_x * x_num + gap_x[0] * gap_x1_num + gap_x[1] * gap_x2_num ) / 2 gap_x_map = np.array( [ gap_x_map = np.array([ [0, 0, 0, 0, 0], [gap_x[0], gap_x[1], gap_x[1], gap_x[1], gap_x[1]], [gap_x[1], gap_x[0], gap_x[0], gap_x[0], gap_x[0]], [gap_x[0], gap_x[0], gap_x[0], gap_x[0], gap_x[0]], [gap_x[0], gap_x[0], gap_x[0], gap_x[0], gap_x[1]], [gap_x[1], gap_x[1], gap_x[1], gap_x[1], gap_x[0]], ] ) ]) j = row_num i = col_num Loading Loading @@ -692,7 +690,8 @@ def generateExtensionHeader( ) t_shutter_os1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_os.unix) datetime .utcfromtimestamp(t_shutter_os.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -701,7 +700,8 @@ def generateExtensionHeader( h_ext["SHTOPEN0"] = t_shutter_os1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_oe1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_oe.unix) datetime .utcfromtimestamp(t_shutter_oe.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -710,7 +710,8 @@ def generateExtensionHeader( h_ext["SHTOPEN1"] = t_shutter_oe1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_co1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_co.unix) datetime .utcfromtimestamp(t_shutter_co.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -719,7 +720,8 @@ def generateExtensionHeader( h_ext["SHTCLOS0"] = t_shutter_co1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] t_shutter_ce1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_shutter_ce.unix) datetime .utcfromtimestamp(t_shutter_ce.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -732,7 +734,8 @@ def generateExtensionHeader( # tstart1=tstart.datetime.replace(microsecond=round(tstart.datetime.microsecond, -5)) tstart1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(tstart_read.unix) datetime .utcfromtimestamp(tstart_read.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading @@ -742,7 +745,8 @@ def generateExtensionHeader( # tend_read1 = tend_read.datetime.replace(microsecond=round(tend_read.datetime.microsecond, -5)) tend_read1 = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(tend_read.unix) datetime .utcfromtimestamp(tend_read.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading
observation_sim/instruments/chip/chip_utils.py +13 −13 Original line number Diff line number Diff line Loading @@ -380,13 +380,11 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): dx = int(nx / nsecx) dy = int(ny / nsecy) imgt = np.zeros( [ imgt = np.zeros([ int(nsecy * nsecx), int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1), ] ) ]) for iy in range(nsecy): for ix in range(nsecx): if iy % 2 == 0: Loading @@ -397,9 +395,10 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): # chunk1-[1,2,3,4], chunk2-[5,6,7,8], chunk3-[9,10,11,12], chunk4-[13,14,15,16] chunkidx = int(tx + ty * nsecx) imgtemp = np.zeros( [int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1)] ) imgtemp = np.zeros([ int(ny / nsecy + pre2 + over2), int(nx / nsecx + pre1 + over1), ]) if int(chunkidx / 4) == 0: imgtemp[pre2 : pre2 + dy, pre1 : pre1 + dx] = img[ iy * dy : (iy + 1) * dy, ix * dx : (ix + 1) * dx Loading Loading @@ -429,9 +428,10 @@ def AddPreScan(GSImage, pre1=27, pre2=4, over1=71, over2=80, nsecy=2, nsecx=8): newimg = galsim.Image( int(nx + (pre1 + over1) * nsecx), int(ny + (pre2 + over2) * nsecy), init_value=0 ) newimg.array[:, :] = np.concatenate( [imgtx1, imgtx2] ) # vstack chunk(1,2) & chunk(4,3) newimg.array[:, :] = np.concatenate([ imgtx1, imgtx2, ]) # vstack chunk(1,2) & chunk(4,3) newimg.wcs = GSImage.wcs return newimg Loading
observation_sim/mock_objects/CatalogBase.py +14 −14 Original line number Diff line number Diff line Loading @@ -101,14 +101,12 @@ class CatalogBase(metaclass=ABCMeta): if hasattr(norm_filt, "bandpass_full"): norm_filt = Table( np.array( np.array( [ np.array([ norm_filt.bandpass_full.wave_list * 10.0, norm_filt.bandpass_full.func( norm_filt.bandpass_full.wave_list ), ] ) ]) ).T, names=(["WAVELENGTH", "SENSITIVITY"]), ) Loading @@ -116,9 +114,10 @@ class CatalogBase(metaclass=ABCMeta): else: norm_filt = Table( np.array( np.array( [bandpass.wave_list * 10.0, bandpass.func(bandpass.wave_list)] ) np.array([ bandpass.wave_list * 10.0, bandpass.func(bandpass.wave_list), ]) ).T, names=(["WAVELENGTH", "SENSITIVITY"]), ) Loading @@ -132,9 +131,10 @@ class CatalogBase(metaclass=ABCMeta): eWave=np.ceil(norm_filt[norm_thr_rang_ids][-1][0]), ) sed_photon = copy.copy(sed) sed_photon = np.array( [sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor] ).T sed_photon = np.array([ sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor, ]).T sed_photon = galsim.LookupTable( x=np.array(sed_photon[:, 0]), f=np.array(sed_photon[:, 1] * mu), Loading
observation_sim/mock_objects/Quasar.py +4 −3 Original line number Diff line number Diff line Loading @@ -75,9 +75,10 @@ class Quasar(MockObject): sWave=np.floor(normFilter[norm_thr_rang_ids][0][0]), eWave=np.ceil(normFilter[norm_thr_rang_ids][-1][0]), ) sed_photon = np.array( [sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor] ).T sed_photon = np.array([ sed_photon["WAVELENGTH"], sed_photon["FLUX"] * sedNormFactor, ]).T # Convert to galsim.SED object spec = galsim.LookupTable( x=np.array(sed_photon[:, 0]), Loading
observation_sim/sim_steps/add_LED_flat.py +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): t_obs_utc = datetime.utcfromtimestamp( np.round( datetime.utcfromtimestamp(t_obs_renew.unix) datetime .utcfromtimestamp(t_obs_renew.unix) .replace(tzinfo=timezone.utc) .timestamp(), 1, Loading