diff --git a/csst_mci_sim/CTI/__pycache__/CTI.cpython-311.pyc b/csst_mci_sim/CTI/__pycache__/CTI.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36a5b0b7f16698e60430bbe20606f3c526d7948a Binary files /dev/null and b/csst_mci_sim/CTI/__pycache__/CTI.cpython-311.pyc differ diff --git a/csst_mci_sim/CTI/__pycache__/__init__.cpython-311.pyc b/csst_mci_sim/CTI/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b612526d0d45577a8e58279c99f8810797247b2 Binary files /dev/null and b/csst_mci_sim/CTI/__pycache__/__init__.cpython-311.pyc differ diff --git a/csst_mci_sim/__pycache__/csst_mci_sim.cpython-311.pyc b/csst_mci_sim/__pycache__/csst_mci_sim.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bed457ca91784f314c2f8d849248657b78b4cff Binary files /dev/null and b/csst_mci_sim/__pycache__/csst_mci_sim.cpython-311.pyc differ diff --git a/csst_mci_sim/csst_mci_sim.py b/csst_mci_sim/csst_mci_sim.py index 78f69aead92b3596119ca099f7b2ec5491ba8a2b..c8076ce4f2ace6568c13643734a84e639530ed63 100644 --- a/csst_mci_sim/csst_mci_sim.py +++ b/csst_mci_sim/csst_mci_sim.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ +Created on Mon Oct 18 09:38:35 2021 + @author: yan, zhaojun""" @@ -18,8 +20,11 @@ The approximate sequence of events in the simulator is as follows: plate scale and pixel scale, exposure time etc.). #. Read in another file containing charge trap definitions (for CTI modelling). #. Read in a file defining the cosmic rays (trail lengths and cumulative distributions). - - #. Loop over the number of exposures to co-add and for each object in the galaxy fits file: + + + #. Loop over the number of exposures to co-add and for each object in the object catalog: + + #. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional]. @@ -29,7 +34,7 @@ The approximate sequence of events in the simulator is as follows: #. Add photon (Poisson) noise [optional] #. Add cosmetic defects from an input file [optional]. - #. Add prescan and overscan regions in the serial direction [optional]. + #. Add overscan regions in the serial direction [optional]. #. Apply the CDM03 radiation damage model [optional]. #. Apply non-linearity model to the pixel data [optional]. #. Add readout noise selected [optional]. @@ -51,15 +56,20 @@ Contact Information: zhaojunyan@shao.ac.cn import galsim import pandas as pd from scipy.integrate import simps -import julian + from datetime import datetime, timedelta from astropy.time import Time from astropy.coordinates import get_sun +import scipy.io as sio +import cmath + import numpy as np from tqdm import tqdm +from astropy.table import Table + from astropy.wcs import WCS as WCS from astropy.io import fits @@ -72,8 +82,25 @@ import configparser as ConfigParser from optparse import OptionParser +from matplotlib import pyplot as plt + from scipy import ndimage +#sys.path.append('./csst_mci_sim') +##sys.path.append('..') +from CTI import CTI +from support import logger as lg +from support import cosmicrays + +from support import shao + +from support import sed +#from shao import onOrbitObsPosition + +from support import MCIinstrumentModel + +from joblib import Parallel, delayed +#import multiprocessing from astropy.coordinates import SkyCoord @@ -81,21 +108,368 @@ from scipy import interpolate from scipy.signal import fftconvolve +import pandas +# sys.path.append('../MCI_inputData/TianCe') +# sys.path.append('../MCI_inputData/SED_Code') + + + + + + +# import jax +#import jax.numpy as jnp + +# from jax import config +# config.update("jax_enable_x64", True) + +# os.environ['CUDA_VISIBLE_DEVICES'] = '0' +# devices = jax.local_devices() -sys.path.append('..') -from CTI import CTI -from support import logger as lg -from support import cosmicrays -from support import MCIinstrumentModel -from support import shao -from support import sed # set the folder FOLDER ='../' ##################################################################################### +############################################################################### +import ctypes + +import astropy.coordinates as coord + +from scipy.interpolate import interp1d + +#from sky_bkg import sky_bkg + + +filterPivotWave = {'nuv':2875.5,'u':3629.6,'g':4808.4,'r':6178.2, 'i':7609.0, 'z':9012.9,'y':9627.9} +filterIndex = {'nuv':0,'u':1,'g':2,'r':3, 'i':4, 'z':5,'y':6} +# filterCCD = {'nuv':'UV0','u':'UV0','g':'Astro_MB','r':'Astro_MB', 'i':'Basic_NIR', 'z':'Basic_NIR','y':'Basic_NIR'} +# bandRange = {'nuv':[2504.0,3230.0],'u':[3190.0,4039.0],'g':[3989.0,5498.0],'r':[5438.0,6956.0], 'i':[6886.0,8469.0], +# 'z':[8379.0,10855.0],'y':[9217.0, 10900.0], 'GU':[2550, 4000],'GV':[4000, 6200],'GI':[6200,10000]} +# Instrument_dir = '/Users/linlin/Data/csst/straylightsim-master/Instrument/' +# SpecOrder = ['-2','-1','0','1','2'] +# +# filterMirrorEff = {'nuv':0.54,'u':0.68,'g':0.8,'r':0.8, 'i':0.8, 'z':0.8,'y':0.8} + + +def transRaDec2D(ra, dec): + # radec转为竞天程序里的ob, 赤道坐标系下的笛卡尔三维坐标xyz. + x1 = np.cos(dec / 57.2957795) * np.cos(ra / 57.2957795) + y1 = np.cos(dec / 57.2957795) * np.sin(ra / 57.2957795) + z1 = np.sin(dec / 57.2957795) + return np.array([x1, y1, z1]) +############################################################################### + +def flux2ill(wave, flux): + + # erg/s/cm^2/A/arcsec^2 to W/m^2 + + # 1 W/m^2/sr/μm = 0.10 erg/cm^2/s/sr/A + # 1 sr = 1 rad^2 = 4.25452e10 arcsec^2 + # 1 J/s = 1 W + # 1 J = 10^7 erg + + # convert erg/s/cm^2/A/arcsec^2 to erg/s/cm^2/A/sr + flux1 = flux / (1/4.25452e10) + # convert erg/s/cm^2/A/sr to W/m^2/sr/um + flux2 = flux1 * 10 + + # 对接收面积积分,输出单位 W/m^2/nm + D = 2 # meter + f = 28 # meter + flux3 = flux2 * np.pi * D**2 / 4 / f**2 / 10**3 + + # # # u_lambda: W/m^2/nm + # # obj0: + # V = 73 * 1e-8 # W/m^2/nm + # Es = V * np.pi * D**2 / 4 / f**2 / 10**3 + # c1 = 3.7418e-16 + # c2 = 1.44e-2 + # t = 5700 + # # wave需要代入meter. + # wave0 = np.arange(380, 780) # nm + # delta_lamba0 = 1 # nm + # u_lambda = c1 / (wave0*1e-9)**5 / (np.exp(c2 / (wave0*1e-9) / t) - 1) + # f_lambda = (u_lambda / u_lambda[wave0 == 500]) * Es + # E0 = np.sum(f_lambda * 1) + # # plt.plot(wave, u_lambda) + # # plt.show() + + # 对波长积分 + f = interp1d(wave, flux3) + wave_interp = np.arange(3800, 7800) + flux3_interp = f(wave_interp) + # 输出单位 W/m^2 + delta_lamba = 0.1 # nm + E = np.sum(flux3_interp * delta_lamba) + + # pdb.set_trace() + + return E + +################################################################ +def ill2flux(E): + + # use template from sky_bkg (background_spec_hst.dat) + filename = '../MCI_inputData/refs/background_spec_hst.dat' + cat_spec = pd.read_csv(filename, sep='\s+', header=None, comment='#') + wave0 = cat_spec[0].values # A + spec0 = cat_spec[2].values # erg/s/cm^2/A/arcsec^2 + + # convert erg/s/cm^2/A/arcsec^2 to erg/s/cm^2/A/sr + flux1 = spec0 / (1/4.25452e10) + # convert erg/s/cm^2/A/sr to W/m^2/sr/um + flux2 = flux1 * 10 + + # 对接收面积积分,输出单位 W/m^2/nm + D = 2 # meter + f = 28 # meter, 焦距,转换关系来源于王维notes. + flux3 = flux2 * np.pi * D**2 / 4 / f**2 / 10**3 + + f = interp1d(wave0, flux3) + wave_range = np.arange(3800, 7800) + flux3_mean = f(wave_range) + delta_lamba = 0.1 # nm + E0 = np.sum(flux3_mean * delta_lamba) + + factor = E / E0 + spec_scaled = factor * spec0 + + return wave0, spec_scaled + +############################################################## + +########################################################## +def zodiacal(ra, dec, time): + """ + For given RA, DEC and TIME, return the interpolated zodical spectrum in Leinert-1998. + + :param ra: RA in unit of degree, ICRS frame + :param dec: DEC in unit of degree, ICRS frame + :param time: the specified string that in ISO format i.e., yyyy-mm-dd. + :return: + wave_A: wavelength of the zodical spectrum + spec_mjy: flux of the zodical spectrum, in unit of MJy/sr + spec_erg: flux of the zodical spectrum, in unit of erg/s/cm^2/A/sr + + """ + + # get solar position + dt = datetime.fromisoformat(time) + #jd = julian.to_jd(dt, fmt='jd') + jd = time2jd(dt) + t = Time(jd, format='jd', scale='utc') + + astro_sun = get_sun(t) + ra_sun, dec_sun = astro_sun.gcrs.ra.deg, astro_sun.gcrs.dec.deg + + radec_sun = SkyCoord(ra=ra_sun*u.degree, dec=dec_sun*u.degree, frame='gcrs') + lb_sun = radec_sun.transform_to('geocentrictrueecliptic') + + # get offsets between the target and sun. + radec_obj = SkyCoord(ra=ra*u.degree, dec=dec*u.degree, frame='icrs') + lb_obj = radec_obj.transform_to('geocentrictrueecliptic') + + beta = abs(lb_obj.lat.degree) + lamda = abs(lb_obj.lon.degree - lb_sun.lon.degree) + + # interpolated zodical surface brightness at 0.5 um + zodi = pd.read_csv('../MCI_inputData/refs/zodi_map.dat', sep='\s+', header=None, comment='#') + beta_angle = np.array([0, 5, 10, 15, 20, 25, 30, 45, 60, 75]) + lamda_angle = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, + 60, 75, 90, 105, 120, 135, 150, 165, 180]) + xx, yy = np.meshgrid(beta_angle, lamda_angle) + #xx, yy = np.meshgrid(beta_angle, lamda_angle,indexing='ij', sparse=True) + + f = interpolate.interp2d(xx, yy, zodi, kind='linear') + #f = interpolate.RegularGridInterpolator((xx, yy), zodi, method='linear') + + zodi_obj = f(beta, lamda) # + + # read the zodical spectrum in the ecliptic + cat_spec = pd.read_csv('../MCI_inputData/refs/solar_spec.dat', sep='\s+', header=None, comment='#') + wave = cat_spec[0].values # A + spec0 = cat_spec[1].values # + zodi_norm = 252 # + + spec = spec0 * (zodi_obj / zodi_norm) * 1e-8 # + + # convert to the commonly used unit of MJy/sr, erg/s/cm^2/A/sr + wave_A = wave # A + #spec_mjy = spec * 0.1 * wave_A**2 / 3e18 * 1e23 * 1e-6 # MJy/sr + spec_erg = spec * 0.1 # erg/s/cm^2/A/sr + spec_erg2 = spec_erg / 4.25452e10 # erg/s/cm^2/A/arcsec^2 + + # self.zodiacal_wave=wave_A # in A + + # self.zodiacal_flux=spec_erg2 + + return wave_A, spec_erg2 + ################################################################################### + + + +#from astropy import units as u +#from astropy.coordinates import SkyCoord + + +def earth_angle(time_jd, x_sat, y_sat, z_sat, ra_obj, dec_obj): + + ra_sat = np.arctan2(y_sat, x_sat) / np.pi * 180 + dec_sat = np.arctan2(z_sat, np.sqrt(x_sat**2+y_sat**2)) / np.pi * 180 + radec_sat = SkyCoord(ra=ra_sat*u.degree, dec=dec_sat*u.degree, frame='gcrs') + lb_sat = radec_sat.transform_to('geocentrictrueecliptic') + + # get the obj location + radec_obj = SkyCoord(ra=ra_obj*u.degree, dec=dec_obj*u.degree, frame='gcrs') + lb_obj = radec_obj.transform_to('geocentrictrueecliptic') + + # calculate the angle between sub-satellite point and the earth side + earth_radius = 6371 # km + sat_height = np.sqrt(x_sat**2 + y_sat**2 + z_sat**2) + angle_a = np.arcsin(earth_radius/sat_height) / np.pi * 180 + + # calculate the angle between satellite position and the target position + angle_b = lb_sat.separation(lb_obj) + + # calculat the earth angle + angle = 180 - angle_a - angle_b.degree + + return angle + + + + #################################################3 + +def MCIinformation(): + """ + Returns a dictionary describing MCI CCD. The following information is provided (id: value - reference):: + + + dob: 0 - CDM03 (Short et al. 2010) + fwc: 90000 - CCD spec EUCL-EST-RS-6-002 (for CDM03) + rdose: 30000000000.0 - derived (above the PLM requirement) + sfwc: 730000.0 - CDM03 (Short et al. 2010), see also the CCD spec EUCL-EST-RS-6-002 + st: 5e-06 - CDM03 (Short et al. 2010) + svg: 1e-10 - CDM03 (Short et al. 2010) + t: 0.01024 - CDM03 (Short et al. 2010) + trapfile: cdm_euclid.dat - CDM03 (derived, refitted to CCD204 data) + vg: 6e-11 - CDM03 (Short et al. 2010) + vth: 11680000.0 - CDM03 (Short et al. 2010) + + + + :return: instrument model parameters + :rtype: dict + """ + + ######################################################################################################### + out=dict() + out.update({'dob' : 0, 'rdose' : 8.0e9, + 'parallelTrapfile' : 'cdm_euclid_parallel.dat', 'serialTrapfile' : 'cdm_euclid_serial.dat', + 'beta_s' : 0.6, 'beta_p': 0.6, 'fwc' : 90000, 'vth' : 1.168e7, 't' : 20.48e-3, 'vg' : 6.e-11, + 'st' : 5.0e-6, 'sfwc' : 730000., 'svg' : 1.0e-10}) + + return out +####################################### + +def CCDnonLinearityModel(data, beta=6e-7): + """ + + The non-linearity is modelled based on the results presented. + :param data: data to which the non-linearity model is being applied to + :type data: ndarray + + :return: input data after conversion with the non-linearity model + :rtype: float or ndarray + """ + out = data-beta*data**2 + + return out +#############################################################33333 + +class StrayLight(object): + + def __init__(self, jtime = 2460843., sat = np.array([0,0,0]), radec = np.array([0,0])): + self.jtime = jtime + self.sat = sat + self.equator = coord.SkyCoord(radec[0]*u.degree, radec[1]*u.degree,frame='icrs') + self.ecliptic = self.equator.transform_to('barycentrictrueecliptic') + self.pointing = transRaDec2D(radec[0], radec[1]) + self.slcdll = ctypes.CDLL('../MCI_inputData/refs/libstraylight.so') #dylib + + self.slcdll.Calculate.argtypes = [ctypes.c_double, ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double), ctypes.c_char_p] + + self.slcdll.PointSource.argtypes = [ctypes.c_double ,ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double),ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double), ctypes.c_char_p] + + self.slcdll.EarthShine.argtypes = [ctypes.c_double ,ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double)] + + self.slcdll.Zodiacal.argtypes = [ctypes.c_double ,ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double)] + self.slcdll.ComposeY.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(ctypes.c_double)] + self.slcdll.Init.argtypes=[ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p] + self.deFn = "../MCI_inputData/refs/DE405" + self.PSTFn = "../MCI_inputData/refs/PST" + self.RFn = "../MCI_inputData/refs/R" + self.ZolFn = "../MCI_inputData/refs/Zodiacal" + self.brightStarTabFn = "../MCI_inputData/refs/BrightGaia_with_csst_mag" + + self.slcdll.Init(str.encode(self.deFn),str.encode(self.PSTFn),str.encode(self.RFn),str.encode(self.ZolFn)) + + + def caculateStarLightFilter(self, filter='i'): + + sat = (ctypes.c_double*3)() + sat[:] = self.sat + ob = (ctypes.c_double*3)() + ob[:] = self.pointing + + py1 = (ctypes.c_double*3)() + py2 = (ctypes.c_double*3)() + self.slcdll.ComposeY(ob, py1, py2) + + star_e1 = (ctypes.c_double*7)() + self.slcdll.PointSource(self.jtime, sat, ob, py1, star_e1, str.encode(self.brightStarTabFn)) + star_e2 = (ctypes.c_double*7)() + self.slcdll.PointSource(self.jtime, sat, ob, py2, star_e2, str.encode(self.brightStarTabFn)) + + band_star_e1 = star_e1[:][filterIndex[filter]] + band_star_e2 = star_e2[:][filterIndex[filter]] + + return max(band_star_e1, band_star_e2) + + def caculateEarthShineFilter(self, filter='i'): + sat = (ctypes.c_double*3)() + sat[:] = self.sat + ob = (ctypes.c_double*3)() + ob[:] = self.pointing + + py1 = (ctypes.c_double*3)() + py2 = (ctypes.c_double*3)() + self.slcdll.ComposeY(ob, py1, py2) + + earth_e1 = (ctypes.c_double*7)() + self.slcdll.EarthShine(self.jtime, sat, ob, py1, earth_e1) # e[7]代表7个波段的照度 + + earth_e2 = (ctypes.c_double*7)() + self.slcdll.EarthShine(self.jtime, sat, ob, py2, earth_e2) + + band_earth_e1 = earth_e1[:][filterIndex[filter]] + band_earth_e2 = earth_e2[:][filterIndex[filter]] + + return max(band_earth_e1, band_earth_e2) + +############################################################################### +#################################################################################### def processArgs(printHelp=False): @@ -212,71 +586,41 @@ def dt2hmd(dt): ############################################################################### -def deg2HMS(ra, dec, rou=False): - '''convert deg to ra's HMS or dec's DHS''' - RA, DEC, rs, ds = '000000', '000000', '', '' - if dec: - if str(dec)[0] == '-': - ds, dec = '-', abs(dec) - deg = int(dec) - decM = abs(int((dec-deg)*60)) - - if rou: - decS = round((abs((dec-deg)*60)-decM)*60,1) - else: - decS = int((abs((dec-deg)*60)-decM)*60) - - if deg ==0: - deg ="00" - elif deg <10: - deg = "0%s"%deg - - if decM ==0: - decM ="00" - elif decM <10: - decM = "0%s"%decM - - if decS ==0: - decS ="00" - elif decS <10: - decS = "0%s"%decS - - DEC = '{0}{1}{2}{3}'.format(ds, deg, decM, decS) - - if ra: - if str(ra)[0] == '-': - rs, ra = '-', abs(ra) - raH = int(ra/15) - raM = int(((ra/15)-raH)*60) - - if rou: - raS = round(((((ra/15)-raH)*60)-raM)*60,1) - else: - raS = int(((((ra/15)-raH)*60)-raM)*60) - - if raH ==0: - raH = "00" - - elif raH <10: - raH = "0%s"%raH - - if raM ==0: - raM = "00" - elif raM <10: - raM = "0%s"%raM - - if raS ==0: - raS = "00" + +def deg2HMS(ra0, dec0): + '''convert deg to ra's HMS and dec's DMS''' + c = SkyCoord(ra=ra0*u.degree, dec=dec0*u.degree) + ss=c.to_string('hmsdms') + print(ss) + for k in range(5,len(ss)-1): + + if ss[k]=='s': + s_idx=k - elif raS <10: - raS = "0%s"%raS + if ss[k]=='d': + d_idx=k - RA = '{0}{1}{2}{3}'.format(rs, raH, raM, raS) - - if ds=='-': - return RA+DEC - else: - return RA+'+'+DEC + if ss[k]=='m': + m_idx=k + + if c.ra.hms.s<10 and c.ra.hms.s>0.1: + temp=str(c.ra.hms.s) + ra_ss='0'+temp[:3] + if c.ra.hms.s>10: + temp=str(c.ra.hms.s) + ra_ss=temp[:4] + + if c.ra.hms.s<0.1: + temp=str(c.ra.hms.s) + ra_ss='00.0' + + dms_d=ss[s_idx+2:d_idx] + dms_m=ss[d_idx+1:m_idx] + dms_s=ss[m_idx+1:m_idx+3] + + hhmmss=ss[0:2]+ss[3:5]+ra_ss + return hhmmss+dms_d+dms_m+dms_s + ################################################################################ def cut_radius(rcutstar, mstar, mag): return rcutstar * 10**(0.4*2*(mstar-mag)/3.125) @@ -294,7 +638,7 @@ def v_disp(sigstar, mstar, mag): def distortField(ra, dec, ch): ###% ra ,dec are the idea position in arcsec , and the center position is ra=0, dec=0 - '''MCI geometry distortion effect in channel G R and I''' + '''MCI geometry distortion effect in channel G R and I''' distortA=dict() distortB=dict() @@ -419,6 +763,18 @@ def krebin(a, sample): return a.reshape(sh).sum(-1).sum(1) ##################################################################### + + +def float2char(a, z): + ### a is input float value + ### transfer float a to chars and save z bis + b=str(a) + n=len(b) + + if z>=n: + return b + else: + return b[:z] ######################################################### def centroid(data): @@ -442,9 +798,323 @@ def centroid(data): ############################################################################### +def fftrange(n, dtype=float): + """FFT-aligned coordinate grid for n samples.""" + return np.arange(-n//2, -n//2+n, dtype=dtype) + +############################################################################### + + +def dft2(ary, Q, samples, shift=None): + """Compute the two dimensional Discrete Fourier Transform of a matrix. + + Parameters + ---------- + ary : `numpy.ndarray` + an array, 2D, real or complex. Not fftshifted. + Q : `float` + oversampling / padding factor to mimic an FFT. If Q=2, Nyquist sampled + samples : `int` or `Iterable` + number of samples in the output plane. + If an int, used for both dimensions. If an iterable, used for each dim + shift : `float`, optional + shift of the output domain, as a frequency. Same broadcast + rules apply as with samples. + + Returns + ------- + `numpy.ndarray` + 2D array containing the shifted transform. + Equivalent to ifftshift(fft2(fftshift(ary))) modulo output + sampling/grid differences + + """ + + # this is for dtype stabilization + Q = float(Q) ## Q=lambda*f/D/pixelsize + + n, m = ary.shape ###ary maybe is the pupil function + N, M = samples,samples + + X, Y, U, V = (fftrange(n) for n in (m, n, M, N)) + + a = 1 / Q + + ################################################################### + Eout_fwd = np.exp(-1j * 2 * np.pi * a / n * np.outer(Y, V).T) + Ein_fwd = np.exp(-1j * 2 * np.pi * a / m * np.outer(X, U)) + + ############################################################################# + + out = Eout_fwd @ ary @ Ein_fwd #### ary is the input pupil function + + return out +############################################################################## + +def idft2(ary, Q, samples, shift=None): + """Compute the two dimensional inverse Discrete Fourier Transform of a matrix. + + Parameters + ---------- + ary : `numpy.ndarray` + an array, 2D, real or complex. Not fftshifted. + Q : `float` + oversampling / padding factor to mimic an FFT. If Q=2, Nyquist sampled + samples : `int` or `Iterable` + number of samples in the output plane. + If an int, used for both dimensions. If an iterable, used for each dim + shift : `float`, optional + shift of the output domain, as a frequency. Same broadcast + rules apply as with samples. + + Returns + ------- + `numpy.ndarray` + 2D array containing the shifted transform. + Equivalent to ifftshift(ifft2(fftshift(ary))) modulo output + sampling/grid differences + + """ + # this is for dtype stabilization + Q = float(Q) ## Q=lambda*f/D/pixelsize + + n, m = ary.shape ###ary maybe is the pupil function + N, M = samples + + X, Y, U, V = (fftrange(n) for n in (m, n, M, N)) + + ############################################################################### + nm = n*m + NM = N*M + r = NM/nm + a = 1 / Q + + ################################################################### + # Eout_fwd = np.exp(-1j * 2 * np.pi * a / n * np.outer(Y, V).T) + # Ein_fwd = np.exp(-1j * 2 * np.pi * a / m * np.outer(X, U)) + Eout_rev = np.exp(1j * 2 * np.pi * a / n * np.outer(Y, V).T) * (1/r) + Ein_rev = np.exp(1j * 2 * np.pi * a / m * np.outer(X, U)) * (1/nm) + + ########################################################################### + + out = Eout_rev @ ary @ Ein_rev + + return out +############################################################################### ############################################################################### +def opd2psf(opd,cwave,oversampling): + ''' + calculate psf from opd data with defined wavelength + + Parameters + ---------- + opd : TYPE + the input opd data. + cwave : TYPE + the defined wavelength. + + ''' + + D=2; + focLength=41.253 # % MCI focal length in meters + pixel=10/oversampling # % pixel size in microns + + opd=opd*1e9; ## convert opd unit of meter to nm + + zoomopd=ndimage.zoom(opd, 2, order=1) + + m,n=np.shape(zoomopd); + clambda=cwave; + + wfe=zoomopd/clambda; #%% the main telescope aberration ,in wavelength; + + Q=clambda*1e-3*focLength/D/pixel + + pupil=np.zeros((m,m)); + + pupil[abs(zoomopd)>0]=1; + #idx=pupil>0; + + Nt=512 + + phase=2*np.pi*wfe; #% wavefront phase in radians + + #%generalized pupil function of channel1; + pk=pupil*np.exp(cmath.sqrt(-1)*(phase)) + + pf=dft2(pk, Q, Nt) + + pf2 = abs(pf)**2 + psfout=pf2/pf2.sum() + + cx,cy=centroid(psfout) + + psf=ndimage.shift(psfout,[Nt/2-1-cy, Nt/2-1-cx],order=1, mode='nearest' ) + + return psf +######################################################################## + +def cal_PSF_new(channel,wfetimes,oversampling): + # filed postion: Ra=ys1, Dec=ys2 + + ############ use opd cal PSF on the defined field; + #% psf interpolation test 20210207 + # xfmin=-0.07 # % the filed minmum value in the x direction in degrees + # xfmax= 0.07 #% the filed maxmum value in the x direction in degrees + # yfmin=-0.35 #% the filed minmum value in the y direction in degrees + # yfmax=-0.49 # % the filed maxmum value in the y direction in degrees + + cfx= 0.2*3600; # % field center in x derection in arcsec; + cfy= -0.45*3600; # % field center in y derection in arcsec; + + #wavelength=[255,337,419,501,583,665,747,829,911,1000] + + cwave=dict() + + if channel == 'g': + cwave[channel]=475 + waven=4 + if channel == 'r': + cwave[channel]=625 + waven=6 + if channel == 'i': + cwave[channel]=776 + waven=7 + + n=np.arange(1,101,1) + + ffx= 0.1+ 0.02222222*((n-1)%10) + ffy=-0.35-0.02222222*np.floor((n-0.1)/10) + + psf=dict() + fx=dict() + fy=dict() + fx[channel]=ffx*3600-cfx + + fy[channel]=ffy*3600-cfy + + Nt=512 + + psf[channel]=np.zeros((len(n),Nt,Nt)) + + for i in range(len(n)): + #waven + # waven=4 + # fieldn=10 + file='../MCI_inputData/MCI_wavefront/wave_'+str(waven+1)+'/wavefront/opd_'+str(i+1)+'.mat' + data=sio.loadmat(file) + opd=data['opd'] ## opd data; + psf[channel][i,:,:]=opd2psf(wfetimes*opd, cwave[channel],oversampling) + + + hdu1=fits.PrimaryHDU(psf[channel]) + + hdu1.header.append(('channel', channel, 'MCI PSF channel')) + + + hdu1.header['pixsize']=(0.05/oversampling, 'PSF pixel size in arcsec') + + hdu1.header['wfetimes']=(wfetimes, 'wavefront error magnification to CSST primary wavefront ') + + dtime=datetime.datetime.utcnow().strftime('%Y -%m -%d %H: %M: %S') + hdu1.header.add_history('PSF is generated on :'+dtime) + + hdu2=fits.ImageHDU(fx[channel]) + + hdu2.header.append(('field_X', 'arcsec')) + + hdu3=fits.ImageHDU(fy[channel]) + + hdu3.header.append(('field_Y', 'arcsec')) + + newd=fits.HDUList([hdu1,hdu2,hdu3]) + + PSFfilename='../MCI_inputData/PSF/PSF_'+channel+'.fits' + + newd.writeto(PSFfilename,overwrite=True) + + return +############################################################################# + + +def cal_Filter_PSF(wfetimes): + # filed postion: Ra=ys1, Dec=ys2 + + ############ use opd cal PSF on the defined field; + #% psf interpolation test 20210207 + # xfmin=-0.07 # % the filed minmum value in the x direction in degrees + # xfmax= 0.07 #% the filed maxmum value in the x direction in degrees + # yfmin=-0.35 #% the filed minmum value in the y direction in degrees + # yfmax=-0.49 # % the filed maxmum value in the y direction in degrees + oversampling=2 + + cfx= 0.2*3600; # % field center in x derection in arcsec; + cfy= -0.45*3600; # % field center in y derection in arcsec; + + wavelist =np.array([255, 337,419,501,583,665,747,829,911,1000]) + + filterP=np.load('../MCI_inputData/MCI_filters/mci_filterPWTC.npy',allow_pickle=True).item() + + fn=np.arange(1,101,1) ### PSF field point + ffx= 0.1+ 0.02222222*((fn-1)%10) + ffy=-0.35-0.02222222*np.floor((fn-0.1)/10) + + psf=dict() + fx=dict() + fy=dict() + fx=ffx*3600-cfx + fy=ffy*3600-cfy + Nt=512 + + + for filterk in filterP.keys(): + filtername=filterk + print(filtername) + + filterwaveC=filterP[filterk]['Clambda'] + filterFwhm=filterP[filterk]['FWHM'] + + fdis=abs(filterwaveC-wavelist) + + findex=np.argsort(fdis) + + waven=findex[0] + + psf[filtername]=dict() + + psf[filtername]['psf_field_X'] =fx + psf[filtername]['psf_field_Y'] =fy + psf[filtername]['psf_scale'] =0.05/oversampling + psf[filtername]['wfetimes'] =wfetimes + psf[filtername]['psf_mat'] =np.zeros( (Nt,Nt,7,len(fn)) ) + psf[filtername]['filter_name'] =filtername + psf[filtername]['filter_channel']=filterP[filterk]['channel'] + psf[filtername]['psf_iwave'] =np.zeros(7) + + for ii in range(len(fn)): + #waven + # waven=4 + # fieldn=10 + file='../MCI_input/MCI_wavefront/wave_'+str(waven+1)+'/wavefront/opd_'+str(ii+1)+'.mat' + data=sio.loadmat(file) + opd=data['opd'] ## opd data; + for kk in range(7): + ### + wavek=filterwaveC+filterFwhm*(kk-3)*0.25 + + psfd=opd2psf(wfetimes*opd, wavek, oversampling) + + psf[filtername]['psf_mat'][:,:,kk,ii]=psfd[:,:] + + if ii==0: + psf[filtername]['psf_iwave'][kk]=wavek + + np.save('../MCI_inputData/PSF/'+filtername+'_PSF.npy', psf[filtername]) + + return + ######################################################################### @@ -479,7 +1149,7 @@ def findNeighbors(tx, ty, px, py, dn=5): ############################################################################### ###PSF-IDW### -def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=5, OnlyNeighbors=True): +def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, dn=5, IDWindex=3, OnlyNeighbors=True): """ psf interpolation by IDW @@ -499,24 +1169,21 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=5, OnlyNeighbors=Tru ref_row = py ### target position in y ngy, ngx = PSFMat[:, :, 0, 0].shape ### PSF data size - npsf = PSFMat[:, :, :,:].shape[3] ### total psf number in one wavelength - psfWeight = np.zeros([npsf]) + + #################################### + ####### my code ###### + psfWeight = np.zeros([dn]) if OnlyNeighbors == True: - neigh = findNeighbors(px, py, cen_col, cen_row, dn=5) - # if hoc is not None: - # neigh = findNeighbors_hoclist(cen_col, cen_row, tx=px,ty=py, dn=4, hoc=hoc, hoclist=hoclist) - - neighFlag = np.zeros(npsf) - neighFlag[neigh] = 1 - - for ipsf in range(npsf): - if OnlyNeighbors == True: - if neighFlag[ipsf] != 1: - continue + neigh = findNeighbors(px, py, cen_col, cen_row, dn) + + ####################################################################### + for ipsf in range(len(neigh)): - dist = np.sqrt((ref_col - cen_col[ipsf])**2 + (ref_row - cen_row[ipsf])**2) + idx=neigh[ipsf] + dist = np.sqrt((ref_col - cen_col[idx])**2 + (ref_row - cen_row[idx])**2) + if IDWindex == 1: psfWeight[ipsf] = dist if IDWindex == 2: @@ -525,30 +1192,35 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=5, OnlyNeighbors=Tru psfWeight[ipsf] = dist**3 if IDWindex == 4: psfWeight[ipsf] = dist**4 + if IDWindex == 5: + psfWeight[ipsf] = dist**5 psfWeight[ipsf] = max(psfWeight[ipsf], minimum_psf_weight) psfWeight[ipsf] = 1./psfWeight[ipsf] + ##################################3 + psfWeight /= np.sum(psfWeight) psfMaker = np.zeros([ngy, ngx, 7 ], dtype=np.float32) - + ######################################################### for waven in range(7): - for ipsf in range(npsf): - if OnlyNeighbors == True: - if neighFlag[ipsf] != 1: - continue + for ipsf in range(len(neigh)): - iPSFMat = PSFMat[:, :, waven,ipsf].copy() + idx=neigh[ipsf] + + iPSFMat = PSFMat[:, :, waven,idx].copy() + ipsfWeight = psfWeight[ipsf] psfMaker[:, :, waven] += iPSFMat * ipsfWeight psfMaker[:, :, waven] /= np.nansum(psfMaker[:, :, waven]) - - return psfMaker + + + return psfMaker ############################################################################### ############################################################################### @@ -570,26 +1242,48 @@ class MCIsimulator(): :type opts: OptionParser instance """ - def __init__(self, opts): + def __init__(self, configfile): """ Class Constructor. :param opts: OptionParser instance :type opts: OptionParser instance """ - self.configfile = opts.configfile - - if opts.section is None: - ####self.section = 'DEFAULT' - self.section = 'TEST' #####simulation section; - else: - self.section = opts.section - - + self.configfile = configfile + self.section = 'TEST' #####simulation section; + #load instrument model, these values are also stored in the FITS header + self.information = MCIinstrumentModel.MCIinformation() + self.information['G_filters']=["F275W", "F280N","NUV", "WU", "CBU", "F343N", "u", "F373N", "F395N", "F336W"] + self.information['R_filters']=["F487N", "F502N", "CBV", "r", "F656N", "F658N", "F467M", "F555W", "F606W", "F673N"] + self.information['I_filters']=["z", "y", "F815N", "CBI", "F925N", "F960M", "F968N", "F845M" ,"F850LP" ,"F814W"] + + #### load telescope efficiency data + self.tel_eff=np.load('../MCI_inputData/tel_eff/tel_eff.npy',allow_pickle=True).item() + + #### load MCI filter data + self.filterP=np.load('../MCI_inputData/MCI_filters/mci_filterPWTC.npy',allow_pickle=True).item() + ########################################################################### + now=datetime.utcnow() + #data_time=now.strftime("%Y-%m-%d-%H-%M-%S") + result_day=now.strftime("%Y-%m-%d") + #self.result_path='../MCI_simData_'+result_day + + if os.getcwd() =='/home/zjyan/work/MCI/simulator': + self.result_path='/data/mci_simData/'+result_day ### CSST1 + else: + self.result_path='/home/yan/MCI/simData/'+result_day ### my PC + + if os.path.isdir(self.result_path)==False: + os.mkdir(self.result_path) + os.mkdir(self.result_path+'/cali_Data') + os.mkdir(self.result_path+'/log_Data') + os.mkdir(self.result_path+'/ori_Cali') + os.mkdir(self.result_path+'/ori_Sky') + os.mkdir(self.result_path+'/sky_Data') + os.mkdir(self.result_path+'/PSF_Data') - self.information = MCIinstrumentModel.MCIinformation() #update settings with defaults self.information.update(dict(quadrant=int(0), ccdx=int(0), @@ -599,41 +1293,49 @@ class MCIsimulator(): xsize=2000, ysize=2000, fullwellcapacity=90000, + pixel_size=0.05, dark=0.001, exptime=300.0, readouttime=4., rdose=8.0e9, ghostCutoff=22.0, ghostRatio=5.e-5, - coveringfraction=1.0, - pixel_size=0.05)) - - - self.configure(1) #print the configfile name and path; - - self.information.update(dict( - - cosmicraylengths =self.information['indata_path']+'/data/cdf_cr_length.dat', - cosmicraydistance=self.information['indata_path']+'/data/cdf_cr_total.dat', - parallelTrapfile =self.information['indata_path']+'/data/cdm_euclid_parallel.dat', - serialTrapfile =self.information['indata_path']+'/data/cdm_euclid_serial.dat', - cosmeticsfile_g =self.information['indata_path']+'/data/Cosmetics_g.txt', - cosmeticsfile_r =self.information['indata_path']+'/data/Cosmetics_r.txt' , - cosmeticsfile_i =self.information['indata_path']+'/data/Cosmetics_i.txt' )) + coveringfraction=0.1, #CR: + cosmicraylengths =FOLDER+'MCI_inputData/data/cdf_cr_length.dat', + cosmicraydistance=FOLDER+'MCI_inputData/data/cdf_cr_total.dat', + parallelTrapfile =FOLDER+'MCI_inputData/data/cdm_euclid_parallel.dat', + serialTrapfile =FOLDER+'MCI_inputData/data/cdm_euclid_serial.dat', + mode='same')) ############################################################################### - def readConfigs(self,simnumber): + def readConfigs(self,simnumber,source): """ Reads the config file information using configParser and sets up a logger. """ self.config = ConfigParser.RawConfigParser() - + if simnumber==1: + print('beging config file name : ') + print(self.configfile) #self.config.readfp(open(self.configfile)) self.config.read_file(open(self.configfile)) + now=datetime.utcnow() + + data_time=now.strftime("%Y-%m-%d-%H-%M-%S") + + print('simnumber', simnumber) + self.log = lg.setUpLogger(self.result_path+'/log_Data/MCIsim_'+source+'_'+data_time+'_Num_'+str(simnumber)+'.log') + + #print('logger.handlers=', self.log.handlers) + + self.log.info('-------STARTING A NEW SIMULATION------------') + + self.log.info('The exposure order is %i ' % simnumber ) + + #self.log.info(self.information) ################################################################################################3 @@ -659,29 +1361,30 @@ class MCIsimulator(): self.information.update(settings) - - #ghost ratio can be in engineering format, so getfloat does not capture it... try: self.information['ghostRatio'] = float(self.config.get(self.section, 'ghostRatio')) except: pass - ######### + + ################################################################################################### + ################################################################################################## + #booleans to control the flow - self.cosmicRays = self.config.getboolean(self.section, 'cosmicRays') - self.darknoise = self.config.getboolean(self.section, 'darknoise') + self.cosmicRays = self.config.getboolean(self.section, 'cosmicRays') + self.darknoise = self.config.getboolean(self.section, 'darknoise') self.cosmetics = self.config.getboolean(self.section, 'cosmetics') self.radiationDamage = self.config.getboolean(self.section, 'radiationDamage') - self.bleeding = self.config.getboolean(self.section, 'bleeding') - self.overscans = self.config.getboolean(self.section, 'overscans') - self.nonlinearity = self.config.getboolean(self.section, 'nonlinearity') - self.readoutNoise = self.config.getboolean(self.section, 'readoutNoise') + self.bleeding = self.config.getboolean(self.section, 'bleeding') + self.overscans = self.config.getboolean(self.section, 'overscans') + self.nonlinearity = self.config.getboolean(self.section, 'nonlinearity') + self.readoutNoise = self.config.getboolean(self.section, 'readoutNoise') self.skyback = self.config.getboolean(self.section, 'skyback') self.TianceEffect = self.config.getboolean(self.section, 'TianceEffect') self.intscale = self.config.getboolean(self.section, 'intscale') - self.ghosts = self.config.getboolean(self.section, 'ghosts') + self.ghosts = self.config.getboolean(self.section, 'ghosts') self.shutterEffect =self.config.getboolean(self.section, 'shutterEffect') self.flatfieldM =self.config.getboolean(self.section, 'flatfieldm') self.PRNUeffect =self.config.getboolean(self.section, 'PRNUeffect') @@ -691,6 +1394,8 @@ class MCIsimulator(): self.sim_star =self.config.getboolean(self.section, 'sim_star') self.sim_galaxy =self.config.getboolean(self.section, 'sim_galaxy') + self.save_starpsf =self.config.getboolean(self.section, 'save_starpsf') + self.save_cosmicrays =self.config.getboolean(self.section, 'save_cosmicrays') ###############################################3################################# self.booleans = dict(cosmicRays =self.cosmicRays, @@ -704,7 +1409,7 @@ class MCIsimulator(): skyback =self.skyback, TianceEffect =self.TianceEffect, intscale =self.intscale, - ghosts =self.ghosts , + ghosts =self.ghosts , shutterEffect =self.shutterEffect, flatfieldM =self.flatfieldM, PRNUeffect =self.PRNUeffect, @@ -712,58 +1417,17 @@ class MCIsimulator(): sky_shift_rot =self.sky_shift_rot, distortion =self.distortion, sim_star =self.sim_star, - sim_galaxy =self.sim_galaxy) - ##################################################################### - - - now=datetime.now() - #data_time=now.strftime("%Y-%m-%d-%H-%M-%S") - result_day=now.strftime("%Y-%m-%d") - - self.result_path=self.information['result_path']+'/'+result_day ### CSST1 - - - if os.path.isdir(self.result_path)==False: - os.mkdir(self.result_path) - os.mkdir(self.result_path+'/cali_Data') - os.mkdir(self.result_path+'/log_Data') - os.mkdir(self.result_path+'/sky_Data') - ############################################################# - - - data_time=now.strftime("%Y-%m-%d-%H-%M-%S") - - - self.log = lg.setUpLogger(self.result_path+'/log_Data/MCIsim_'+'_'+data_time+'.log') - - - self.log.info('-------STARTING A NEW SIMULATION------------') - - - self.log.info(self.information) - - ############################################## - #load instrument model, these values are also stored in the FITS header - - self.information['G_filters']=["F275W", "F280N","NUV", "WU", "CBU", "F343N", "u", "F373N", "F395N", "F336W"] - self.information['R_filters']=["F487N", "F502N", "CBV", "r", "F656N", "F658N", "F467M", "F555W", "F606W", "F673N"] - self.information['I_filters']=["z", "y", "F815N", "CBI", "F925N", "F960M", "F968N", "F845M" ,"F850LP" ,"F814W"] - - #### load telescope efficiency data - self.tel_eff=np.load(self.information['indata_path']+'/tel_eff/tel_eff.npy',allow_pickle=True).item() - - #### load MCI filter data - self.filterP=np.load(self.information['indata_path']+'/MCI_filters/mci_filterPWTC.npy',allow_pickle=True).item() - - - ##################################################################### - - self.log.info('Using the following input values:') - for key, value in self.information.items(): - self.log.info('%s = %s' % (key, value)) - self.log.info('Using the following booleans:') - for key, value in self.booleans.items(): - self.log.info('%s = %s' % (key, value)) + sim_galaxy =self.sim_galaxy, + save_starpsf =self.save_starpsf, + save_cosmicrays =self.save_cosmicrays ) + ##################################################################### + + # self.log.info('Using the following input values:') + # for key, value in self.information.items(): + # self.log.info('%s = %s' % (key, value)) + # self.log.info('Using the following booleans:') + # for key, value in self.booleans.items(): + # self.log.info('%s = %s' % (key, value)) return @@ -788,15 +1452,36 @@ class MCIsimulator(): Creates lensing parameters; """ - self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) + self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) return ######################################################################################################################### ######################################################################################################### + def smoothingWithChargeDiffusion(self, image, sigma=(0.32, 0.32)): + """ + Smooths a given image with a gaussian kernel with widths given as sigmas. + This smoothing can be used to mimic charge diffusion within the CCD. + + The default values are from Table 8-2 of CCD_273_Euclid_secification_1.0.130812.pdf converted + to sigmas (FWHM / (2sqrt(2ln2)) and rounded up to the second decimal. + + .. Note:: This method should not be called for the full image if the charge spreading + has already been taken into account in the system PSF to avoid float counting. + + :param image: image array which is smoothed with the kernel + :type image: ndarray + :param sigma: widths of the gaussian kernel that approximates the charge diffusion [0.32, 0.32]. + :param sigma: tuple + + :return: smoothed image array + :rtype: ndarray + """ + return ndimage.filters.gaussian_filter(image, sigma) + def _loadGhostModel(self): """ @@ -835,12 +1520,12 @@ class MCIsimulator(): ############################################################################### ############################################################################### - def configure(self,simnumber): + def configure(self,simnumber,source): """ Configures the simulator with input information and creates and empty array to which the final image will be build on. """ - self.readConfigs(simnumber) + self.readConfigs(simnumber,source) self.processConfigs() @@ -862,13 +1547,13 @@ class MCIsimulator(): self.filter_psf=dict() filtername=self.filter_g - self.filter_psf['g']=np.load(self.information['indata_path']+'/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() + self.filter_psf['g']=np.load('../MCI_inputData/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() filtername=self.filter_r - self.filter_psf['r']=np.load(self.information['indata_path']+'/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() + self.filter_psf['r']=np.load('../MCI_inputData/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() filtername=self.filter_i - self.filter_psf['i']=np.load(self.information['indata_path']+'/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() + self.filter_psf['i']=np.load('../MCI_inputData/PSF/'+filtername+'_PSF.npy', allow_pickle=True).item() return @@ -983,17 +1668,17 @@ class MCIsimulator(): wave = np.linspace(2500,11000, 8501) # set the wavelenth for MCI from 250nm to 1100nm - wavearr =self.earthshine_wave # A - fluxarr =self.earthshine_flux # erg/s/cm^2/A/arcsec^2 - earthshinefluxarr=np.interp(wave, wavearr, fluxarr) # erg/s/cm^2/A/arcsec^2 + # wavearr =self.earthshine_wave # A + # fluxarr =self.earthshine_flux # erg/s/cm^2/A/arcsec^2 + # earthshinefluxarr=np.interp(wave, wavearr, fluxarr) # erg/s/cm^2/A/arcsec^2 - wavearr =self.zodiacal_wave # A - fluxarr =self.zodiacal_flux # erg/s/cm^2/A/arcsec^2 - zodiacalfluxarr=np.interp(wave, wavearr, fluxarr) # erg/s/cm^2/A/arcsec^2 + # wavearr =self.zodiacal_wave # A + # fluxarr =self.zodiacal_flux # erg/s/cm^2/A/arcsec^2 + # zodiacalfluxarr=np.interp(wave, wavearr, fluxarr) # erg/s/cm^2/A/arcsec^2 - skynoise_flux=earthshinefluxarr+zodiacalfluxarr # erg/s/cm^2/A/arcsec^2 + skynoise_flux=self.earthshine_flux+self.zodiacal_flux # erg/s/cm^2/A/arcsec^2 - wave = np.linspace(2500,10000,8501) # set the wavelenth for MCI from 250nm to 1100nm + wave=wave/10 # data: input data, two-dimentional, unit : 1e-17 erg/s/A/cm^2 @@ -1053,33 +1738,50 @@ class MCIsimulator(): pixelscale=self.information['pixel_size'] ## arcsec, pixel scale size ghostOffsetX =self.information['ghostoffsetx'] - ghostOffsetY =self.information['ghostoffsety'] - ghostMx =self.information['ghostratio'] + ghostOffsetY=self.information['ghostoffsety'] + ghostMx=self.information['ghostratio'] rotTelPos=self.information['rotTelPos'] rotSkyPos=self.information['rotSkyPos'] theta = rotTelPos - rotSkyPos - ############ load star data catlog ##################### - - df0=pd.read_csv(self.information['indata_path']+'/star_input/GaiaSource_675688-675713.csv') + ############ load star data catlog ##################### + starcat='selection_MACSJ0744.9 3927_20230517_concat.csv' + #starcat='selection_yuyong20230609_sim.csv' + + self.log.info('Stat catlog file name is %s' % (starcat)) + + df0=pandas.read_csv(self.information['dir_path']+'MCI_inputData/star_input/'+starcat) #### - df=df0.fillna(1000) - df2=df[ (df['phot_rp_mean_mag']>16)&(df['phot_bp_mean_mag']>16) & (df['phot_bp_mean_mag']<31) & (df['pmra']<100) & (df['phot_rp_mean_mag']<31)] + #df=df0.fillna(1000) + #df2=df[ (df['phot_rp_mean_mag']>16)&(df['phot_bp_mean_mag']>16) & (df['phot_bp_mean_mag']<31) & (df['pmra']<100) & (df['phot_rp_mean_mag']<31)] + #df2=df[ (df['umag']>16)&(df['zmag']>16) ] - df2.index = range(len(df2)) + #df2.index = range(len(df2)) ## limit the filed of view to 600*600 arcsec^2 square zone; - df3=df2[ (abs(df2['ra']-df2['ra'].mean())<300/3600.0) & (abs(df2['dec']-df2['dec'].mean())<300/3600.0) ] + df2=df0 + df3=df2[ (abs(df2['ra_gaia']-df2['ra_gaia'].mean())<400/3600.0) & (abs(df2['dec_gaia']-df2['dec_gaia'].mean())<400/3600.0) ] df3.index = range(len(df3)) + + np.save('umag.npy', df3['umag'] ) + + + + + self.star=df3 - del df0,df,df2,df3 + del df0,df2,df3 + + self.information['ra_obj'] = self.star['ra_gaia'].mean() + self.information['dec_obj'] = self.star['dec_gaia'].mean() - self.information['ra_obj'] = self.star['ra'].mean() - self.information['dec_obj'] = self.star['dec'].mean() + + self.information['star_ra'] = self.information['ra_obj'] + self.information['star_dec']= self.information['dec_obj'] center_ra =self.information['T_disRa'] +self.information['ra_obj'] center_dec=self.information['T_disDec'] +self.information['dec_obj'] @@ -1089,9 +1791,127 @@ class MCIsimulator(): channel=['g','r','i'] ####################################################################### - - nsrcs=len(self.star) + #################### cal_PSF_array ################################# + + + if self.save_starpsf: + + self.log.info('calculate and save star PSF data......') + + primary_g=fits.PrimaryHDU() + PSF_g=fits.HDUList([primary_g]) + + primary_r=fits.PrimaryHDU() + PSF_r=fits.HDUList([primary_r]) + + primary_i=fits.PrimaryHDU() + PSF_i=fits.HDUList([primary_i]) + + fov=0.05*min(self.information['xsize'],self.information['ysize']) + + dec_arr,ra_arr=make_c_coor(fov,25) + + k=0; + + ####################################################################### + for ii in range(len(ra_arr)): + for jj in range(len(ra_arr)): + + ################################################################## + + galRa = ra_arr[ii,jj] +center_ra*3600 # ra of PFS, arcsecond + galDec = dec_arr[ii,jj]+center_dec*3600 # dec of PSF, arcsecond + + fsx,fsy=cal_pos(center_ra,center_dec, rotTelPos, rotSkyPos, galRa, galDec) + + ############# do field distottion ########## + + if self.distortion: + + for i in range(3): + ch=channel[i] + fpx,fpy=distortField(fsx, fsy, ch) + + else: + + fpx=fsx + fpy=fsy + + ################################################################### + + psf=dict() + + for i in range(3): + + ch=channel[i] + + psfmat=self.get_PSF(fpx, fpy, ch) + + temp=0 + + for iwave in range(7): + temp=temp+1/7.0*psfmat[:,:,iwave] + + temp=temp/temp.sum() + + ####rotate the PSF data + if abs(theta.deg)>0: + psf[ch]=ndimage.rotate(temp, theta.deg, order=1, reshape=False) # here we choose reshape=False, the rotated image will + else: + psf[ch]=temp + ################################### + + hdu_g=fits.ImageHDU(psf['g']) + hdu_g.header['ra'] = ra_arr[ii,jj] + hdu_g.header['dec'] = dec_arr[ii,jj] + hdu_g.header['rot_deg']=-theta.deg + PSF_g.append(hdu_g) + ################################### + hdu_r=fits.ImageHDU(psf['r']) + hdu_r.header['ra'] = ra_arr[ii,jj] + hdu_r.header['dec'] = dec_arr[ii,jj] + hdu_r.header['rot_deg']=-theta.deg + PSF_r.append(hdu_r) + ################################### + hdu_i=fits.ImageHDU(psf['i']) + hdu_i.header['ra'] = ra_arr[ii,jj] + hdu_i.header['dec']= dec_arr[ii,jj] + hdu_i.header['rot_deg']=-theta.deg + PSF_i.append(hdu_i) + ################################### + del hdu_g + del hdu_r + del hdu_i + k=k+1 + + ############################################ + file_g=self.result_path+'/PSF_Data/'+'PSF_sim_No.'+str(self.information['simnumber'])+'_C1.fits' + PSF_g.writeto(file_g,overwrite=True) + + file_r=self.result_path+'/PSF_Data/'+'PSF_sim_No.'+str(self.information['simnumber'])+'_C2.fits' + PSF_r.writeto(file_r,overwrite=True) + + file_i=self.result_path+'/PSF_Data/'+'PSF_sim_No.'+str(self.information['simnumber'])+'_C3.fits' + PSF_i.writeto(file_i,overwrite=True) + + del PSF_g + del PSF_r + del PSF_i + ########## finish save PSF fits ########################################## + ############################################################################ + ###### add binary stars to the star catlog ####### + binary_star=np.array([[-0.05, 20, 20.5, 20, 19.5, 19, 18.8], + [-0.12, 20, 20.5, 20, 19.5, 19, 18.8], + [-5.45, 20, 20.5, 20, 19.5, 19, 18.8], + [-5.55, 20, 20.5, 20, 19.5, 19, 18.8], + [-10.05, 20, 20.5, 20, 19.5, 19, 18.8], + [-10.17, 20, 20.5, 20, 19.5, 19, 18.8], + [-15.45, 20, 20.5, 20, 19.5, 19, 18.8], + [-15.60, 20, 20.5, 20, 19.5, 19, 18.8]]) + + + nsrcs=len(self.star['ra_gaia']) + 8 ################################################################## obj=dict() obj['g']=np.zeros(3) @@ -1121,11 +1941,64 @@ class MCIsimulator(): final_image['i'].setOrigin(0,0) ####################################################################### nlayccd = 0 - - #### calculate sky noise ##### - self.earthshine(self.earthshine_theta) - self.zodiacal(self.information['ra_obj'], self.information['dec_obj'], self.dt.strftime("%Y-%m-%d")) + ############################################ + #### calculate sky noise , old code ##### + # self.earthshine(self.earthshine_theta) + + # self.zodiacal(self.information['ra_obj'], self.information['dec_obj'], self.dt.strftime("%Y-%m-%d")) + + ############### calculate the earthshine and zodiacal noise ,new code 2023.11.1 ############ + ############### + # self.earthshine(self.earthshine_theta) + # self.zodiacal(self.information['ra_obj'], self.information['dec_obj'], self.zodiacal_time) + + ra = self.information['ra_pnt0'] + dec = self.information['dec_pnt0'] + + time_jd=time2jd(self.dt) + + x_sat=float(self.orbit_pars[self.orbit_exp_num,1]) + y_sat=float(self.orbit_pars[self.orbit_exp_num,2]) + z_sat=float(self.orbit_pars[self.orbit_exp_num,3]) + + wave0, zodi0 = zodiacal(ra, dec, self.TianCe_day) # erg/s/cm^2/A/arcsec^2 + + # EarthShine from straylight + sl = StrayLight(jtime=time_jd, sat=np.array([x_sat, y_sat, z_sat]), + radec=np.array([(ra*u.degree).value, (dec*u.degree).value])) + + earth_e = sl.caculateEarthShineFilter(filter='r') + star_e = sl.caculateStarLightFilter(filter='r') + angle_earth = earth_angle(time_jd, x_sat, y_sat, z_sat, ra, dec) + + if angle_earth < 0: + earth_e = 0 + + earthshine_wave0, earthshine_flux0 = ill2flux(earth_e+star_e) + + # sample as ifs wavelength + wave_mci = np.linspace(2500, 11000, 8501) #np.arange(2500, 11000, 1) + f1 = interp1d(wave0, zodi0) + zodi_mci = f1(wave_mci) + + f2 = interp1d(earthshine_wave0, earthshine_flux0) + earthshine_mci = f2(wave_mci) + + # df = pd.DataFrame({'wave': wave_ifs, + # 'zodi': zodi_ifs, + # 'earthshine': earthshine_ifs}) + + self.zodiacal_wave = wave_mci # in A + self.zodiacal_flux = zodi_mci + + self.earthshine_wave = wave_mci # A + self.earthshine_flux = earthshine_mci + + ######################################################################################## + + + ######################################################################################### self.cal_sky_noise() @@ -1148,41 +2021,102 @@ class MCIsimulator(): ####################################################################### if self.TianceEffect: - ra_list = self.star['ra'].tolist() - dec_list = self.star['dec'].tolist() - pmra_list = self.star['pmra'].tolist() - pmdec_list = self.star['pmdec'].tolist() - parallax_list = self.star['parallax'].tolist() + ra_list = self.star['ra_gaia'].tolist() + dec_list = self.star['dec_gaia'].tolist() + pmra_list = self.star['pmra_gaia'].tolist() + pmdec_list = self.star['pmdec_gaia'].tolist() + parallax_list = self.star['parallax_gaia'].tolist() rv_list = [0.0 for i in range(len(ra_list))] - ################################################ - + ################################################ newRa, newDec = shao.onOrbitObsPosition(ra_list, dec_list, pmra_list, \ pmdec_list, rv_list, parallax_list, len(ra_list), \ self.information['pos_x'], self.information['pos_y'], self.information['pos_z'], self.information['velocity_x'],self.information['velocity_y'],self.information['velocity_z'], "J2000", self.TianCe_day, self.TianCe_exp_start) else: - newRa =self.star['ra'] - newDec =self.star['dec'] + newRa =self.star['ra_gaia'] + newDec =self.star['dec_gaia'] ###################################################### + + st_ra=[] + st_dec =[] + st_phot_C1=[] + st_phot_C2=[] + st_phot_C3=[] + + st_posX_C1=[] + st_posX_C2=[] + st_posX_C3=[] + + st_posY_C1=[] + st_posY_C2=[] + st_posY_C3=[] + + st_magu=[] + st_magg=[] + st_magr=[] + st_magi=[] + st_magz=[] + + #################### generate star image ########## - for j in tqdm(range(nsrcs)): ### nsrcs length + + if self.debug: + nstar=100 + else: + nstar=nsrcs + + sim_binary_star=False + + if sim_binary_star: + Nstar=nstar + else: + Nstar=nstar-8 + + for j in tqdm(range(Nstar)): ### nsrcs length - starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond - starDec = 3600.0*( newDec[j] ) # dec of star, arcsecond - + if j=self.information['ysize']+100 or row<=-100 or col>=self.information['xsize']+100 or col <=-100: continue nlayccd=nlayccd+1 + + if self.debug: + if nlayccd>10: + continue + + st_ra.append( np.float64(starRa/3600.0)) + st_dec.append(np.float64(starDec/3600.0)) + ################################################################ for i in range(3): ### @@ -1225,39 +2159,81 @@ class MCIsimulator(): # SED of j-th star if j0.1/1500: + if ghostphotons.flux.max()>0.01: ghostphotons.addTo(final_image[ch]) - - ######################################################### - photons.x=photons.x/0.05+gy[ch] - photons.y=photons.y/0.05+gx[ch] - - photons.addTo(final_image[ch]) - - - ############################################################### + ############################################################### - #print('total star nummber on CCD is: ',nlayccd ) + print('total star nummber on CCD is: ',nlayccd ) + + tab=Table() + tab['st_ra'] =np.asarray(st_ra) + tab['st_dec'] =np.asarray(st_dec) + + tab['phot_C1']=np.asarray(st_phot_C1) + tab['phot_C2']=np.asarray(st_phot_C2) + tab['phot_C3']=np.asarray(st_phot_C3) + + tab['posX_C1']=np.asarray(st_posX_C1) + tab['posX_C2']=np.asarray(st_posX_C2) + tab['posX_C3']=np.asarray(st_posX_C3) + + tab['posY_C1']=np.asarray(st_posY_C1) + tab['posY_C2']=np.asarray(st_posY_C2) + tab['posY_C3']=np.asarray(st_posY_C3) + + + tab['st_magu']=np.asarray(st_magu) + tab['st_magg']=np.asarray(st_magg) + tab['st_magr']=np.asarray(st_magr) + tab['st_magi']=np.asarray(st_magi) + tab['st_magz']=np.asarray(st_magz) + + + + ###################################33 + + + file=self.result_path+'/log_Data/star_info'+'_SN_'+str(self.information['simnumber'])+'.fits' + tab.write(file,overwrite=True) ################################################################# - - ####################################################################### + ################################################################# fullimg['g']=final_image['g'].array fullimg['r']=final_image['r'].array @@ -1375,19 +2388,19 @@ class MCIsimulator(): """ # read solar template - solar_template = pd.read_csv(self.information['indata_path']+'/refs/solar_spec.dat', sep='\s+', + solar_template = pd.read_csv('../MCI_inputData/refs/solar_spec.dat', sep='\s+', header=None, comment='#') template_wave = solar_template[0].values template_flux = solar_template[1].values # read earth shine surface brightness - earthshine_curve = pd.read_csv(self.information['indata_path']+'/refs/earthshine.dat', + earthshine_curve = pd.read_csv('../MCI_inputData/refs/earthshine.dat', header=None, comment='#') angle = earthshine_curve[0].values surface_brightness = earthshine_curve[1].values # read V-band throughtput - cat_filter_V = pd.read_csv(self.information['indata_path']+'/refs/filter_Bessell_V.dat', sep='\s+', + cat_filter_V = pd.read_csv('../MCI_inputData/refs/filter_Bessell_V.dat', sep='\s+', header=None, comment='#') filter_wave = cat_filter_V[0].values filter_response = cat_filter_V[1].values @@ -1435,7 +2448,9 @@ class MCIsimulator(): # get solar position dt = datetime.fromisoformat(time) - jd = julian.to_jd(dt, fmt='jd') + ###jd = julian.to_jd(dt, fmt='jd') + + jd = time2jd(dt) t = Time(jd, format='jd', scale='utc') astro_sun = get_sun(t) @@ -1452,25 +2467,21 @@ class MCIsimulator(): lamda = abs(lb_obj.lon.degree - lb_sun.lon.degree) # interpolated zodical surface brightness at 0.5 um - zodi = pd.read_csv(self.information['indata_path']+'/refs/zodi_map.dat', sep='\s+', header=None, comment='#') + zodi = pd.read_csv('../MCI_inputData/refs/zodi_map.dat', sep='\s+', header=None, comment='#') beta_angle = np.array([0, 5, 10, 15, 20, 25, 30, 45, 60, 75]) lamda_angle = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]) xx, yy = np.meshgrid(beta_angle, lamda_angle) - #xx, yy = np.meshgrid(beta_angle, lamda_angle,indexing='ij', sparse=True) - f = interpolate.interp2d(xx, yy, zodi, kind='linear') - #f = interpolate.RegularGridInterpolator((xx, yy), zodi, method='linear') - - zodi_obj = f(beta, lamda) # + zodi_obj = f(beta, lamda) # 10^�? W m�? sr�? um�? # read the zodical spectrum in the ecliptic - cat_spec = pd.read_csv(self.information['indata_path']+'/refs/solar_spec.dat', sep='\s+', header=None, comment='#') + cat_spec = pd.read_csv('../MCI_inputData/refs/solar_spec.dat', sep='\s+', header=None, comment='#') wave = cat_spec[0].values # A - spec0 = cat_spec[1].values # - zodi_norm = 252 # + spec0 = cat_spec[1].values # 10^-8 W m^�? sr^�? μm^�? + zodi_norm = 252 # 10^-8 W m^�? sr^�? μm^�? - spec = spec0 * (zodi_obj / zodi_norm) * 1e-8 # + spec = spec0 * (zodi_obj / zodi_norm) * 1e-8 # W m^�? sr^�? μm^�? # convert to the commonly used unit of MJy/sr, erg/s/cm^2/A/sr wave_A = wave # A @@ -1498,11 +2509,12 @@ class MCIsimulator(): ### galaxy catlog information ra = 74.0563449685417 dec = -34.155241212932374 - # halo_id = 229600100382 - - self.information['star_ra'] = 249.70093286177536 - self.information['star_dec'] =-44.60485406119162 + # halo_id = 229600100382 + if self.sim_star ==False : + self.information['star_ra'] = ra + self.information['star_dec'] = dec + self.information['gal_ra'] = ra self.information['gal_dec']= dec @@ -1510,10 +2522,55 @@ class MCIsimulator(): self.information['dec_obj'] =self.information['star_dec'] ##################################################################### - self.earthshine(self.earthshine_theta) + # self.earthshine(self.earthshine_theta) - self.zodiacal(self.information['star_ra'], self.information['star_dec'], self.dt.strftime("%Y-%m-%d")) + # self.zodiacal(self.information['star_ra'], self.information['star_dec'], self.dt.strftime("%Y-%m-%d")) + ################################################################################## + ra = self.information['ra_pnt0'] + dec = self.information['dec_pnt0'] + time_jd=time2jd(self.dt) + + x_sat=float(self.orbit_pars[self.orbit_exp_num,1]) + y_sat=float(self.orbit_pars[self.orbit_exp_num,2]) + z_sat=float(self.orbit_pars[self.orbit_exp_num,3]) + + wave0, zodi0 = zodiacal(ra, dec, self.TianCe_day) # erg/s/cm^2/A/arcsec^2 + + # EarthShine from straylight + sl = StrayLight(jtime=time_jd, sat=np.array([x_sat, y_sat, z_sat]), + radec=np.array([(ra*u.degree).value, (dec*u.degree).value])) + + earth_e = sl.caculateEarthShineFilter(filter='r') + star_e = sl.caculateStarLightFilter(filter='r') + angle_earth = earth_angle(time_jd, x_sat, y_sat, z_sat, ra, dec) + + if angle_earth < 0: + earth_e = 0 + + earthshine_wave0, earthshine_flux0 = ill2flux(earth_e+star_e) + + # sample as ifs wavelength + wave_mci = np.linspace(2500, 11000, 8501) #np.arange(2500, 11000, 1) + f1 = interp1d(wave0, zodi0) + zodi_mci = f1(wave_mci) + + f2 = interp1d(earthshine_wave0, earthshine_flux0) + earthshine_mci = f2(wave_mci) + + # df = pd.DataFrame({'wave': wave_ifs, + # 'zodi': zodi_ifs, + # 'earthshine': earthshine_ifs}) + + self.zodiacal_wave = wave_mci # in A + self.zodiacal_flux = zodi_mci + + self.earthshine_wave = wave_mci # A + self.earthshine_flux = earthshine_mci + + ######################################################################################## + + ################################################################################## self.cal_sky_noise() ############ load galaxy data with SED ############################ @@ -1575,57 +2632,145 @@ class MCIsimulator(): final_image['i'].setOrigin(0,0) - #################################################################### + #################################################################### + + gal_ra=[]##.append(np.float64(galRa/3600.0)) + gal_dec=[]###.append(np.float64(galDec/3600.0)) + + phot_C1=[]##.append(intscales['g']) + phot_C2=[]###.append(intscales['r']) + phot_C3=[]###.append(intscales['i']) + + posX_C1=[]##.append(gx['g']) + posX_C2=[]#.append(gx['r']) + posX_C3=[]#.append(gx['i']) + + posY_C1=[]#.append(gy['g']) + posY_C2=[]#.append(gy['r']) + posY_C3=[]#.append(gy['i']) + + + gal_magu=[] + gal_magg=[] + gal_magr=[] + gal_magi=[] + gal_magz=[] + + ######################################## nlayccd = 0 ####################generate loc image - for k2 in (range(13)): ### + + if self.debug: + nk2=1 + else: + nk2=1 + + for k2 in (range(nk2)): ### print('k2=',k2) # - filename=self.information['indata_path']+'/galaxy_Input/Lens_SED_IMG_V3_0.025/Lens_img_cut_IMG_'+str(k2+1)+'.fits' + filename='../MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_IMG_'+str(k2+1)+'.fits' + self.log.info('galaxy_Input image path is: %s' %(filename)) + if not os.path.exists(filename): - #print('finish load all the input galaxy image fits files already') + print('finish load all the input galaxy image fits files') break srcs_cat=fits.open(filename) #### load galaxy SED fitsfile ### - filename=self.information['indata_path']+'/galaxy_Input/Lens_SED_IMG_V3_0.025/Lens_img_cut_SED_'+str(k2+1)+'.fits' - srcs_sed=fits.open(filename) + filename='../MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_SED_'+str(k2+1)+'.fits' + srcs_sed=fits.open(filename) - ################################################################### - for k1 in tqdm(range(1,len(srcs_cat))): - + self.log.info('galaxy_Input SED path is: %s' %(filename)) + + ###### do Tiance Effect ### + ra_list =[] + dec_list=[] + + + for kkk in range(1,len(srcs_cat)): + t1=srcs_cat[kkk].header['new_ra'] -self.information['gal_ra'] +self.information['star_ra'] + ra_list.append(t1) - galRa = 3600*(srcs_cat[k1].header['new_ra'] -self.information['gal_ra'] +self.information['star_ra']) # ra of galaxies, arcsecond - galDec = 3600*(srcs_cat[k1].header['new_dec']-self.information['gal_dec']+self.information['star_dec']) # dec of galaxies, arcsecond - + t2=srcs_cat[kkk].header['new_dec'] -self.information['gal_dec'] +self.information['star_dec'] + dec_list.append(t2) + + + if self.TianceEffect: + + pmra_list = [0.0 for i in range(len(ra_list))] + pmdec_list = [0.0 for i in range(len(ra_list))] + parallax_list = [0.0 for i in range(len(ra_list))] + rv_list = [0.0 for i in range(len(ra_list))] + + ################################################ + newRa, newDec = shao.onOrbitObsPosition(ra_list, dec_list, pmra_list, \ + pmdec_list, rv_list, parallax_list, len(ra_list), \ + self.information['pos_x'], self.information['pos_y'], self.information['pos_z'], self.information['velocity_x'],self.information['velocity_y'],self.information['velocity_z'], "J2000", self.TianCe_day, self.TianCe_exp_start) + else: + newRa =ra_list + newDec =dec_list + + + ############################################################################ + ################################################################### + for k1 in tqdm(range(len(newRa))): + + #print('k1=', k1) + + galRa = newRa[k1]*3600##*(srcs_cat[k1].header['new_ra'] -self.information['gal_ra'] +self.information['star_ra']) # ra of galaxies, arcsecond + galDec = newDec[k1]*3600####(srcs_cat[k1].header['new_dec']-self.information['gal_dec']+self.information['star_dec']) # dec of galaxies, arcsecond + #spa = srcs_cat[k1].header['spa'] + + + ########################################################################### + ############################################################################ + ### test code #### + # galRa=self.information['star_ra']*3600 + # galDec=self.information['star_dec']*3600 + ########### + # tx, ty = world_to_pixel(galRa/3600, + # galDec/3600, + # theta.deg, + # center_ra, + # center_dec, + # self.information['xsize']/2-0.5, + # self.information['ysize']/2-0.5, + # pixelsize=0.05) + ################################################################# fsx,fsy=cal_pos(center_ra,center_dec, rotTelPos, rotSkyPos, galRa, galDec) - row= fsy/losscale+self.information['ysize']/2-0.5 ### row number on CCD image, dec direction ,y direction - col= fsx/losscale+self.information['xsize']/2-0.5 ### col number on CCD image, ra direction, x direction + # row= fsy/losscale+self.information['ysize']/2-0.5 ### row number on CCD image, dec direction ,y direction + # col= fsx/losscale+self.information['xsize']/2-0.5 ### col number on CCD image, ra direction, x direction + - if row>=self.information['ysize']+100 or row<=-100 or col>=self.information['xsize']+100 or col <=-100: + if abs(fsx)>235 or abs(fsy)>235: continue + + # if row>=self.information['ysize']+200 or row<=-200 or col>=self.information['xsize']+200 or col <=-200: + # continue - # # SED of j-th galaxy ,# unit of 10-17 erg/s/A/cm2 - gal_flux=srcs_sed[k1].data + # # SED of j-th galaxy ,# unit of 10-17 erg/s/A/cm2 + gal_flux=srcs_sed[k1+1].data ## here is k1+1, not k1, k1 begins with 0 + + # print('nlaccd = ', nlayccd) ################################ ### rotate the lensed_images_g ### if abs(theta.deg)>0: - lensed_images_g=ndimage.rotate(srcs_cat[k1].data, -theta.deg, order=1, reshape=True) # here we choose reshape=False, the rotated image will + lensed_images_g=ndimage.rotate(srcs_cat[k1+1].data, -theta.deg, order=1, reshape=True) # here we choose reshape=False, the rotated image will else: - lensed_images_g=srcs_cat[k1].data + lensed_images_g=srcs_cat[k1+1].data + if lensed_images_g.sum()<=0: continue - nlayccd=nlayccd+1 ################################################################ for i in range(3): @@ -1633,7 +2778,7 @@ class MCIsimulator(): ch=channel[i] galaxy_input[ch][int(nlayccd)-1, 0] =fsx #ra galaxy_input[ch][int(nlayccd)-1, 1] =fsy #dec - # + #galaxy_input[ch][int(nlayccd)-1, 2] =mag[ch] # mag g ############# do field distottion ########## @@ -1646,40 +2791,80 @@ class MCIsimulator(): fpx,fpy=distortField(fsx, fsy, ch) obj[ch][0]=fpx obj[ch][1]=fpy - + #obj[ch][2]=mag[ch] + galaxy_output[ch][int(nlayccd)-1, 0] =fpx #ra galaxy_output[ch][int(nlayccd)-1, 1] =fpy #dec - + #galaxy_output[ch][int(nlayccd)-1, 2] =mag[ch] # mag g + + else: fpx=fsx fpy=fsy + for i in range(3): ch=channel[i] obj[ch][0]=fpx - obj[ch][1]=fpy - + obj[ch][1]=fpy + #obj[ch][2]=mag[ch] + galaxy_output[ch][int(nlayccd)-1, 0] =fpx #ra galaxy_output[ch][int(nlayccd)-1, 1] =fpy #dec - + #galaxy_output[ch][int(nlayccd)-1, 2] =mag[ch] # mag g ####################################################################### - - self.log.info('Galaxy number=%i, Ra(in arcsec)=%f, Dec(in arcsec)=%f' % (nlayccd, fpx, fpy)) - + #self.log.info('Galaxy number=%i, Ra(in arcsec)=%f, Dec(in arcsec)=%f' % (nlayccd, fpx, fpy)) + #self.log.info('Galaxy number=%i, Mag_g=%f, Mag_r=%f,Mag_i=%f' % (nlayccd, mag['g'],mag['r'],mag['i'])) + + #print('Flux sum =', gal_flux.sum()) + ##cal_SED_photons(self, flux_arr): intscales,PSF_eff_weight=self.cal_SED_photons(gal_flux) + + + ls_imgsum=lensed_images_g.sum() + + if intscales['g'].max()/ls_imgsum<0.1 and intscales['r'].max()/ls_imgsum<0.1 and intscales['i'].max()/ls_imgsum<0.1: + ######### + continue + ######## test code ########## + + if self.debug: + if nlayccd>10: + ######### + continue + + ############################33 img=dict() - lensed_images_g=lensed_images_g/lensed_images_g.sum() + lensed_images_g=lensed_images_g/ls_imgsum img['g']=lensed_images_g*intscales['g'] img['r']=lensed_images_g*intscales['r'] img['i']=lensed_images_g*intscales['i'] + if img['g'].max()<0.01 and img['r'].max()<0.01 and img['i'].max()<0.01: + ######### + continue + + + + nlayccd=nlayccd+1 + + + ####### test code only ######## + # img['g']=lensed_images_g + # img['r']=lensed_images_g + # img['i']=lensed_images_g + # print('------------------------------------') + # print('galaxy mag=',srcs_cat[k1].header['magu'] ,srcs_cat[k1].header['magg'] ,srcs_cat[k1].header['magr'],srcs_cat[k1].header['magi'],srcs_cat[k1].header['magz']) + # print('total photons=', intscales['g'],intscales['r'],intscales['i']) + # print('k1 =',k1) + ################################################ gx=dict() @@ -1692,7 +2877,43 @@ class MCIsimulator(): gy[ch]= obj[ch][1]/losscale+self.information['ysize']/2-0.5 ### row number on CCD image gx[ch]= obj[ch][0]/losscale+self.information['xsize']/2-0.5 ### col number on CCD image - ###################################################################### + ###################################################################### + + + + gal_ra.append(np.float64(galRa/3600.0)) + gal_dec.append(np.float64(galDec/3600.0)) + + phot_C1.append(intscales['g']) + phot_C2.append(intscales['r']) + phot_C3.append(intscales['i']) + + posX_C1.append(gx['g']) + posX_C2.append(gx['r']) + posX_C3.append(gx['i']) + + posY_C1.append(gy['g']) + posY_C2.append(gy['r']) + posY_C3.append(gy['i']) + + + gal_magu.append(srcs_cat[k1+1].header['magu']) + gal_magg.append(srcs_cat[k1+1].header['magg']) + gal_magr.append(srcs_cat[k1+1].header['magr']) + gal_magi.append(srcs_cat[k1+1].header['magi']) + gal_magz.append(srcs_cat[k1+1].header['magz']) + + #self.log.info('Galaxy number=%i, Mag_g=%f, Mag_r=%f,Mag_i=%f' % (nlayccd, mag['g'],mag['r'],mag['i'])) + + if nlayccd %1000 ==0: + self.log.info('Galaxy number on CCD is = %i' % (nlayccd)) + # gal_magu.append(np.float64(self.star['umag'][j])) + # gal_magg.append(np.float64(self.star['gmag'][j])) + # gal_magr.append(np.float64(self.star['rmag'][j])) + # gal_magi.append(np.float64(self.star['imag'][j])) + # gal_magz.append(np.float64(self.star['zmag'][j])) + + psf=dict() @@ -1700,7 +2921,7 @@ class MCIsimulator(): for i in range(3): ch=channel[i] - + psfmat=self.get_PSF(fsx, fsy, ch) temp=0 @@ -1716,8 +2937,11 @@ class MCIsimulator(): else: psf[ch]=temp + conv = fftconvolve(img[ch], psf[ch], mode='full') - #suppress negative numbers + #continue + #suppress negative numbers + conv[conv < 0.0] = 0.0 ################################################# @@ -1767,12 +2991,52 @@ class MCIsimulator(): photons.addTo(final_image[ch]) #################################################### + ### debug code + # fi= galsim.ImageF(int(self.information['xsize']), int(self.information['ysize'])) + # fi.setOrigin(0,0) + # photons.addTo(fi) + # cx,cy=centroid(fi.array) + # print('cx, cy=', cx, cy) + # print('gx, gy=' ,gx[ch],gy[ch]) + ############################################ + ############################################ ######################################################################## - ##print('total los nummber on CCD is: ',nlayccd ) + print('total los nummber on CCD is: ',nlayccd ) ################################################################# - ################################################################# + tab=Table() + tab['gal_ra']=np.asarray(gal_ra) + tab['gal_dec']=np.asarray(gal_dec) + + tab['phot_C1']=np.asarray(phot_C1) + tab['phot_C2']=np.asarray(phot_C2) + tab['phot_C3']=np.asarray(phot_C3) + + tab['posX_C1']=np.asarray(posX_C1) + tab['posX_C2']=np.asarray(posX_C2) + tab['posX_C3']=np.asarray(posX_C3) + + tab['posY_C1']=np.asarray(posY_C1) + tab['posY_C2']=np.asarray(posY_C2) + tab['posY_C3']=np.asarray(posY_C3) + + + tab['gal_magu']=np.asarray(gal_magu) + tab['gal_magg']=np.asarray(gal_magg) + tab['gal_magr']=np.asarray(gal_magr) + tab['gal_magi']=np.asarray(gal_magi) + tab['gal_magz']=np.asarray(gal_magz) + + + data_time=self.dt.strftime("%Y-%m-%d") + + #################################################################### + + file=self.result_path+'/log_Data/gal_info'+'_SN_'+str(self.information['simnumber'])+'.fits' + tab.write(file,overwrite=True) + + ####################################################################### fullimg['g']=final_image['g'].array fullimg['r']=final_image['r'].array @@ -1783,6 +3047,8 @@ class MCIsimulator(): ############################################################################### +############################################################################### + ############################################################################### def generatePRNU(self, ave=1.0, sigma=0.01): @@ -1854,9 +3120,9 @@ class MCIsimulator(): the sky. """ ### generate flatfiledfile, with - prnu_sigma=self.information['prnu_sigma'] + flatsigma=self.information['flatsigma'] - self.generatePRNU(ave=1.0, sigma=prnu_sigma) + self.generatePRNU(ave=1.0, sigma=flatsigma) self.image_g *= self.PRNU['g'] self.image_r *= self.PRNU['r'] self.image_i *= self.PRNU['i'] @@ -1876,7 +3142,7 @@ class MCIsimulator(): self.cr['exptime'] = self.information['exptime'] #to scale the number of cosmics with exposure time #cosmic ray image - crImage = np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) + crImage = np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) #cosmic ray instance cosmics_g = cosmicrays.cosmicrays(self.log, crImage, crInfo=self.cr) @@ -1884,42 +3150,47 @@ class MCIsimulator(): cosmics_i = cosmicrays.cosmicrays(self.log, crImage, crInfo=self.cr) #add cosmic rays up to the covering fraction - - CCD_cr_g = cosmics_g.addUpToFraction(self.information['coveringfraction'], limit=None) - CCD_cr_r = cosmics_r.addUpToFraction(self.information['coveringfraction'], limit=None) - CCD_cr_i = cosmics_i.addUpToFraction(self.information['coveringfraction'], limit=None) + #CCD_cr = cosmics.addUpToFraction(self.information['coveringFraction'], limit=None) + + CCD_cr_g = cosmics_g.addUpToFraction(self.information['coveringfraction']*self.information['exptime']/300.0, limit=None) + CCD_cr_r = cosmics_r.addUpToFraction(self.information['coveringfraction']*self.information['exptime']/300.0, limit=None) + CCD_cr_i = cosmics_i.addUpToFraction(self.information['coveringfraction']*self.information['exptime']/300.0, limit=None) #paste the information - + #self.image += CCD_cr self.image_g += CCD_cr_g self.image_r += CCD_cr_r self.image_i += CCD_cr_i #save cosmic ray image map - - self.cosmicMap_g = CCD_cr_g - self.cosmicMap_r = CCD_cr_r - self.cosmicMap_i = CCD_cr_i - + #self.cosmicMap = CCD_cr + + if self.save_cosmicrays and self.cosmicRays: + + self.log.info('Saved the cosmicRays fits...') + fits.writeto(self.result_path+'/ori_Sky/cosmicMap_C1_N_'+str(self.information['simnumber'])+'.fits',np.int32(CCD_cr_g), overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/cosmicMap_C2_N_'+str(self.information['simnumber'])+'.fits',np.int32(CCD_cr_r), overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/cosmicMap_C3_N_'+str(self.information['simnumber'])+'.fits',np.int32(CCD_cr_i), overwrite=True) + + #count the covering factor - - area_cr_g = np.count_nonzero(self.cosmicMap_g) - area_cr_r = np.count_nonzero(self.cosmicMap_r) - area_cr_i = np.count_nonzero(self.cosmicMap_i) + #area_cr = np.count_nonzero(self.cosmicMap) + area_cr_g = np.count_nonzero(CCD_cr_g) + area_cr_r = np.count_nonzero(CCD_cr_r) + area_cr_i = np.count_nonzero(CCD_cr_i) #self.log.info('The cosmic ray covering factor is %i pixels ' % area_cr) - self.log.info('The cosmic ray in G channel covering factor is %i pixels ' % area_cr_g) - self.log.info('The cosmic ray in R channel covering factor is %i pixels ' % area_cr_r) - self.log.info('The cosmic ray in I channel covering factor is %i pixels ' % area_cr_i) - - + self.log.info('The cosmic ray in C1 channel covering factor is %i pixels ' % area_cr_g) + self.log.info('The cosmic ray in C2 channel covering factor is %i pixels ' % area_cr_r) + self.log.info('The cosmic ray in C3 channel covering factor is %i pixels ' % area_cr_i) + ######################################################################################## - def ShutterEffectMat(self, img, t_exp, t_shutter=1.3, dist_bearing=4000, dt=0.001): + def ShutterEffectMat(self, img, t_exp=300, t_shutter=1.3, dist_bearing=4000, dt=0.001): # Generate Shutter-Effect normalized image # t_shutter: time of shutter movement # dist_bearing: distance between two bearings of shutter leaves - # dt: delta_t of sampling + # dt: delta_t of sampling SampleNumb = int(t_shutter/dt+1) @@ -1977,24 +3248,30 @@ class MCIsimulator(): exparrnormal = np.tile(expeffect, (sizey,1)) # Image *= exparrnormal + + shutter=(1-exparrnormal)*t_exp + shutter=shutter/shutter.max()*(t_shutter*2) - return exparrnormal + return shutter ######################################################################################## def addshuttereffect(self): ''' apply shutter effect to image''' # - self.shutterMat=self.ShutterEffectMat(self.image_g, self.information['exptime']) - self.image_g *= self.shutterMat - self.image_r *= self.shutterMat - self.image_i *= self.shutterMat + if self.information['exptime']>0: + self.shutter=self.ShutterEffectMat(self.image_g) + + self.shutterMat=1-self.shutter/self.information['exptime'] + + self.image_g *= self.shutterMat + self.image_r *= self.shutterMat + self.image_i *= self.shutterMat + if self.information['simnumber']==1: + fits.writeto(self.result_path+'/cali_Data/'+'shutter.fits', self.shutter, overwrite=True) + return - -############################################################################### -############################################################################### - - +######################################################################################## def applyDarkCurrent(self): """ Apply dark current. Scales the dark with the exposure time. @@ -2008,39 +3285,33 @@ class MCIsimulator(): self.image_g += dark self.image_r += dark self.image_i += dark - self.log.info('Added dark current = %f' % dark) - return ########################################################################### - - ########################################################################### def applyPoissonSkyNoise(self): """ Add Poisson sky noise to the image. """ - skynoise_g=self.Sky_Noise['g']*np.ones_like(self.image_g) - np.random.seed() + + np.random.seed(11*self.information['simnumber']) self.image_g =self.image_g+ np.random.poisson(lam=skynoise_g) self.log.info('Added Poisson sky noise on channel g') skynoise_r=self.Sky_Noise['r']*np.ones_like(self.image_r) - np.random.seed() + np.random.seed(111*self.information['simnumber']) self.image_r =self.image_r+ np.random.poisson(lam=skynoise_r) self.log.info('Added Poisson sky noise on channel r') skynoise_i=self.Sky_Noise['i']*np.ones_like(self.image_i) - np.random.seed() + np.random.seed(1111*self.information['simnumber']) self.image_i =self.image_i+ np.random.poisson(lam=skynoise_i) self.log.info('Added Poisson sky noise on channel i') return - ############################################################################### - ############################################################################### def applyCosmetics(self): """ @@ -2051,15 +3322,15 @@ class MCIsimulator(): .. Warning:: This method does not work if the input file has exactly one line. """ ####################################################################### - cosmetics = np.loadtxt(self.information['indata_path']+'/data/Cosmetics_g.txt') + cosmetics = np.loadtxt('../MCI_inputData/data/Cosmetics_g.txt') x = np.round(cosmetics[:, 0]).astype(int) ## row number y = np.round(cosmetics[:, 1]).astype(int) ## col number - value = np.round(cosmetics[:, 1]).astype(int) + value = np.round(cosmetics[:, 2]).astype(int) #cosmetics_g=np.zeros((4636,235526)) - self.log.info('Adding cosmetic defects to G channel:' ) + self.log.info('Adding cosmetic defects to C1 channel:' ) for xc, yc, val in zip(x, y, value): if 0 < xc < 4616 and 27 < (yc % 1499) <1179: @@ -2068,15 +3339,15 @@ class MCIsimulator(): self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val)) ###################################################################### ####################################################################### - cosmetics = np.loadtxt(self.information['indata_path']+'/data/Cosmetics_r.txt') + cosmetics = np.loadtxt('../MCI_inputData/data/Cosmetics_r.txt') x = np.round(cosmetics[:, 0]).astype(int) ## row number y = np.round(cosmetics[:, 1]).astype(int) ## col number - value = np.round(cosmetics[:, 1]).astype(int) + value = np.round(cosmetics[:, 2]).astype(int) #cosmetics_r=np.zeros((4636,235526)) - self.log.info('Adding cosmetic defects to R channel:' ) + self.log.info('Adding cosmetic defects to C2 channel:' ) for xc, yc, val in zip(x, y, value): if 0 < xc < 4616 and 27 < (yc % 1499) <1179: @@ -2085,23 +3356,36 @@ class MCIsimulator(): self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val)) ############################################################################## ####################################################################### - cosmetics = np.loadtxt(self.information['indata_path']+'/data/Cosmetics_i.txt') + cosmetics = np.loadtxt('../MCI_inputData/data/Cosmetics_i.txt') x = np.round(cosmetics[:, 0]).astype(int) ## row number y = np.round(cosmetics[:, 1]).astype(int) ## col number - value = np.round(cosmetics[:, 1]).astype(int) + value = np.round(cosmetics[:, 2]).astype(int) #cosmetics_i=np.zeros((4636,235526)) - self.log.info('Adding cosmetic defects to I channel:' ) + self.log.info('Adding cosmetic defects to C3 channel:' ) for xc, yc, val in zip(x, y, value): if 0 < xc < 4616 and 27 < (yc % 1499) <1179: self.image_i[xc, yc] = val #cosmetics_i[yc,xc]=val self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val)) - return - + + ####### save cosmetics image code #### + # if self.simnumber<2: + # #save cosmic ray image map + + # obsid=self.simnumber + # bluefile=self.result_path+'/calibration_Data/IFS_cosmetics'+'_'+str(obsid)+'_B.fits' + # redfile =self.result_path+'/calibration_Data/IFS_cosmetics'+'_'+str(obsid)+'_R.fits' + + # fits.writeto(bluefile, cosmetics_b, overwrite=True) + # fits.writeto(redfile, cosmetics_r, overwrite=True) + + # #output information to a FITS file + + # self.log.info('Save cosmetics images fits file to calibration_Data file ') ############################################################################################################################# def applyRadiationDamage(self): """ @@ -2109,8 +3393,6 @@ class MCIsimulator(): .. seealso:: Class :`CDM03` """ - - #save image without CTI self.noCTI_g = self.image_g.copy() @@ -2148,7 +3430,6 @@ class MCIsimulator(): #here we need the right input data self.image_i = cti.applyRadiationDamage(self.image_i.copy().transpose(), iquadrant=self.information['quadrant']).transpose() self.log.info('Radiation damage added.') - return ########################################################################### @@ -2160,20 +3441,19 @@ class MCIsimulator(): """ self.log.debug('Starting to apply non-linearity model...') - self.image_g = MCIinstrumentModel.CCDnonLinearityModel(self.image_g.copy()) + self.image_g = CCDnonLinearityModel(self.image_g.copy()) self.log.info('Non-linearity effects included.') ######################################################################## self.log.debug('Starting to apply non-linearity model...') - self.image_r = MCIinstrumentModel.CCDnonLinearityModel(self.image_r.copy()) + self.image_r = CCDnonLinearityModel(self.image_r.copy()) self.log.info('Non-linearity effects included.') ######################################################################## self.log.debug('Starting to apply non-linearity model...') - self.image_i = MCIinstrumentModel.CCDnonLinearityModel(self.image_i.copy()) + self.image_i = CCDnonLinearityModel(self.image_i.copy()) self.log.info('Non-linearity effects included.') - return ############################################################################### @@ -2184,7 +3464,7 @@ class MCIsimulator(): The noise is drawn from a Normal (Gaussian) distribution with average=0.0 and std=readout noise. """ - if self.information['xsize']==9216 and self.information['ysize']==9232 : + if self.overscans and self.information['xsize']==9216 and self.information['ysize']==9232 : xmin=dict() xmax=dict() ymin=dict() @@ -2198,17 +3478,17 @@ class MCIsimulator(): ymin[k]=(1152+self.prescan+self.overscan)*(k-1) ymax[k]=(1152+self.prescan+self.overscan)*(k) ############### - np.random.seed() + np.random.seed(2*self.information['simnumber']) noise_g = np.random.normal(loc=0.0, scale=self.information['g_rdnois'+str(k)], size=(4616+self.overscan,1152+self.overscan+self.prescan)) self.image_g[xmin[k]:xmax[k], ymin[k]:ymax[k]]+=noise_g self.log.info('Bias of %i counts were added to the g band image' % self.information['g_rdnois'+str(k)]) - np.random.seed() + np.random.seed(22*self.information['simnumber']) noise_r = np.random.normal(loc=0.0, scale=self.information['r_rdnois'+str(k)], size=(4616+self.overscan,1152+self.overscan+self.prescan)) self.image_r[xmin[k]:xmax[k], ymin[k]:ymax[k]]+=noise_r self.log.info('Bias of %i counts were added to the r band image' % self.information['r_rdnois'+str(k)]) - np.random.seed() + np.random.seed(222*self.information['simnumber']) noise_i = np.random.normal(loc=0.0, scale=self.information['i_rdnois'+str(k)], size=(4616+self.overscan,1152+self.overscan+self.prescan)) self.image_i[xmin[k]:xmax[k], ymin[k]:ymax[k]]+=noise_i self.log.info('Bias of %i counts were added to the i band image' % self.information['i_rdnois'+str(k)]) @@ -2217,21 +3497,21 @@ class MCIsimulator(): else: - np.random.seed() + np.random.seed(3*self.information['simnumber']) noise = np.random.normal(loc=0.0, scale=4, size=self.image_g.shape) self.log.info('Sum of readnoise in g channel = %f' % np.sum(noise)) #add to the image self.image_g += noise ####################################################### - np.random.seed() + np.random.seed(33*self.information['simnumber']) noise = np.random.normal(loc=0.0, scale=4, size=self.image_r.shape) self.log.info('Sum of readnoise in r channel= %f' % np.sum(noise)) #add to the image self.image_r += noise ######################################## - np.random.seed() + np.random.seed(333*self.information['simnumber']) noise = np.random.normal(loc=0.0, scale=4, size=self.image_i.shape) self.log.info('Sum of readnoise in i channel= %f' % np.sum(noise)) #add to the image @@ -2307,7 +3587,36 @@ class MCIsimulator(): ### end for return -############################################################################## +############################################################################## + def img_fits_save(self, data, filename): + #### + + ofd_g = fits.PrimaryHDU() + #### World coordinate system and related parameters ##### + hdu_g = fits.ImageHDU(data) + + hdu_g.header['WCSAXES']=(np.int16(2) , 'number of World Coordinate System axes') + hdu_g.header['CRPIX1'] =( round(float(self.information['CRPIX1']) ,1) , 'x-coordinate of reference pixel') + hdu_g.header['CRPIX2'] =( round(float(self.information['CRPIX2']) ,1) , 'y-coordinate of reference pixel') + + hdu_g.header['CRVAL1'] =( float(self.information['CRVAL1']) , 'first axis value at reference pixel') + hdu_g.header['CRVAL2'] =( float(self.information['CRVAL2']) , 'second axis value at reference pixel') + hdu_g.header['CTYPE1'] =( 'RA---TAN' , 'the coordinate type for the first axis') + hdu_g.header['CTYPE2'] =( 'DEC--TAN' , 'the coordinate type for the second axis') + hdu_g.header['CD1_1'] =( float(self.information['CD1_1']) , 'partial of first axis coordinate w.r.t. x') + hdu_g.header['CD1_2'] =( float(self.information['CD1_2']) , 'partial of first axis coordinate w.r.t. y') + hdu_g.header['CD2_1'] =( float(self.information['CD2_1']) , 'partial of second axis coordinate w.r.t. x') + hdu_g.header['CD2_2'] =( float(self.information['CD2_2']) , 'partial of second axis coordinate w.r.t. y') + + hdulist_g=fits.HDUList([ofd_g, hdu_g]) + + file_g=self.result_path+'/ori_Sky/'+filename +'.fits' + + hdulist_g.writeto(file_g, overwrite=True) + return + + + #################################################################################### def applyBleeding(self, img, direction='horizon'): @@ -2422,6 +3731,7 @@ class MCIsimulator(): :return: None """ + #avoid negative numbers in case bias level was not added self.image_g[self.image_g < 0.0] = 0. #cut of the values larger than max @@ -2450,7 +3760,7 @@ class MCIsimulator(): self.image_i = np.rint(self.image_i).astype(int) self.log.info('Maximum and total values of the image are %i and %i, respectively' % (np.max(self.image_i), np.sum(self.image_i))) - return + ################################################################################################## def addScanEffect(self, img): #### read CCD image to matrix as defined data format @@ -2482,14 +3792,14 @@ class MCIsimulator(): #### physical zone index if n<9: - xmin[n]=0 # row number - xmax[n]=4616 + xmin[n]=4616 # row number + xmax[n]=4616*2 ymin[n]=(n-1)*1152 # col number ymax[n]=ymin[n]+1152 else: - xmin[n]=4616 - xmax[n]=4616*2 + xmin[n]=0 + xmax[n]=4616 ymin[n]=(16-n)*1152 ymax[n]=ymin[n]+1152 @@ -2545,36 +3855,6 @@ class MCIsimulator(): return temp ########################################################################### - - def applyPoissonNoise(self): - """ - Add Poisson noise to the image. - """ - - - rounded = np.rint(self.image_g) ### round to - residual = self.image_g.copy() - rounded #ugly workaround for multiple rounding operations... - rounded[rounded < 0.0] = 0.0 - self.image_g = np.random.poisson(rounded).astype(np.float64) - self.log.info('Added Poisson noise on channel g') - self.image_g += residual - - rounded = np.rint(self.image_r) ### round to - residual = self.image_r.copy() - rounded #ugly workaround for multiple rounding operations... - rounded[rounded < 0.0] = 0.0 - self.image_r = np.random.poisson(rounded).astype(np.float64) - self.log.info('Added Poisson noise on channel r') - self.image_r += residual - - rounded = np.rint(self.image_i) ### round to - residual = self.image_i.copy() - rounded #ugly workaround for multiple rounding operations... - rounded[rounded < 0.0] = 0.0 - self.image_i = np.random.poisson(rounded).astype(np.float64) - self.log.info('Added Poisson noise on channel i') - self.image_i += residual - - - ######################################################################################### @@ -2587,103 +3867,143 @@ class MCIsimulator(): """ ## Readout information - + + HeaderTest='no' ########################################################################## - obsid=200000000+obnum - #create a new FITS file, using HDUList instance - ofd_g = fits.PrimaryHDU() - #### add primary header - + if self.source=='EXDF': + obsid=20100000000+obnum + + if self.source=='STAR': + obsid=20200000000+obnum + + if self.source=='PIPR': + obsid=20300000000+obnum + + if self.source=='TRNS': + obsid=20400000000+obnum + + if self.source=='COMB': + obsid=20500000000+obnum + + if self.source=='CALI': + obsid=20600000000+obnum + + if self.source=='BIAS': + obsid=20700000000+obnum + + if self.source=='DARK': + obsid=20800000000+obnum + + if self.source=='FLAT': + obsid=20900000000+obnum + ############################# + + if self.source=='OSBS': + obsid=21000000000+obnum + + if self.source=='OSDK': + obsid=21100000000+obnum + + if self.source=='OSFT': + obsid=21200000000+obnum + + if self.source=='FRNG': + obsid=21300000000+obnum + + ####################################################################### exp_starttime=self.dt.strftime("%Y%m%d%H%M%S") ### exposure end time is t2 ; t2=self.dt+timedelta(seconds=self.information['exptime']) - exp_endtime=t2.strftime("%Y%m%d%H%M%S") - - ### data read time is the exposure end time ### - ### data read end time is t3 + ### data read end time is t3, and this is the write file time; t3=self.dt+timedelta(seconds=self.information['exptime'])+timedelta(seconds=self.information['readouttime']) - filename_g='CSST_MCI_C1_'+self.source+'_'+exp_starttime+'_'+exp_endtime+'_'+str(obsid)+'_'+ \ - str(self.filterP[self.filter_g]['number'])+'_L0_'+self.information['ver']+'.fits' - - - ofd_g.header['GROUPS']=( bool(False), 'always F') - ofd_g.header['DATE'] =( t3.strftime("%Y-%m-%d %H:%M:%S"), 'date this file was written' ) - ofd_g.header['FILENAME']=(filename_g, ' file name C48 ') - ofd_g.header['OBSTYPE'] =( self.source, 'observation type raw,flt, mask, bias, dark, sci') - ofd_g.header['TELESCOP']=('CSST', 'always CSST') - ofd_g.header['INSTRUME']=( 'MCI', ' ') - ofd_g.header['RADECSYS']=('ICRS', ' always ICRS ') - ofd_g.header['EQUINOX'] =( float(2000.0), 'always 2000.0') - ofd_g.header['FITSCREA']=( '4.2.1', 'FITS create software version') - ######### Object information ############# - - ofd_g.header['OBJECT']=( self.information['name_obj'], 'object name') - ofd_g.header['TARGET']=( self.information['target'], 'target name, hhmmss+ddmmss') - ofd_g.header['OBJ_RA'] =(np.float64(self.information['ra_obj']) , 'RA of the object in deg') - ofd_g.header['OBJ_DEC']=(np.float64(self.information['dec_obj']) , 'DEC of the object in deg') - - ofd_g.header['RA_PNT0']=( np.float64(self.information['ra_pnt0']) , 'RA of the pointing (degrees) at EXPSTART') - ofd_g.header['DEC_PNT0']=(np.float64(self.information['dec_pnt0']) , 'DEC of the pointing (degrees) at EXPSTART') - - + if self.filterP[self.filter_g]['number']>9: + filternum=str(self.filterP[self.filter_g]['number']) + else: + filternum='0'+str(self.filterP[self.filter_g]['number']) + - ############## - ofd_g.header['OBSID'] =(str(obsid) , 'observation ID, 3+8bit') + filename_g='CSST_MCI_C1_'+self.source+'_'+exp_starttime+'_'+exp_endtime+'_'+str(obsid)+'_'+ \ + filternum+'_L0_V01' + ####################################################################### + ####################################################################### + #create a new FITS file, using HDUList instance + ofd_g = fits.PrimaryHDU() + #### add primary header + ofd_g = fits.PrimaryHDU() + ofd_g.header['SIMPLE']=( True, 'conforms to FITS standard') + ofd_g.header['BITPIX']=( 0, 'array data type') + ofd_g.header['NAXIS'] =( 0, 'number of array dimensions') + ofd_g.header['NEXTEND']=( np.int16(1), 'number of array dimensions') + ####################################################################### + ########################### + temp=t3.utcnow() + data_time=temp.strftime("%Y-%m-%dT%H:%M:%S.%f") + ofd_g.header['DATE'] =(data_time[:21], 'written date (yyyy-mm-ddThh:mm:ss.s)') + ofd_g.header['FILENAME']=(filename_g[:68],'') + ofd_g.header['FILETYPE'] =( self.source[:12], 'observation type') + ofd_g.header['TELESCOP']=('CSST', 'telescope name') + ofd_g.header['INSTRUME']=('MCI', 'instrument name') + ofd_g.header['RADECSYS']=('ICRS', 'coordinate system of the object') + ofd_g.header['EQUINOX'] =(float(2000.0), '') + ofd_g.header['FITSSWV']=('mci_sim_0.8.03', 'FITS creating software version') + ############################################################################## + ######### Object information ######################################### + ofd_g.header['OBJECT'] =(self.information['name_obj'][:30], 'object name') + ofd_g.header['TARGET'] =(self.information['target'][:13], 'target name (hhmmss.s+ddmmss)') + ####################################################################### + ofd_g.header['OBSID'] =(str(obsid) , 'observation ID') + ofd_g.header['RA_OBJ'] =(float(self.information['ra_obj']) , 'object RA (deg)') + ofd_g.header['DEC_OBJ']=(float(self.information['dec_obj']) , 'object Dec (deg)') + ######## Telescope information ############### - # ofd_g.header['COMMENT'] ='==========================================================' - # ofd_g.header['COMMENT'] ='Telescope information' - # ofd_g.header['COMMENT'] ='==========================================================' - ofd_g.header['REFFRAME']=('CSSTGSC-1.0' , 'guide star catalog version') - ofd_g.header['DATE-OBS']=(self.dt.strftime("%Y-%m-%d %H:%M:%S") , 'date of the observation (yyyy-mm-dd hh:mm:ss)') - - - ofd_g.header['EXPSTART']=(time2jd(self.dt), 'exposure start time, UTC') - ofd_g.header['SUNANGL0']=(np.float32(0.0) , 'angle between sun and optical axis at EXPSTART') - ofd_g.header['MOONANG0']=(np.float32(0.0) , 'angle between moon and optical axis at EXPSTART') - ofd_g.header['POS_ANG0']=(np.float64(0.0), 'angle between optical axis and the North Pole at EXPSTART in arcsec') - ofd_g.header['TEL_ALT0']=(np.float64(0.0), 'angle between optical axis and the ground- piston at EXPSTART in deg') - - ofd_g.header['HOODSTA0']=(np.float32(0.0) , 'lens hood altitude at EXPSTART') - ofd_g.header['HOODANG0']=(np.float32(0.0), 'lens hood azimuth at EXPSTART') - ofd_g.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'the orbital position of CSST in X direction at EXPSTART') - ofd_g.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'the orbital position of CSST in Y direction at EXPSTART') - ofd_g.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'the orbital position of CSST in Z direction at EXPSTART') - ofd_g.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'the orbital velocity of CSST in X direction at EXPSTART') - ofd_g.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'the orbital velocity of CSST in Y direction at EXPSTART') - ofd_g.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'the orbital velocity of CSST in Z direction at EXPSTART') - - ofd_g.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at EXPSTART') - ofd_g.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at EXPSTART') - ofd_g.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at EXPSTART') - - - ofd_g.header['EXPEND'] =(time2jd(t2) , 'exposure end time,UTC') - - ofd_g.header['SUNANGL1']=(np.float32(0.0), 'angle between sun and optical axis at EXPEND') - ofd_g.header['MOONANG1']=(np.float32(0.0) , 'angle between moon and optical axis at EXPEND ') - ofd_g.header['POS_ANG1']=(np.float64(0.0) , 'angle between optical axis and the North Pole at EXPEND in arcsec') - ofd_g.header['TEL_ALT1']=(np.float64(0.0) , 'angle between optical axis and the ground- piston at EXPEND in deg ') - ofd_g.header['HOODSTA1']=(np.float32(0.0), 'lens hood altitude at EXPEND ') - ofd_g.header['HOODANG1']=(np.float32(0.0), 'lens hood azimuth at EXPEND ') + ofd_g.header['REFFRAME']=('CSSTGSC-1.0' , 'guiding catalog version') + ofd_g.header['DATE-OBS']=(data_time[:21] , 'observation date (yyyy-mm-ddThh:mm:ss.s)') + ofd_g.header['SATESWV']=('softwave-1.0', 'satellite software version') + ofd_g.header['EXPSTART']=(np.float64(time2mjd(self.dt)), 'exposure start time (MJD)') + ofd_g.header['CABSTART']=(np.float64(time2jd(self.dt)), 'first cabin time after exposure start (MJD)') + ofd_g.header['SUNANGL0']=(np.float32(0.0) , 'angle between the Sun and opt axis at CABSTART') + ofd_g.header['MOONANG0']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABSTART') + ofd_g.header['TEL_ALT0']=(np.float64(0.0), 'angle between opt axis and Elimb at CABSTART') + ofd_g.header['POS_ANG0']=(np.float64(0.0), 'angle between y axis and North Pole at CABSTART') + ofd_g.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'orbital position in X at CABSTART (km)') + ofd_g.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'orbital position in Y at CABSTART (km)') + ofd_g.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'orbital position in Z at CABSTART (km)') + ofd_g.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'orbital velocity in X at CABSTART (km/s)') + ofd_g.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'orbital velocity in Y at CABSTART (km/s)') + ofd_g.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'orbital velocity in Z at CABSTART (km/s)') + ofd_g.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at CABSTART (deg)') + ofd_g.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at CABSTART (deg)') + ofd_g.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at CABSTART (deg)') + + + ############################################################## + ##### + ofd_g.header['RA_PNT0']=( float(self.information['ra_pnt0']) , 'pointing RA at CABSTART (deg)') + ofd_g.header['DEC_PNT0']=(float(self.information['dec_pnt0']) , 'pointing Dec at CABSTART (deg)') + ofd_g.header['EXPEND'] =(float(time2mjd(t2)), 'exposure end time (MJD)') + ofd_g.header['CABEND'] =(float(time2jd(t2)) , 'first cabin time after exposure end (MJD)') + ofd_g.header['SUNANGL1']=(np.float32(0.0), 'angle between the Sun and opt axis at CABEND') + ofd_g.header['MOONANG1']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABEND') + ofd_g.header['TEL_ALT1']=(np.float64(0.0) , 'angle between opt axis and Elimb at CABEND') + ofd_g.header['POS_ANG1']=(float(0.0) , 'angle between y axis and North Pole at CABEND') + ############################################################## t2jd=time2jd(t2) if self.orbit_pars[-1,0]9: + filternum=str(self.filterP[self.filter_r]['number']) + else: + filternum='0'+str(self.filterP[self.filter_r]['number']) + - ######### add primary header ########## - ofd_r.header['GROUPS']=( bool(False), 'always F') - ofd_r.header['DATE'] =( ofd_g.header['DATE'], 'date this file was written' ) + filename_r='CSST_MCI_C2_'+self.source+'_'+exp_starttime+'_'+exp_endtime+'_'+str(obsid)+'_'+ \ + filternum+'_L0_V01' - ofd_r.header['FILENAME']=(filename_r, ' file name C48 ') - ofd_r.header['OBSTYPE'] =( self.source, 'observation type raw,flt, mask, bias, dark, sci') - ofd_r.header['TELESCOP']=('CSST', 'always CSST') - ofd_r.header['INSTRUME']=( 'MCI', ' ') - ofd_r.header['RADECSYS']=('ICRS', ' always ICRS ') - ofd_r.header['EQUINOX'] =( float(2000.0), 'always 2000.0') - ofd_r.header['FITSCREA']=( '4.2.1', 'FITS create software version') + ####################################################################### + ####################################################################### + #create a new FITS file, using HDUList instance + ofd_r = fits.PrimaryHDU() + #### add primary header - ######### Object information ############# + ########## + ofd_r.header['SIMPLE']=( True, 'conforms to FITS standard') + ofd_r.header['BITPIX']=( 0, 'array data type') + ofd_r.header['NAXIS'] =( 0, 'number of array dimensions') + ofd_r.header['NEXTEND']=( np.int16(1), 'number of array dimensions') + + + temp=t3.utcnow() + data_time=temp.strftime("%Y-%m-%dT%H:%M:%S.%f") + ofd_r.header['DATE'] =(data_time[:21], 'written date (yyyy-mm-ddThh:mm:ss.s)') + ofd_r.header['FILENAME']=(filename_r[:68],'') + ofd_r.header['FILETYPE'] =( self.source[:12], 'observation type') + ofd_r.header['TELESCOP']=('CSST', 'telescope name') + ofd_r.header['INSTRUME']=('MCI', 'instrument name') + ofd_r.header['RADECSYS']=('ICRS', 'coordinate system of the object') + ofd_r.header['EQUINOX'] =(float(2000.0), '') + ofd_r.header['FITSSWV']=('mci_sim_0.8.03', 'FITS creating software version') + ######### Object information ######################################### + ofd_r.header['OBJECT'] =(self.information['name_obj'][:30], 'object name') + ofd_r.header['TARGET'] =(self.information['target'][:13], 'target name (hhmmss.s+ddmmss)') + ####################################################################### + ofd_r.header['OBSID'] =(str(obsid) , 'observation ID') + ofd_r.header['RA_OBJ'] =(float(self.information['ra_obj']) , 'object RA (deg)') + ofd_r.header['DEC_OBJ']=(float(self.information['dec_obj']) , 'object Dec (deg)') - ofd_r.header['OBJECT']=( self.information['name_obj'], 'object name') - ofd_r.header['TARGET']=( self.information['target'], 'target name, hhmmss+ddmmss') - ofd_r.header['OBJ_RA'] =(np.float64(self.information['ra_obj']) , 'RA of the object in deg') - ofd_r.header['OBJ_DEC']=(np.float64(self.information['dec_obj']) , 'DEC of the object in deg') + ######## Telescope information ############### - ofd_r.header['RA_PNT0']=( np.float64(self.information['ra_pnt0']) , 'RA of the pointing (degrees) at EXPSTART') - ofd_r.header['DEC_PNT0']=(np.float64(self.information['dec_pnt0']) , 'DEC of the pointing (degrees) at EXPSTART') + ofd_r.header['REFFRAME']=('CSSTGSC-1.0' , 'guiding catalog version') + ofd_r.header['DATE-OBS']=(data_time[:21] , 'observation date (yyyy-mm-ddThh:mm:ss.s)') + ofd_r.header['SATESWV']=('softwave-1.0', 'satellite software version') + ofd_r.header['EXPSTART']=(np.float64(time2mjd(self.dt)), 'exposure start time (MJD)') + ofd_r.header['CABSTART']=(np.float64(time2jd(self.dt)), 'first cabin time after exposure start (MJD)') + ofd_r.header['SUNANGL0']=(np.float32(0.0) , 'angle between the Sun and opt axis at CABSTART') + ofd_r.header['MOONANG0']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABSTART') + ofd_r.header['TEL_ALT0']=(np.float64(0.0), 'angle between opt axis and Elimb at CABSTART') + ofd_r.header['POS_ANG0']=(np.float64(0.0), 'angle between y axis and North Pole at CABSTART') + ofd_r.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'orbital position in X at CABSTART (km)') + ofd_r.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'orbital position in Y at CABSTART (km)') + ofd_r.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'orbital position in Z at CABSTART (km)') + ofd_r.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'orbital velocity in X at CABSTART (km/s)') + ofd_r.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'orbital velocity in Y at CABSTART (km/s)') + ofd_r.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'orbital velocity in Z at CABSTART (km/s)') + ofd_r.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at CABSTART (deg)') + ofd_r.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at CABSTART (deg)') + ofd_r.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at CABSTART (deg)') + + ############################################################## + ##### + ofd_r.header['RA_PNT0']=( float(self.information['ra_pnt0']) , 'pointing RA at CABSTART (deg)') + ofd_r.header['DEC_PNT0']=(float(self.information['dec_pnt0']) , 'pointing Dec at CABSTART (deg)') + ofd_r.header['EXPEND'] =(float(time2mjd(t2)), 'exposure end time (MJD)') + ofd_r.header['CABEND'] =(float(time2jd(t2)) , 'first cabin time after exposure end (MJD)') + ofd_r.header['SUNANGL1']=(np.float32(0.0), 'angle between the Sun and opt axis at CABEND') + ofd_r.header['MOONANG1']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABEND') + ofd_r.header['TEL_ALT1']=(np.float64(0.0) , 'angle between opt axis and Elimb at CABEND') + ofd_r.header['POS_ANG1']=(float(0.0) , 'angle between y axis and North Pole at CABEND') - ############## - ofd_r.header['OBSID'] =(str(obsid) , 'observation ID, 3+8bit') + + ############################################################## + + ofd_r.header['POSI1_X'] =(float(p1x) , 'orbital position in X at CABEND (km)') + ofd_r.header['POSI1_Y'] =(float(p1y) , 'orbital position in Y at CABEND (km)') + ofd_r.header['POSI1_Z'] =(float(p1z) , 'orbital position in Z at CABEND (km)') + + ofd_r.header['VELO1_X']=(float(p1vx) , 'orbital velocity in X at CABEND (km/s)') + ofd_r.header['VELO1_Y']=(float(p1vy) , 'orbital velocity in Y at CABEND (km/s)') + ofd_r.header['VELO1_Z']=(float(p1vz), 'orbital velocity in Z at CABEND (km/s)') + + ofd_r.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at CABEND (deg)') + ofd_r.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at CABEND (deg)') + ofd_r.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at CABEND (deg)') + ofd_r.header['RA_PNT1'] =(float(ofd_r.header['RA_PNT0']), 'pointing RA at CABEND (deg)') + ofd_r.header['DEC_PNT1']=(float(ofd_r.header['DEC_PNT0']), 'pointing Dec at CABEND (deg)') + ofd_r.header['EPOCH'] =(np.float32(time2jd(t3.utcnow())), 'equinox of pointing RA and Dec') + ofd_r.header['EXPTIME']=(np.float32(self.information['exptime']), 'exposure time (s)') + + ss1='HDU checksum' + ss2='data unit checksum' + ofd_r.header['CHECKSUM']=( data_time[:19] , ss1) + ofd_r.header['DATASUM'] =( data_time[:19] , ss2) - ######## Telescope information ############### - # ofd_r.header['COMMENT'] ='==========================================================' - # ofd_r.header['COMMENT'] ='Telescope information' - # ofd_r.header['COMMENT'] ='==========================================================' - - ofd_r.header['REFFRAME']=('CSSTGSC-1.0' , 'guide star catalog version') - ofd_r.header['DATE-OBS']=(ofd_g.header['DATE-OBS'] , 'date of the observation (yyyy-mm-dd hh:mm:ss)') - - ofd_r.header['EXPSTART']=(ofd_g.header['EXPSTART'], 'exposure start time') - ofd_r.header['SUNANGL0']=(np.float32(0.0) , 'angle between sun and optical axis at EXPSTART') - ofd_r.header['MOONANG0']=(np.float32(0.0) , 'angle between moon and optical axis at EXPSTART') - ofd_r.header['POS_ANG0']=(np.float64(0.0), 'angle between optical axis and the North Pole at EXPSTART in arcsec') - ofd_r.header['TEL_ALT0']=(np.float64(0.0), 'angle between optical axis and the ground- piston at EXPSTART in deg') - - ofd_r.header['HOODSTA0']=(np.float32(0.0) , 'lens hood altitude at EXPSTART') - ofd_r.header['HOODANG0']=(np.float32(0.0), 'lens hood azimuth at EXPSTART') - ofd_r.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'the orbital position of CSST in X direction at EXPSTART') - ofd_r.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'the orbital position of CSST in Y direction at EXPSTART') - ofd_r.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'the orbital position of CSST in Z direction at EXPSTART') - ofd_r.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'the orbital velocity of CSST in X direction at EXPSTART') - ofd_r.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'the orbital velocity of CSST in Y direction at EXPSTART') - ofd_r.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'the orbital velocity of CSST in Z direction at EXPSTART') - - - ofd_r.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at EXPSTART') - ofd_r.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at EXPSTART') - ofd_r.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at EXPSTART') - - - ofd_r.header['EXPEND'] =(ofd_g.header['EXPEND'] , 'exposure end time') - - ofd_r.header['SUNANGL1']=(np.float32(0.0), 'angle between sun and optical axis at EXPEND') - ofd_r.header['MOONANG1']=(np.float32(0.0) , 'angle between moon and optical axis at EXPEND ') - ofd_r.header['POS_ANG1']=(np.float64(0.0) , 'angle between optical axis and the North Pole at EXPEND in arcsec') - ofd_r.header['TEL_ALT1']=(np.float64(0.0) , 'angle between optical axis and the ground- piston at EXPEND in deg ') - ofd_r.header['HOODSTA1']=(np.float32(0.0), 'lens hood altitude at EXPEND ') - ofd_r.header['HOODANG1']=(np.float32(0.0), 'lens hood azimuth at EXPEND ') - ofd_r.header['POSI1_X'] =(np.float64(p1x) , 'the orbital position of CSST in X direction at EXPEND') - ofd_r.header['POSI1_Y'] =(np.float64(p1y) , 'the orbital position of CSST in Y direction at EXPEND') - ofd_r.header['POSI1_Z'] =(np.float64(p1z) , 'the orbital position of CSST in Z direction at EXPEND') - - ofd_r.header['VELO1_X']=(np.float64(p1vx) , 'the orbital velocity of CSST in X direction at EXPEND') - ofd_r.header['VELO1_Y']=(np.float64(p1vy) , 'the orbital velocity of CSST in Y direction at EXPEND') - ofd_r.header['VELO1_Z']=(np.float64(p1vz) , 'the orbital velocity of CSST in Z direction at EXPEND') - - ofd_r.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at EXPEND') - ofd_r.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at EXPEND') - ofd_r.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at EXPEND') - - ofd_r.header['RA_PNT1']=(np.float64(0.0), 'RA of the pointing (degrees) at EXPEND in deg') - ofd_r.header['DEC_PNT1']=(np.float64(0.0), 'DEC of the pointing (degrees) at EXPEND in deg') - - ofd_r.header['EXPTIME']=(self.information['exptime'], 'exposure duration') - ofd_r.header['EPOCH'] =(np.float32(0.0), 'coordinate epoch') - ofd_r.header['CHECKSUM']=( 0 , 'hdu-checksum') + ################################################ + ########## finish header for 0 layer #################### + ########## finish header for 0 layer #################### ########## finish header for 0 layer - #new image HDU - hdu_r = fits.ImageHDU(data=np.uint16(self.image_r)) - - ### MCI header for immage layer ### - #### Instrument information (at EXPSTART time) - hdu_r.header['PMIRRPOS']=( bool(True) , 'FSM pointing,T: point to MCI, F: not point to MCI ') - hdu_r.header['DIFFUSER']=( bool(True) , 'insert diffuser for flat calibration,T: insert diffuser, F: not insert diffuser ') - hdu_r.header['FLAMP'] =( np.int16(0) , 'status of flat lamp,0: off, 1: 1, 2: 2, 3: 3') - hdu_r.header['MCITEMP'] =( np.float32(0.0), 'MCI components temperature') - hdu_r.header['MCISTAT'] =( np.int16(0) , 'MCI components status parameters') + if HeaderTest=='yes': + hdu_r = fits.ImageHDU() + else: + hdu_r = fits.ImageHDU(data=np.uint16(self.image_r)) + ### MCI header for image layer ### + #### need review thie header + hdu_r.header['XTENSION']=( 'IMAGE' , 'extension type') + hdu_r.header['BITPIX'] =( np.int16(16) , 'array data type') + hdu_r.header['NAXIS'] =( np.int16(2) , 'number of array dimensions') + + hdu_r.header['NAXIS1'] =( np.int32(4936) , '') + hdu_r.header['NAXIS2'] =( np.int32(23984) , '') + + + hdu_r.header['PCOUNT']=( np.int16(0) , 'number of parameters') + hdu_r.header['GCOUNT']=( np.int16(1) , 'number of groups') + + hdu_r.header['BSCALE']=(int(1),'') + hdu_r.header['BZERO'] =(int(32768),'') + + hdu_r.header['EXTNAME']=( 'SCI' , '') + hdu_r.header['EXTVER']=(np.int16(1),'') + + hdu_r.header['BUNIT'] =('ADU','physical unit of array values') + + ###### file information ############### + + temp=t3.utcnow() + data_time=temp.strftime("%Y-%m-%dT%H:%M:%S.%f") + hdu_r.header['DATE'] =(data_time[:21], 'written date (yyyy-mm-ddThh:mm:ss.s)') + hdu_r.header['FILENAME']=(filename_r[:68],'') + hdu_r.header['FILETYPE'] =( self.source[:12], 'observation type') + hdu_r.header['RADECSYS']=('ICRS', 'coordinate system of the object') + hdu_r.header['EQUINOX'] =(float(2000.1), '') + hdu_r.header['FITSSWV']=('4.2.1', 'FITS creating software version') + + ######################################## + + #### instrument status and object information ###### + hdu_r.header['TELESCOP']=('CSST', 'telescope name') + hdu_r.header['INSTRUME']=('MCI', 'instrument name') + hdu_r.header['CHANNEL'] =('C1', 'channel number') + hdu_r.header['FILTERNO'] =(filternum, 'filter number') + hdu_r.header['DIFFUSER']=( bool(True) , 'insert diffuser for flat calibration') + hdu_r.header['FLAMP'] =( np.int16(0) , 'status of flat lamp') + hdu_r.header['MCISTAT'] =( np.int16(0) , 'MCI componetns status parameter') - ##### Filter information ##### - hdu_r.header['FILTER'] =(self.filter_r , 'filter band name') + hdu_r.header['DATE_OBS'] =(data_time[:21] , 'observation date (yyyy-mm-ddThh:mm:ss.s)') + hdu_r.header['OBJECT'] =( 'MCI_obj' , 'object name') + hdu_r.header['TARGET'] =(self.information['target'][:13], 'target name (hhmmss.s+ddmmss)') + ####################################################################### + hdu_r.header['OBSID'] =(str(obsid) , 'observation ID') + hdu_r.header['RA_OBJ'] =(float(self.information['ra_obj']) , 'object RA (deg)') + hdu_r.header['DEC_OBJ']=(float(self.information['dec_obj']) , 'object Dec (deg)') + + + + ##### detector and Filter information ##### + hdu_r.header['FILTER'] =(self.filter_r[:6] , 'filter band') ##### Detector information #### - hdu_r.header['DETNAM'] =('C2' , 'detector name for channle 2') - hdu_r.header['DETTEMP'] =(np.float32(0) , 'detector temperature') - hdu_r.header['DETSIZE'] =(str(self.image_r.shape[0])+'*'+str(self.image_r.shape[1]), 'detector size') - hdu_r.header['DATASEC'] =(str(self.information['ysize'])+'*'+str( self.information['xsize']), 'data section') - hdu_r.header['PIXSCAL1']=(np.float32(0.05) , 'pixel scale for axis 1') - hdu_r.header['PIXSCAL2']=(np.float32(0.05) , 'pixel scale for axis 2') - hdu_r.header['PIXSIZE1']=(np.float32(10.0) , 'pixel size for axis 1') - hdu_r.header['PIXSIZE2']=(np.float32(10.0) , 'pixel size for axis 2') - hdu_r.header['NCHAN'] =(np.int16(16) , 'number of readout channels') - hdu_r.header['NCHAN1'] =(np.int16(8) , 'number of horizontal channels') - hdu_r.header['NCHAN2'] =(np.int16(2) , 'number of vertical channels') + hdu_r.header['DETSN'] =('E2V-CCD-290-0000000' , 'detector serial number') + hdu_r.header['DETNAME'] =('opt-blue' , 'detector name') + ####need review here + + + hdu_r.header['DETTEMP0'] =(np.float32(0) , 'detector temperature at EXPSTART (K)') + hdu_r.header['DETTEMP1'] =(np.float32(0) , 'detector temperature at EXPEND (K)') + hdu_r.header['DETTEMP2'] =(np.float32(0) , 'detector temperature at READT1 (K)') + + + + hdu_r.header['DETSIZE'] =(str(self.information['ysize'])+'*'+str( self.information['xsize']), 'detector size') + hdu_r.header['DATASECT'] =(str(self.image_g.shape[0])+'*'+str(self.image_g.shape[1]), 'data section') + + hdu_r.header['PIXSCAL1']=('0.05' , 'pixel scale for axis 1 (arcsec/pixel)') + hdu_r.header['PIXSCAL2']=('0.05' , 'pixel scale for axis 2 (arcsec/pixel)') + + hdu_r.header['PIXSIZE1']=(int(10) , 'pixel size for axis 1 (micron)') + hdu_r.header['PIXSIZE2']=(int(10) , 'pixel size for axis 2 (micron)') + + hdu_r.header['NCHANNEL'] =(np.int16(16) , 'number of readout channels') + + hdu_r.header['PSCAN1'] =(np.int32(27) , 'horizontal prescan width, per readout channel') - hdu_r.header['PSCAN2'] =(np.int32(8) , 'vertical prescan height, per readout channel') - hdu_r.header['OSCAN1'] =(np.int32(16) , 'horizontal overscan width, per readout channel') - hdu_r.header['OSCAN2'] =(np.int32(8) , 'vertical overscan width, per readout channel') - hdu_r.header['BIN_X'] =(np.int16(0) , 'bin number in X (wavelength)') - hdu_r.header['BIN_Y'] =(np.int16(0) , 'bin number in Y (spatial)') + hdu_r.header['PSCAN2'] =(np.int32(0) , 'vertical prescan height, per readout channel') - #### World coordinate system and related parameters ##### + hdu_r.header['OSCAN1'] =(np.int32(320) , 'horizontal overscan width, per readout channel') + hdu_r.header['OSCAN2'] =(np.int32(320) , 'vertical overscan width, per readout channel') + + hdu_r.header['BIN_X'] =(np.int16(1) , 'bin number in X') + hdu_r.header['BIN_Y'] =(np.int16(1) , 'bin number in Y') - hdu_r.header['WCSAXES']=( np.int16(2) , 'number of World Coordinate System axes') - hdu_r.header['CRPIX1'] =( np.float64(self.information['CRPIX1']) , 'x-coordinate of reference pixel') - hdu_r.header['CRPIX2'] =( np.float64(self.information['CRPIX2']) , 'y-coordinate of reference pixel') - hdu_r.header['CRVAL1'] =( np.float64(self.information['CRVAL1']) , 'first axis value at reference pixel') - hdu_r.header['CRVAL2'] =( np.float64(self.information['CRVAL2']) , 'second axis value at reference pixel') - hdu_r.header['CTYPE1'] =( 'RA---TAN' , 'the coordinate type for the first axis') - hdu_r.header['CTYPE2'] =( 'DEC---TAN' , 'the coordinate type for the second axis') - hdu_r.header['CD1_1'] =( np.float64(self.information['CD1_1']) , 'partial of first axis coordinate w.r.t. x') - hdu_r.header['CD1_2'] =( np.float64(self.information['CD1_2']) , 'partial of first axis coordinate w.r.t. y') - hdu_r.header['CD2_1'] =( np.float64(self.information['CD2_1']) , 'partial of second axis coordinate w.r.t. x') - hdu_r.header['CD2_2'] =( np.float64(self.information['CD2_2']) , 'partial of second axis coordinate w.r.t. y') - hdu_r.header['others'] =( 0.0 , 'other specific parameters') + #### World coordinate system information ##### + + hdu_r.header['WCSAXES']=(np.int16(2) , 'number of World Coordinate System axes') + hdu_r.header['CRPIX1'] =( round(float(self.information['CRPIX1']) ,1) , 'x-coordinate of reference pixel') + hdu_r.header['CRPIX2'] =( round(float(self.information['CRPIX2']) ,1) , 'y-coordinate of reference pixel') + + hdu_r.header['CRVAL1'] =( float(self.information['CRVAL1']) , 'value of reference pixel on axis 1') + hdu_r.header['CRVAL2'] =( float(self.information['CRVAL2']) , 'value of reference pixel on axis 2') + + hdu_r.header['CTYPE1'] =( 'RA---TAN' , 'type of RA WCS projection') + hdu_r.header['CTYPE2'] =( 'DEC--TAN' , 'type of Dec WCS projection') + + hdu_r.header['CD1_1'] =( float(self.information['CD1_1']) , 'transformation matrix element (deg/pix)') + hdu_r.header['CD1_2'] =( float(self.information['CD1_2']) , 'transformation matrix element (deg/pix)') + hdu_r.header['CD2_1'] =( float(self.information['CD2_1']) , 'transformation matrix element (deg/pix)') + hdu_r.header['CD2_2'] =( float(self.information['CD2_2']) , 'transformation matrix element (deg/pix)') + ###### Readout information ####### - hdu_r.header['GAIN1'] =( np.float32(self.information['r_gain1']) , 'CCD gain (channel 1)') - hdu_r.header['GAIN2'] =( np.float32(self.information['r_gain2']) , 'CCD gain (channel 2)') - hdu_r.header['GAIN3'] =( np.float32(self.information['r_gain3']) , 'CCD gain (channel 3)') - hdu_r.header['GAIN4'] =( np.float32(self.information['r_gain4']) , 'CCD gain (channel 4)') - hdu_r.header['GAIN5'] =( np.float32(self.information['r_gain5']) , 'CCD gain (channel 5)') - hdu_r.header['GAIN6'] =( np.float32(self.information['r_gain6']) , 'CCD gain (channel 6)') - hdu_r.header['GAIN7'] =( np.float32(self.information['r_gain7']) , 'CCD gain (channel 7)') - hdu_r.header['GAIN8'] =( np.float32(self.information['r_gain8']) , 'CCD gain (channel 8)') - hdu_r.header['GAIN9'] =( np.float32(self.information['r_gain9']) , 'CCD gain (channel 9)') - hdu_r.header['GAIN10']=( np.float32(self.information['r_gain10']) , 'CCD gain (channel 10)') - hdu_r.header['GAIN11']=( np.float32(self.information['r_gain11']) , 'CCD gain (channel 11)') - hdu_r.header['GAIN12']=( np.float32(self.information['r_gain12']) , 'CCD gain (channel 12)') - hdu_r.header['GAIN13']=( np.float32(self.information['r_gain13']) , 'CCD gain (channel 13)') - hdu_r.header['GAIN14']=( np.float32(self.information['r_gain14']) , 'CCD gain (channel 14)') - hdu_r.header['GAIN15']=( np.float32(self.information['r_gain15']) , 'CCD gain (channel 15)') - hdu_r.header['GAIN16']=( np.float32(self.information['r_gain16']) , 'CCD gain (channel 16)') + hdu_r.header['GAINLVL'] =( np.float32(1.5) , 'gain level (e-/ADU)') + hdu_r.header['GAIN01'] =( np.float32(self.information['r_gain1']) , 'CCD gain [channel 1] (e-/ADU)') + hdu_r.header['GAIN02'] =( np.float32(self.information['r_gain2']) , 'CCD gain [channel 2] (e-/ADU)') + hdu_r.header['GAIN03'] =( np.float32(self.information['r_gain3']) , 'CCD gain [channel 3] (e-/ADU)') + hdu_r.header['GAIN04'] =( np.float32(self.information['r_gain4']) , 'CCD gain [channel 4] (e-/ADU)') + hdu_r.header['GAIN05'] =( np.float32(self.information['r_gain5']) , 'CCD gain [channel 5] (e-/ADU)') + hdu_r.header['GAIN06'] =( np.float32(self.information['r_gain6']) , 'CCD gain [channel 6] (e-/ADU)') + hdu_r.header['GAIN07'] =( np.float32(self.information['r_gain7']) , 'CCD gain [channel 7] (e-/ADU)') + hdu_r.header['GAIN08'] =( np.float32(self.information['r_gain8']) , 'CCD gain [channel 8] (e-/ADU)') + hdu_r.header['GAIN09'] =( np.float32(self.information['r_gain9']) , 'CCD gain [channel 9] (e-/ADU)') + hdu_r.header['GAIN10']=( np.float32(self.information['r_gain10']) , 'CCD gain [channel 10] (e-/ADU)') + hdu_r.header['GAIN11']=( np.float32(self.information['r_gain11']) , 'CCD gain [channel 11] (e-/ADU)') + hdu_r.header['GAIN12']=( np.float32(self.information['r_gain12']) , 'CCD gain [channel 12] (e-/ADU)') + hdu_r.header['GAIN13']=( np.float32(self.information['r_gain13']) , 'CCD gain [channel 13] (e-/ADU)') + hdu_r.header['GAIN14']=( np.float32(self.information['r_gain14']) , 'CCD gain [channel 14] (e-/ADU)') + hdu_r.header['GAIN15']=( np.float32(self.information['r_gain15']) , 'CCD gain [channel 15] (e-/ADU)') + hdu_r.header['GAIN16']=( np.float32(self.information['r_gain16']) , 'CCD gain [channel 16] (e-/ADU)') ####### - hdu_r.header['RDNOIS1'] =( np.float32(self.information['r_rdnois1']) , 'read noise (channel 1)') - hdu_r.header['RDNOIS2'] =( np.float32(self.information['r_rdnois2']) , 'read noise (channel 2)') - hdu_r.header['RDNOIS3'] =( np.float32(self.information['r_rdnois3']) , 'read noise (channel 3)') - hdu_r.header['RDNOIS4'] =( np.float32(self.information['r_rdnois4']) , 'read noise (channel 4)') - hdu_r.header['RDNOIS5'] =( np.float32(self.information['r_rdnois5']) , 'read noise (channel 5)') - hdu_r.header['RDNOIS6'] =( np.float32(self.information['r_rdnois6']) , 'read noise (channel 6)') - hdu_r.header['RDNOIS7'] =( np.float32(self.information['r_rdnois7']) , 'read noise (channel 7)') - hdu_r.header['RDNOIS8'] =( np.float32(self.information['r_rdnois8']) , 'read noise (channel 8)') - hdu_r.header['RDNOIS9'] =( np.float32(self.information['r_rdnois9']) , 'read noise (channel 9)') - hdu_r.header['RDNOIS10']=( np.float32(self.information['r_rdnois10']) , 'read noise (channel 10)') - hdu_r.header['RDNOIS11']=( np.float32(self.information['r_rdnois11']) , 'read noise (channel 11)') - hdu_r.header['RDNOIS12']=( np.float32(self.information['r_rdnois12']) , 'read noise (channel 12)') - hdu_r.header['RDNOIS13']=( np.float32(self.information['r_rdnois13']) , 'read noise (channel 13)') - hdu_r.header['RDNOIS14']=( np.float32(self.information['r_rdnois14']) , 'read noise (channel 14)') - hdu_r.header['RDNOIS15']=( np.float32(self.information['r_rdnois15']) , 'read noise (channel 15)') - hdu_r.header['RDNOIS16']=( np.float32(self.information['r_rdnois16']) , 'read noise (channel 16)') + hdu_r.header['RON01'] =( np.float32(self.information['r_rdnois1']) , 'readout noise [channel 01] (e-)') + hdu_r.header['RON02'] =( np.float32(self.information['r_rdnois2']) , 'readout noise [channel 02] (e-)') + hdu_r.header['RON03'] =( np.float32(self.information['r_rdnois3']) , 'readout noise [channel 03] (e-)') + hdu_r.header['RON04'] =( np.float32(self.information['r_rdnois4']) , 'readout noise [channel 04] (e-)') + hdu_r.header['RON05'] =( np.float32(self.information['r_rdnois5']) , 'readout noise [channel 05] (e-)') + hdu_r.header['RON06'] =( np.float32(self.information['r_rdnois6']) , 'readout noise [channel 06] (e-)') + hdu_r.header['RON07'] =( np.float32(self.information['r_rdnois7']) , 'readout noise [channel 07] (e-)') + hdu_r.header['RON08'] =( np.float32(self.information['r_rdnois8']) , 'readout noise [channel 08] (e-)') + hdu_r.header['RON09'] =( np.float32(self.information['r_rdnois9']) , 'readout noise [channel 09] (e-)') + hdu_r.header['RON10']=( np.float32(self.information['r_rdnois10']) , 'readout noise [channel 10] (e-)') + hdu_r.header['RON11']=( np.float32(self.information['r_rdnois11']) , 'readout noise [channel 11] (e-)') + hdu_r.header['RON12']=( np.float32(self.information['r_rdnois12']) , 'readout noise [channel 12] (e-)') + hdu_r.header['RON13']=( np.float32(self.information['r_rdnois13']) , 'readout noise [channel 13] (e-)') + hdu_r.header['RON14']=( np.float32(self.information['r_rdnois14']) , 'readout noise [channel 14] (e-)') + hdu_r.header['RON15']=( np.float32(self.information['r_rdnois15']) , 'readout noise [channel 15] (e-)') + hdu_r.header['RON16']=( np.float32(self.information['r_rdnois16']) , 'readout noise [channel 16] (e-)') ####### - hdu_r.header['DETBIA1']=( np.float32(self.information['r_detbia1']) , 'amplifier bias voltage (channel 1)') - hdu_r.header['DETBIA2']=( np.float32(self.information['r_detbia2']) , 'amplifier bias voltage (channel 2)') - hdu_r.header['DETBIA3']=( np.float32(self.information['r_detbia3']) , 'amplifier bias voltage (channel 3)') - hdu_r.header['DETBIA4']=( np.float32(self.information['r_detbia4']) , 'amplifier bias voltage (channel 4)') - hdu_r.header['DETBIA5']=( np.float32(self.information['r_detbia5']) , 'amplifier bias voltage (channel 5)') - hdu_r.header['DETBIA6']=( np.float32(self.information['r_detbia6']) , 'amplifier bias voltage (channel 6)') - hdu_r.header['DETBIA7']=( np.float32(self.information['r_detbia7']) , 'amplifier bias voltage (channel 7)') - hdu_r.header['DETBIA8']=( np.float32(self.information['r_detbia8']) , 'amplifier bias voltage (channel 8)') - hdu_r.header['DETBIA9']=( np.float32(self.information['r_detbia9']) , 'amplifier bias voltage (channel 9)') - hdu_r.header['DETBIA10']=( np.float32(self.information['r_detbia10']) , 'amplifier bias voltage (channel 10)') - hdu_r.header['DETBIA11']=( np.float32(self.information['r_detbia11']) , 'amplifier bias voltage (channel 11)') - hdu_r.header['DETBIA12']=( np.float32(self.information['r_detbia12']) , 'amplifier bias voltage (channel 12)') - hdu_r.header['DETBIA13']=( np.float32(self.information['r_detbia13']) , 'amplifier bias voltage (channel 13)') - hdu_r.header['DETBIA14']=( np.float32(self.information['r_detbia14']) , 'amplifier bias voltage (channel 14)') - hdu_r.header['DETBIA15']=( np.float32(self.information['r_detbia15']) , 'amplifier bias voltage (channel 15)') - hdu_r.header['DETBIA16']=( np.float32(self.information['r_detbia16']) , 'amplifier bias voltage (channel 16)') - - ###### - ###### - hdu_r.header['READT0'] =( hdu_g.header['READT0'] , 'read start time (UTC)') - hdu_r.header['READT1'] =( hdu_g.header['READT1'] , 'read end time (UTC)') - hdu_r.header['DETTEMP0']=( np.float32(0) , 'detector temperature at READT0') - hdu_r.header['DETTEMP1']=( np.float32(0) , 'detector temperature at READT1') - hdu_r.header['RDSPEED'] =( np.float32(3) , 'read speed (in MHz)') - - ##### Shutter information ##### - hdu_r.header['SHUTHWV'] =( 'XXXXXXXXXXXXXXXX' , 'shutter hardware version') - hdu_r.header['SHUTSWV'] =( 'XXXXXXXXXXXXXXXX' , 'shutter software') - hdu_r.header['SHUTSTAT']=( bool(True) , 'shutter status,T: open, F: close') - hdu_r.header['SHTOPEN0']=( np.float64(0) , 'shutter open time (begin)') - hdu_r.header['SHTOPEN1']=( np.float64(0) , 'shutter open time (end)') - hdu_r.header['SHTCLOS0']=( np.float64(0) , 'shutter close time (begin)') - hdu_r.header['SHTCLOS1']=( np.float64(0) , 'shutter close time (end)') - ################ finish MCI header for image layer + hdu_r.header['DETBIA01']=( np.float32(self.information['r_detbia1']) , 'amplifier bias grey value [channel 1] (ADU)') + hdu_r.header['DETBIA02']=( np.float32(self.information['r_detbia2']) , 'amplifier bias grey value [channel 2] (ADU)') + hdu_r.header['DETBIA03']=( np.float32(self.information['r_detbia3']) , 'amplifier bias grey value [channel 3] (ADU)') + hdu_r.header['DETBIA04']=( np.float32(self.information['r_detbia4']) , 'amplifier bias grey value [channel 4] (ADU)') + hdu_r.header['DETBIA05']=( np.float32(self.information['r_detbia5']) , 'amplifier bias grey value [channel 5] (ADU)') + hdu_r.header['DETBIA06']=( np.float32(self.information['r_detbia6']) , 'amplifier bias grey value [channel 6] (ADU)') + hdu_r.header['DETBIA07']=( np.float32(self.information['r_detbia7']) , 'amplifier bias grey value [channel 7] (ADU)') + hdu_r.header['DETBIA08']=( np.float32(self.information['r_detbia8']) , 'amplifier bias grey value [channel 8] (ADU)') + hdu_r.header['DETBIA09']=( np.float32(self.information['r_detbia9']) , 'amplifier bias grey value [channel 9] (ADU)') + hdu_r.header['DETBIA10']=( np.float32(self.information['r_detbia10']) , 'amplifier bias grey value [channel 10] (ADU)') + hdu_r.header['DETBIA11']=( np.float32(self.information['r_detbia11']) , 'amplifier bias grey value [channel 11] (ADU)') + hdu_r.header['DETBIA12']=( np.float32(self.information['r_detbia12']) , 'amplifier bias grey value [channel 12] (ADU)') + hdu_r.header['DETBIA13']=( np.float32(self.information['r_detbia13']) , 'amplifier bias grey value [channel 13] (ADU)') + hdu_r.header['DETBIA14']=( np.float32(self.information['r_detbia14']) , 'amplifier bias grey value [channel 14] (ADU)') + hdu_r.header['DETBIA15']=( np.float32(self.information['r_detbia15']) , 'amplifier bias grey value [channel 15] (ADU)') + hdu_r.header['DETBIA16']=( np.float32(self.information['r_detbia16']) , 'amplifier bias grey value [channel 16] (ADU)') + hdu_r.header['ROSPEED'] =( np.float32(100) , 'readout speed (MHz)') + + ###################################### + #### exposure and shutter information ##### + hdu_r.header['EXPSTART']=(np.float64(time2mjd(self.dt)), 'exposure start time (MJD)') + hdu_r.header['EXPEND'] =(float(time2mjd(t2)), 'exposure end time (MJD)') + hdu_r.header['EXPTIME'] =(np.float32(self.information['exptime']), 'exposure times (s)') + hdu_r.header['DARKTIME'] =(np.float32(self.information['exptime']), 'dark current time (s)') + hdu_r.header['SHTSTAT']=( bool(True) , 'shutter status') + + ###### satellite and its allitide information ############## + hdu_r.header['REFFRAME']=('CSSTGSC-1.0' , 'guiding catalog version') + hdu_r.header['SATESWV']=('softwave-1.0', 'satellite software version') + hdu_r.header['CABSTART']=(np.float64(time2jd(self.dt)), 'first cabin time after exposure start (MJD)') + hdu_r.header['SUNANGL0']=(np.float32(0.0) , 'angle between the Sun and opt axis at CABSTART') + hdu_r.header['MOONANG0']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABSTART') + hdu_r.header['TEL_ALT0']=(np.float64(0.0), 'angle between opt axis and Elimb at CABSTART') + hdu_r.header['POS_ANG0']=(np.float64(0.0), 'angle between y axis and North Pole at CABSTART') + hdu_r.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'orbital position in X at CABSTART (km)') + hdu_r.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'orbital position in Y at CABSTART (km)') + hdu_r.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'orbital position in Z at CABSTART (km)') + hdu_r.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'orbital velocity in X at CABSTART (km/s)') + hdu_r.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'orbital velocity in Y at CABSTART (km/s)') + hdu_r.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'orbital velocity in Z at CABSTART (km/s)') + hdu_r.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at CABSTART (deg)') + hdu_r.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at CABSTART (deg)') + hdu_r.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at CABSTART (deg)') + hdu_r.header['RA_PNT0']=( float(self.information['ra_pnt0']) , 'pointing RA at CABSTART (deg)') + hdu_r.header['DEC_PNT0']=(float(self.information['dec_pnt0']) , 'pointing Dec at CABSTART (deg)') + hdu_r.header['CABEND'] =(float(time2jd(t2)) , 'first cabin time after exposure end (MJD)') + hdu_r.header['SUNANGL1']=(np.float32(0.0), 'angle between the Sun and opt axis at CABEND') + hdu_r.header['MOONANG1']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABEND') + hdu_r.header['TEL_ALT1']=(np.float64(0.0) , 'angle between opt axis and Elimb at CABEND') + hdu_r.header['POS_ANG1']=(float(0.0) , 'angle between y axis and North Pole at CABEND') + hdu_r.header['POSI1_X'] =(float(p1x) , 'orbital position in X at CABEND (km)') + hdu_r.header['POSI1_Y'] =(float(p1y) , 'orbital position in Y at CABEND (km)') + hdu_r.header['POSI1_Z'] =(float(p1z) , 'orbital position in Z at CABEND (km)') + hdu_r.header['VELO1_X']=(float(p1vx) , 'orbital velocity in X at CABEND (km/s)') + hdu_r.header['VELO1_Y']=(float(p1vy) , 'orbital velocity in Y at CABEND (km/s)') + hdu_r.header['VELO1_Z']=(float(p1vz), 'orbital velocity in Z at CABEND (km/s)') + hdu_r.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at CABEND (deg)') + hdu_r.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at CABEND (deg)') + hdu_r.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at CABEND (deg)') + hdu_r.header['RA_PNT1'] =(float(hdu_r.header['RA_PNT0']), 'pointing RA at CABEND (deg)') + hdu_r.header['DEC_PNT1']=(float(hdu_r.header['DEC_PNT0']), 'pointing Dec at CABEND (deg)') + hdu_r.header['EPOCH'] =(np.float32(time2jd(t3.utcnow())), 'equinox of pointing RA and Dec') + + ############################################################## + ##### + # hdu_r.header['CHECKSUM'] =('','HDU checksum updated yyyy-mm-ddTHH:MM:SS') + + # hdu_r.header['DATASUM'] =('','data unit checksum updated yyyy-mm-ddTHH:MM:SS') + ################ finish MCI header for image layer in G channel + ##############################################################################################333 - #write the actual file hdulist_r=fits.HDUList([ofd_r, hdu_r]) + #### + ofd_r.header.add_comment('========================================================================',after='FITSSWV') + ofd_r.header.add_comment('OBJECT INFORMATION',after='FITSSWV') + ofd_r.header.add_comment('========================================================================',after='FITSSWV') + + ofd_r.header.add_comment('========================================================================',after='DEC_OBJ') + ofd_r.header.add_comment('TELESCOPE INFORMATION',after='DEC_OBJ') + ofd_r.header.add_comment('========================================================================',after='DEC_OBJ') + + ofd_r.header.add_comment('========================================================================',after='EPOCH') + ofd_r.header.add_comment('VERIFICATION INFORMATION',after='EPOCH') + ofd_r.header.add_comment('========================================================================',after='EPOCH') + + ####################################################################### + hdu_r.header.add_comment('========================================================================',after='BUNIT') + hdu_r.header.add_comment('FILE INFORMATION',after='BUNIT') + hdu_r.header.add_comment('========================================================================',after='BUNIT') + + hdu_r.header.add_comment('========================================================================',after='FITSSWV') + hdu_r.header.add_comment('INSTRUMENT STATUS AND OBJECT INFORMATION',after='FITSSWV') + hdu_r.header.add_comment('========================================================================',after='FITSSWV') - #file_r=self.result_path+'/sky_Data/'+filename_r + hdu_r.header.add_comment('========================================================================',after='DEC_OBJ') + hdu_r.header.add_comment('DETECTOR AND FILTER INFORMATION',after='DEC_OBJ') + hdu_r.header.add_comment('========================================================================',after='DEC_OBJ') + hdu_r.header.add_comment('========================================================================',after='BIN_Y') + hdu_r.header.add_comment('WORLD COORDINATE SYSTEM INFORMATION',after='BIN_Y') + hdu_r.header.add_comment('========================================================================',after='BIN_Y') + + hdu_r.header.add_comment('========================================================================',after='CD2_2') + hdu_r.header.add_comment('READOUT INFORMATION',after='CD2_2') + hdu_r.header.add_comment('========================================================================',after='CD2_2') + + hdu_r.header.add_comment('========================================================================',after='ROSPEED') + hdu_r.header.add_comment('EXPOSURE AND SHUTTER INFORMATION',after='ROSPEED') + hdu_r.header.add_comment('========================================================================',after='ROSPEED') + + hdu_r.header.add_comment('========================================================================',after='SHTSTAT') + hdu_r.header.add_comment('SATELLITE AND ITS ATTITUDE INFORMATION',after='SHTSTAT') + hdu_r.header.add_comment('========================================================================',after='SHTSTAT') + + hdu_r.header.add_comment('========================================================================',after='EPOCH') + hdu_r.header.add_comment('VERIFICATION INFORMATION',after='EPOCH') + hdu_r.header.add_comment('========================================================================',after='EPOCH') + + ##################################### + ################ finish MCI header for image layer in R channel + if self.source=='DARK' or self.source=='FLAT' or self.source=='BIAS': - file_r=self.result_path+'/cali_Data/'+filename_r + file_r=self.result_path+'/cali_Data/'+filename_r+'.fits' else: - file_r=self.result_path+'/sky_Data/'+filename_r + file_r=self.result_path+'/sky_Data/'+filename_r +'.fits' - hdulist_r.writeto(file_r, overwrite=True) + hdulist_r.writeto(file_r, checksum=True) + print('MCI_r.fits is created ') ################################################################################# ### i band @@ -3091,222 +4724,380 @@ class MCIsimulator(): #create a new FITS file, using HDUList instance ofd_i = fits.PrimaryHDU() - filename_i='CSST_MCI_C3_'+self.source+'_'+exp_starttime+'_'+exp_endtime+'_'+str(obsid)+'_'+ \ - str(self.filterP[self.filter_i]['number'])+'_L0_'+self.information['ver']+'.fits' - #### add primary header - ofd_i.header['GROUPS']=( bool(False), 'always F') - ofd_i.header['DATE'] =( ofd_g.header['DATE'], 'date this file was written' ) + if self.filterP[self.filter_i]['number']>9: + filternum=str(self.filterP[self.filter_i]['number']) + else: + filternum='0'+str(self.filterP[self.filter_i]['number']) + - ofd_i.header['FILENAME']=(filename_i, ' file name C48 ') - ofd_i.header['OBSTYPE'] =( self.source, 'observation type raw,flt, mask, bias, dark, sci') - ofd_i.header['TELESCOP']=('CSST', 'always CSST') - ofd_i.header['INSTRUME']=( 'MCI', ' ') - ofd_i.header['RADECSYS']=('ICRS', ' always ICRS ') - ofd_i.header['EQUINOX'] =( float(2000.0), 'always 2000.0') - ofd_i.header['FITSCREA']=( '4.2.1', 'FITS create software version') + filename_i='CSST_MCI_C3_'+self.source+'_'+exp_starttime+'_'+exp_endtime+'_'+str(obsid)+'_'+ \ + filternum+'_L0_V01' - ######### Object information ############# + #### add primary header - ofd_i.header['OBJECT']=( self.information['name_obj'], 'object name') - ofd_i.header['TARGET']=( self.information['target'], 'target name, hhmmss+ddmmss') - ofd_i.header['OBJ_RA'] =(np.float64(self.information['ra_obj']) , 'RA of the object in deg') - ofd_i.header['OBJ_DEC']=(np.float64(self.information['dec_obj']) , 'DEC of the object in deg') + ofd_i.header['SIMPLE']=( True, 'conforms to FITS standard') + ofd_i.header['BITPIX']=( 0, 'array data type') + ofd_i.header['NAXIS'] =( 0, 'number of array dimensions') + ofd_i.header['NEXTEND']=( np.int16(1), 'number of array dimensions') + ############################### + temp=t3.utcnow() + data_time=temp.strftime("%Y-%m-%dT%H:%M:%S.%f") + ofd_i.header['DATE'] =(data_time[:21], 'written date (yyyy-mm-ddThh:mm:ss.s)') + ofd_i.header['FILENAME']=(filename_i[:68],'') + ofd_i.header['FILETYPE'] =( self.source[:12], 'observation type') + ofd_i.header['TELESCOP']=('CSST', 'telescope name') + ofd_i.header['INSTRUME']=('MCI', 'instrument name') + ofd_i.header['RADECSYS']=('ICRS', 'coordinate system of the object') + ofd_i.header['EQUINOX'] =(float(2000.0), '') + ofd_i.header['FITSSWV']=('mci_sim_0.8.03', 'FITS creating software version') + ############################################################################## + ######### Object information ######################################### + ofd_i.header['OBJECT'] =(self.information['name_obj'][:30], 'object name') + ofd_i.header['TARGET'] =(self.information['target'][:13], 'target name (hhmmss.s+ddmmss)') + ####################################################################### + ofd_i.header['OBSID'] =(str(obsid) , 'observation ID') + ofd_i.header['RA_OBJ'] =(float(self.information['ra_obj']) , 'object RA (deg)') + ofd_i.header['DEC_OBJ']=(float(self.information['dec_obj']) , 'object Dec (deg)') + - ofd_i.header['RA_PNT0'] =( np.float64(self.information['ra_pnt0']) , 'RA of the pointing (degrees) at EXPSTART') - ofd_i.header['DEC_PNT0']=(np.float64(self.information['dec_pnt0']) , 'DEC of the pointing (degrees) at EXPSTART') - + ######## Telescope information ############### + ofd_i.header['REFFRAME']=('CSSTGSC-1.0' , 'guiding catalog version') + ofd_i.header['DATE-OBS']=(data_time[:21] , 'observation date (yyyy-mm-ddThh:mm:ss.s)') + ofd_i.header['SATESWV']=('softwave-1.0', 'satellite software version') + ofd_i.header['EXPSTART']=(np.float64(time2mjd(self.dt)), 'exposure start time (MJD)') + ofd_i.header['CABSTART']=(np.float64(time2jd(self.dt)), 'first cabin time after exposure start (MJD)') + ofd_i.header['SUNANGL0']=(np.float32(0.0) , 'angle between the Sun and opt axis at CABSTART') + ofd_i.header['MOONANG0']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABSTART') + ofd_i.header['TEL_ALT0']=(np.float64(0.0), 'angle between opt axis and Elimb at CABSTART') + ofd_i.header['POS_ANG0']=(np.float64(0.0), 'angle between y axis and North Pole at CABSTART') + ofd_i.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'orbital position in X at CABSTART (km)') + ofd_i.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'orbital position in Y at CABSTART (km)') + ofd_i.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'orbital position in Z at CABSTART (km)') + ofd_i.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'orbital velocity in X at CABSTART (km/s)') + ofd_i.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'orbital velocity in Y at CABSTART (km/s)') + ofd_i.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'orbital velocity in Z at CABSTART (km/s)') + ofd_i.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at CABSTART (deg)') + ofd_i.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at CABSTART (deg)') + ofd_i.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at CABSTART (deg)') + + + ofd_i.header['RA_PNT0']=( float(self.information['ra_pnt0']) , 'pointing RA at CABSTART (deg)') + ofd_i.header['DEC_PNT0']=(float(self.information['dec_pnt0']) , 'pointing Dec at CABSTART (deg)') + ofd_i.header['EXPEND'] =(float(time2mjd(t2)), 'exposure end time (MJD)') + ofd_i.header['CABEND'] =(float(time2jd(t2)) , 'first cabin time after exposure end (MJD)') + ofd_i.header['SUNANGL1']=(np.float32(0.0), 'angle between the Sun and opt axis at CABEND') + ofd_i.header['MOONANG1']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABEND') + ofd_i.header['TEL_ALT1']=(np.float64(0.0) , 'angle between opt axis and Elimb at CABEND') + ofd_i.header['POS_ANG1']=(float(0.0) , 'angle between y axis and North Pole at CABEND') + + + ############################################################## + + ofd_i.header['POSI1_X'] =(float(p1x) , 'orbital position in X at CABEND (km)') + ofd_i.header['POSI1_Y'] =(float(p1y) , 'orbital position in Y at CABEND (km)') + ofd_i.header['POSI1_Z'] =(float(p1z) , 'orbital position in Z at CABEND (km)') - ############## - ofd_i.header['OBSID'] =(str(obsid) , 'observation ID, 3+8bit') + ofd_i.header['VELO1_X']=(float(p1vx) , 'orbital velocity in X at CABEND (km/s)') + ofd_i.header['VELO1_Y']=(float(p1vy) , 'orbital velocity in Y at CABEND (km/s)') + ofd_i.header['VELO1_Z']=(float(p1vz), 'orbital velocity in Z at CABEND (km/s)') - ######## Telescope information ############### - # ofd_i.header['COMMENT'] ='==========================================================' - # ofd_i.header['COMMENT'] ='Telescope information' - # ofd_i.header['COMMENT'] ='==========================================================' - - ofd_i.header['REFFRAME']=('CSSTGSC-1.0' , 'guide star catalog version') - ofd_i.header['DATE-OBS']=(ofd_g.header['DATE-OBS'] , 'date of the observation (yyyy-mm-dd hh:mm:ss)') - - ofd_i.header['EXPSTART']=(ofd_g.header['EXPSTART'], 'exposure start time') - ofd_i.header['SUNANGL0']=(np.float32(0.0) , 'angle between sun and optical axis at EXPSTART') - ofd_i.header['MOONANG0']=(np.float32(0.0) , 'angle between moon and optical axis at EXPSTART') - ofd_i.header['POS_ANG0']=(np.float64(0.0), 'angle between optical axis and the North Pole at EXPSTART in arcsec') - ofd_i.header['TEL_ALT0']=(np.float64(0.0), 'angle between optical axis and the ground- piston at EXPSTART in deg') - - ofd_i.header['HOODSTA0']=(np.float32(0.0) , 'lens hood altitude at EXPSTART') - ofd_i.header['HOODANG0']=(np.float32(0.0), 'lens hood azimuth at EXPSTART') - ofd_i.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'the orbital position of CSST in X direction at EXPSTART') - ofd_i.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'the orbital position of CSST in Y direction at EXPSTART') - ofd_i.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'the orbital position of CSST in Z direction at EXPSTART') - ofd_i.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'the orbital velocity of CSST in X direction at EXPSTART') - ofd_i.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'the orbital velocity of CSST in Y direction at EXPSTART') - ofd_i.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'the orbital velocity of CSST in Z direction at EXPSTART') - - ofd_i.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at EXPSTART') - ofd_i.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at EXPSTART') - ofd_i.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at EXPSTART') - - ofd_i.header['EXPEND'] =(ofd_g.header['EXPEND'] , 'exposure end time') - - ofd_i.header['SUNANGL1']=(np.float32(0.0), 'angle between sun and optical axis at EXPEND') - ofd_i.header['MOONANG1']=(np.float32(0.0) , 'angle between moon and optical axis at EXPEND ') - ofd_i.header['POS_ANG1']=(np.float64(0.0) , 'angle between optical axis and the North Pole at EXPEND in arcsec') - ofd_i.header['TEL_ALT1']=(np.float64(0.0) , 'angle between optical axis and the ground- piston at EXPEND in deg ') - ofd_i.header['HOODSTA1']=(np.float32(0.0), 'lens hood altitude at EXPEND ') - ofd_i.header['HOODANG1']=(np.float32(0.0), 'lens hood azimuth at EXPEND ') - ofd_i.header['POSI1_X'] =(np.float64(p1x) , 'the orbital position of CSST in X direction at EXPEND') - ofd_i.header['POSI1_Y'] =(np.float64(p1y) , 'the orbital position of CSST in Y direction at EXPEND') - ofd_i.header['POSI1_Z'] =(np.float64(p1z) , 'the orbital position of CSST in Z direction at EXPEND') - - ofd_i.header['VELO1_X']=(np.float64(p1vx) , 'the orbital velocity of CSST in X direction at EXPEND') - ofd_i.header['VELO1_Y']=(np.float64(p1vy) , 'the orbital velocity of CSST in Y direction at EXPEND') - ofd_i.header['VELO1_Z']=(np.float64(p1vz) , 'the orbital velocity of CSST in Z direction at EXPEND') - - ofd_i.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at EXPEND') - ofd_i.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at EXPEND') - ofd_i.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at EXPEND') - - ofd_i.header['RA_PNT1']=(np.float64(0.0), 'RA of the pointing (degrees) at EXPEND in deg') - ofd_i.header['DEC_PNT1']=(np.float64(0.0), 'DEC of the pointing (degrees) at EXPEND in deg') - - ofd_i.header['EXPTIME']=(self.information['exptime'], 'exposure duration') - ofd_i.header['EPOCH'] =(np.float32(0.0), 'coordinate epoch') - ofd_i.header['CHECKSUM']=( 0 , 'hdu-checksum') + ################### + + ofd_i.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at CABEND (deg)') + ofd_i.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at CABEND (deg)') + ofd_i.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at CABEND (deg)') + ofd_i.header['RA_PNT1'] =(float(ofd_i.header['RA_PNT0']), 'pointing RA at CABEND (deg)') + ofd_i.header['DEC_PNT1']=(float(ofd_i.header['DEC_PNT0']), 'pointing Dec at CABEND (deg)') + ofd_i.header['EPOCH'] =(np.float32(time2jd(t3.utcnow())), 'equinox of pointing RA and Dec') + ofd_i.header['EXPTIME']=(np.float32(self.information['exptime']), 'exposure time (s)') + + ss1='HDU checksum' + ss2='data unit checksum' + ofd_i.header['CHECKSUM']=( data_time[:19] , ss1) + ofd_i.header['DATASUM'] =( data_time[:19] , ss2) + ################################################ + ########## finish header for 0 layer #################### + ########## finish header for 0 layer #new image HDU - hdu_i = fits.ImageHDU(data=np.uint16(self.image_i)) + if HeaderTest=='yes': + hdu_i = fits.ImageHDU() + else: + hdu_i = fits.ImageHDU(data=np.uint16(self.image_i)) + + #### need review thie header + ### MCI header for image layer ### + #### need review thie header + hdu_i.header['XTENSION']=( 'IMAGE' , 'extension type') + hdu_i.header['BITPIX'] =( np.int16(16) , 'array data type') + hdu_i.header['NAXIS'] =( np.int16(2) , 'number of array dimensions') + hdu_i.header['NAXIS1'] =( np.int32(4936) , '') + hdu_i.header['NAXIS2'] =( np.int32(23984) , '') - ### MCI header for immage layer ### - #### Instrument information (at EXPSTART time) - hdu_i.header['PMIRRPOS']=( bool(True) , 'FSM pointing,T: point to MCI, F: not point to MCI ') - hdu_i.header['DIFFUSER']=( bool(True) , 'insert diffuser for flat calibration,T: insert diffuser, F: not insert diffuser ') - hdu_i.header['FLAMP'] =( np.int16(0) , 'status of flat lamp,0: off, 1: 1, 2: 2, 3: 3') - hdu_i.header['MCITEMP'] =( np.float32(0.0), 'MCI components temperature') - hdu_i.header['MCISTAT'] =( np.int16(0) , 'MCI components status parameters') - ##### Filter information ##### - hdu_i.header['FILTER'] =(self.filter_i , 'filter band name') - + hdu_i.header['PCOUNT']=( np.int16(0) , 'number of parameters') + hdu_i.header['GCOUNT']=( np.int16(1) , 'number of groups') + + hdu_i.header['BSCALE']=(int(1),'') + hdu_i.header['BZERO'] =(int(32768),'') + + hdu_i.header['EXTNAME']=( 'SCI' , '') + hdu_i.header['EXTVER']=(np.int16(1),'') + + hdu_i.header['BUNIT'] =('ADU','physical unit of array values') + + ###### file information ############### + + temp=t3.utcnow() + data_time=temp.strftime("%Y-%m-%dT%H:%M:%S.%f") + hdu_i.header['DATE'] =(data_time[:21], 'written date (yyyy-mm-ddThh:mm:ss.s)') + hdu_i.header['FILENAME']=(filename_i[:68],'') + hdu_i.header['FILETYPE'] =( self.source[:12], 'observation type') + hdu_i.header['RADECSYS']=('ICRS', 'coordinate system of the object') + hdu_i.header['EQUINOX'] =(float(2000.1), '') + hdu_i.header['FITSSWV']=('4.2.1', 'FITS creating software version') + + ######################################## + + #### instrument status and object information ###### + hdu_i.header['TELESCOP']=('CSST', 'telescope name') + hdu_i.header['INSTRUME']=('MCI', 'instrument name') + hdu_i.header['CHANNEL'] =('C1', 'channel number') + hdu_i.header['FILTERNO'] =(filternum, 'filter number') + hdu_i.header['DIFFUSER']=( bool(True) , 'insert diffuser for flat calibration') + hdu_i.header['FLAMP'] =( np.int16(0) , 'status of flat lamp') + hdu_i.header['MCISTAT'] =( np.int16(0) , 'MCI componetns status parameter') + + hdu_i.header['DATE_OBS'] =(data_time[:21] , 'observation date (yyyy-mm-ddThh:mm:ss.s)') + hdu_i.header['OBJECT'] =( 'MCI_obj' , 'object name') + + hdu_i.header['TARGET'] =(self.information['target'][:13], 'target name (hhmmss.s+ddmmss)') + ####################################################################### + hdu_i.header['OBSID'] =(str(obsid) , 'observation ID') + hdu_i.header['RA_OBJ'] =(float(self.information['ra_obj']) , 'object RA (deg)') + hdu_i.header['DEC_OBJ']=(float(self.information['dec_obj']) , 'object Dec (deg)') + + + + ##### detector and Filter information ##### + hdu_i.header['FILTER'] =(self.filter_i[:6] , 'filter band') ##### Detector information #### - hdu_i.header['DETNAM'] =('C3' , 'detector name for channle 3') - hdu_i.header['DETTEMP'] =(np.float32(0) , 'detector temperature') - hdu_i.header['DETSIZE'] =(str(self.image_i.shape[0])+'*'+str(self.image_i.shape[1]), 'detector size') - hdu_i.header['DATASEC'] =(str(self.information['ysize'])+'*'+str( self.information['xsize']), 'data section') - hdu_i.header['PIXSCAL1']=(np.float32(0.05) , 'pixel scale for axis 1') - hdu_i.header['PIXSCAL2']=(np.float32(0.05) , 'pixel scale for axis 2') - hdu_i.header['PIXSIZE1']=(np.float32(10.0) , 'pixel size for axis 1') - hdu_i.header['PIXSIZE2']=(np.float32(10.0) , 'pixel size for axis 2') - hdu_i.header['NCHAN'] =(np.int16(16) , 'number of readout channels') - hdu_i.header['NCHAN1'] =(np.int16(8) , 'number of horizontal channels') - hdu_i.header['NCHAN2'] =(np.int16(2) , 'number of vertical channels') + hdu_i.header['DETSN'] =('E2V-CCD-290-0000000' , 'detector serial number') + hdu_i.header['DETNAME'] =('opt-red' , 'detector name') + ####need review here + + + hdu_i.header['DETTEMP0'] =(np.float32(0) , 'detector temperature at EXPSTART (K)') + hdu_i.header['DETTEMP1'] =(np.float32(0) , 'detector temperature at EXPEND (K)') + hdu_i.header['DETTEMP2'] =(np.float32(0) , 'detector temperature at READT1 (K)') + + + + hdu_i.header['DETSIZE'] =(str(self.information['ysize'])+'*'+str( self.information['xsize']), 'detector size') + hdu_i.header['DATASECT'] =(str(self.image_g.shape[0])+'*'+str(self.image_g.shape[1]), 'data section') + + hdu_i.header['PIXSCAL1']=('0.05' , 'pixel scale for axis 1 (arcsec/pixel)') + hdu_i.header['PIXSCAL2']=('0.05' , 'pixel scale for axis 2 (arcsec/pixel)') + + hdu_i.header['PIXSIZE1']=(int(10) , 'pixel size for axis 1 (micron)') + hdu_i.header['PIXSIZE2']=(int(10) , 'pixel size for axis 2 (micron)') + + hdu_i.header['NCHANNEL'] =(np.int16(16) , 'number of readout channels') + + hdu_i.header['PSCAN1'] =(np.int32(27) , 'horizontal prescan width, per readout channel') - hdu_i.header['PSCAN2'] =(np.int32(8) , 'vertical prescan height, per readout channel') - hdu_i.header['OSCAN1'] =(np.int32(16) , 'horizontal overscan width, per readout channel') - hdu_i.header['OSCAN2'] =(np.int32(8) , 'vertical overscan width, per readout channel') - hdu_i.header['BIN_X'] =(np.int16(0) , 'bin number in X (wavelength)') - hdu_i.header['BIN_Y'] =(np.int16(0) , 'bin number in Y (spatial)') + hdu_i.header['PSCAN2'] =(np.int32(0) , 'vertical prescan height, per readout channel') - #### World coordinate system and related parameters ##### + hdu_i.header['OSCAN1'] =(np.int32(320) , 'horizontal overscan width, per readout channel') + hdu_i.header['OSCAN2'] =(np.int32(320) , 'vertical overscan width, per readout channel') + + hdu_i.header['BIN_X'] =(np.int16(1) , 'bin number in X') + hdu_i.header['BIN_Y'] =(np.int16(1) , 'bin number in Y') + + #### World coordinate system information ##### - hdu_i.header['WCSAXES']=( np.int16(2) , 'number of World Coordinate System axes') - hdu_i.header['CRPIX1'] =( np.float64(self.information['CRPIX1']) , 'x-coordinate of reference pixel') - hdu_i.header['CRPIX2'] =( np.float64(self.information['CRPIX2']) , 'y-coordinate of reference pixel') - hdu_i.header['CRVAL1'] =( np.float64(self.information['CRVAL1']) , 'first axis value at reference pixel') - hdu_i.header['CRVAL2'] =( np.float64(self.information['CRVAL2']) , 'second axis value at reference pixel') - hdu_i.header['CTYPE1'] =( 'RA---TAN' , 'the coordinate type for the first axis') - hdu_i.header['CTYPE2'] =( 'DEC---TAN' , 'the coordinate type for the second axis') - hdu_i.header['CD1_1'] =( np.float64(self.information['CD1_1']) , 'partial of first axis coordinate w.r.t. x') - hdu_i.header['CD1_2'] =( np.float64(self.information['CD1_2']) , 'partial of first axis coordinate w.r.t. y') - hdu_i.header['CD2_1'] =( np.float64(self.information['CD2_1']) , 'partial of second axis coordinate w.r.t. x') - hdu_i.header['CD2_2'] =( np.float64(self.information['CD2_2']) , 'partial of second axis coordinate w.r.t. y') - hdu_i.header['others'] =( 0.0 , 'other specific parameters') + hdu_i.header['WCSAXES']=(np.int16(2) , 'number of World Coordinate System axes') + hdu_i.header['CRPIX1'] =( round(float(self.information['CRPIX1']) ,1) , 'x-coordinate of reference pixel') + hdu_i.header['CRPIX2'] =( round(float(self.information['CRPIX2']) ,1) , 'y-coordinate of reference pixel') + + hdu_i.header['CRVAL1'] =( float(self.information['CRVAL1']) , 'value of reference pixel on axis 1') + hdu_i.header['CRVAL2'] =( float(self.information['CRVAL2']) , 'value of reference pixel on axis 2') + + hdu_i.header['CTYPE1'] =( 'RA---TAN' , 'type of RA WCS projection') + hdu_i.header['CTYPE2'] =( 'DEC--TAN' , 'type of Dec WCS projection') + + hdu_i.header['CD1_1'] =( float(self.information['CD1_1']) , 'transformation matrix element (deg/pix)') + hdu_i.header['CD1_2'] =( float(self.information['CD1_2']) , 'transformation matrix element (deg/pix)') + hdu_i.header['CD2_1'] =( float(self.information['CD2_1']) , 'transformation matrix element (deg/pix)') + hdu_i.header['CD2_2'] =( float(self.information['CD2_2']) , 'transformation matrix element (deg/pix)') + ###### Readout information ####### - hdu_i.header['GAIN1'] =( np.float32(self.information['i_gain1']) , 'CCD gain (channel 1)') - hdu_i.header['GAIN2'] =( np.float32(self.information['i_gain2']) , 'CCD gain (channel 2)') - hdu_i.header['GAIN3'] =( np.float32(self.information['i_gain3']) , 'CCD gain (channel 3)') - hdu_i.header['GAIN4'] =( np.float32(self.information['i_gain4']) , 'CCD gain (channel 4)') - hdu_i.header['GAIN5'] =( np.float32(self.information['i_gain5']) , 'CCD gain (channel 5)') - hdu_i.header['GAIN6'] =( np.float32(self.information['i_gain6']) , 'CCD gain (channel 6)') - hdu_i.header['GAIN7'] =( np.float32(self.information['i_gain7']) , 'CCD gain (channel 7)') - hdu_i.header['GAIN8'] =( np.float32(self.information['i_gain8']) , 'CCD gain (channel 8)') - hdu_i.header['GAIN9'] =( np.float32(self.information['i_gain9']) , 'CCD gain (channel 9)') - hdu_i.header['GAIN10']=( np.float32(self.information['i_gain10']) , 'CCD gain (channel 10)') - hdu_i.header['GAIN11']=( np.float32(self.information['i_gain11']) , 'CCD gain (channel 11)') - hdu_i.header['GAIN12']=( np.float32(self.information['i_gain12']) , 'CCD gain (channel 12)') - hdu_i.header['GAIN13']=( np.float32(self.information['i_gain13']) , 'CCD gain (channel 13)') - hdu_i.header['GAIN14']=( np.float32(self.information['i_gain14']) , 'CCD gain (channel 14)') - hdu_i.header['GAIN15']=( np.float32(self.information['i_gain15']) , 'CCD gain (channel 15)') - hdu_i.header['GAIN16']=( np.float32(self.information['i_gain16']) , 'CCD gain (channel 16)') + hdu_i.header['GAINLVL'] =( np.float32(1.5) , 'gain level (e-/ADU)') + hdu_i.header['GAIN01'] =( np.float32(self.information['i_gain1']) , 'CCD gain [channel 1] (e-/ADU)') + hdu_i.header['GAIN02'] =( np.float32(self.information['i_gain2']) , 'CCD gain [channel 2] (e-/ADU)') + hdu_i.header['GAIN03'] =( np.float32(self.information['i_gain3']) , 'CCD gain [channel 3] (e-/ADU)') + hdu_i.header['GAIN04'] =( np.float32(self.information['i_gain4']) , 'CCD gain [channel 4] (e-/ADU)') + hdu_i.header['GAIN05'] =( np.float32(self.information['i_gain5']) , 'CCD gain [channel 5] (e-/ADU)') + hdu_i.header['GAIN06'] =( np.float32(self.information['i_gain6']) , 'CCD gain [channel 6] (e-/ADU)') + hdu_i.header['GAIN07'] =( np.float32(self.information['i_gain7']) , 'CCD gain [channel 7] (e-/ADU)') + hdu_i.header['GAIN08'] =( np.float32(self.information['i_gain8']) , 'CCD gain [channel 8] (e-/ADU)') + hdu_i.header['GAIN09'] =( np.float32(self.information['i_gain9']) , 'CCD gain [channel 9] (e-/ADU)') + hdu_i.header['GAIN10']=( np.float32(self.information['i_gain10']) , 'CCD gain [channel 10] (e-/ADU)') + hdu_i.header['GAIN11']=( np.float32(self.information['i_gain11']) , 'CCD gain [channel 11] (e-/ADU)') + hdu_i.header['GAIN12']=( np.float32(self.information['i_gain12']) , 'CCD gain [channel 12] (e-/ADU)') + hdu_i.header['GAIN13']=( np.float32(self.information['i_gain13']) , 'CCD gain [channel 13] (e-/ADU)') + hdu_i.header['GAIN14']=( np.float32(self.information['i_gain14']) , 'CCD gain [channel 14] (e-/ADU)') + hdu_i.header['GAIN15']=( np.float32(self.information['i_gain15']) , 'CCD gain [channel 15] (e-/ADU)') + hdu_i.header['GAIN16']=( np.float32(self.information['i_gain16']) , 'CCD gain [channel 16] (e-/ADU)') ####### - hdu_i.header['RDNOIS1'] =( np.float32(self.information['i_rdnois1']) , 'read noise (channel 1)') - hdu_i.header['RDNOIS2'] =( np.float32(self.information['i_rdnois2']) , 'read noise (channel 2)') - hdu_i.header['RDNOIS3'] =( np.float32(self.information['i_rdnois3']) , 'read noise (channel 3)') - hdu_i.header['RDNOIS4'] =( np.float32(self.information['i_rdnois4']) , 'read noise (channel 4)') - hdu_i.header['RDNOIS5'] =( np.float32(self.information['i_rdnois5']) , 'read noise (channel 5)') - hdu_i.header['RDNOIS6'] =( np.float32(self.information['i_rdnois6']) , 'read noise (channel 6)') - hdu_i.header['RDNOIS7'] =( np.float32(self.information['i_rdnois7']) , 'read noise (channel 7)') - hdu_i.header['RDNOIS8'] =( np.float32(self.information['i_rdnois8']) , 'read noise (channel 8)') - hdu_i.header['RDNOIS9'] =( np.float32(self.information['i_rdnois9']) , 'read noise (channel 9)') - hdu_i.header['RDNOIS10']=( np.float32(self.information['i_rdnois10']) , 'read noise (channel 10)') - hdu_i.header['RDNOIS11']=( np.float32(self.information['i_rdnois11']) , 'read noise (channel 11)') - hdu_i.header['RDNOIS12']=( np.float32(self.information['i_rdnois12']) , 'read noise (channel 12)') - hdu_i.header['RDNOIS13']=( np.float32(self.information['i_rdnois13']) , 'read noise (channel 13)') - hdu_i.header['RDNOIS14']=( np.float32(self.information['i_rdnois14']) , 'read noise (channel 14)') - hdu_i.header['RDNOIS15']=( np.float32(self.information['i_rdnois15']) , 'read noise (channel 15)') - hdu_i.header['RDNOIS16']=( np.float32(self.information['i_rdnois16']) , 'read noise (channel 16)') + hdu_i.header['RON01'] =( np.float32(self.information['i_rdnois1']) , 'readout noise [channel 01] (e-)') + hdu_i.header['RON02'] =( np.float32(self.information['i_rdnois2']) , 'readout noise [channel 02] (e-)') + hdu_i.header['RON03'] =( np.float32(self.information['i_rdnois3']) , 'readout noise [channel 03] (e-)') + hdu_i.header['RON04'] =( np.float32(self.information['i_rdnois4']) , 'readout noise [channel 04] (e-)') + hdu_i.header['RON05'] =( np.float32(self.information['i_rdnois5']) , 'readout noise [channel 05] (e-)') + hdu_i.header['RON06'] =( np.float32(self.information['i_rdnois6']) , 'readout noise [channel 06] (e-)') + hdu_i.header['RON07'] =( np.float32(self.information['i_rdnois7']) , 'readout noise [channel 07] (e-)') + hdu_i.header['RON08'] =( np.float32(self.information['i_rdnois8']) , 'readout noise [channel 08] (e-)') + hdu_i.header['RON09'] =( np.float32(self.information['i_rdnois9']) , 'readout noise [channel 09] (e-)') + hdu_i.header['RON10']=( np.float32(self.information['i_rdnois10']) , 'readout noise [channel 10] (e-)') + hdu_i.header['RON11']=( np.float32(self.information['i_rdnois11']) , 'readout noise [channel 11] (e-)') + hdu_i.header['RON12']=( np.float32(self.information['i_rdnois12']) , 'readout noise [channel 12] (e-)') + hdu_i.header['RON13']=( np.float32(self.information['i_rdnois13']) , 'readout noise [channel 13] (e-)') + hdu_i.header['RON14']=( np.float32(self.information['i_rdnois14']) , 'readout noise [channel 14] (e-)') + hdu_i.header['RON15']=( np.float32(self.information['i_rdnois15']) , 'readout noise [channel 15] (e-)') + hdu_i.header['RON16']=( np.float32(self.information['i_rdnois16']) , 'readout noise [channel 16] (e-)') ####### - hdu_i.header['DETBIA1']=( np.float32(self.information['i_detbia1']) , 'amplifier bias voltage (channel 1)') - hdu_i.header['DETBIA2']=( np.float32(self.information['i_detbia2']) , 'amplifier bias voltage (channel 2)') - hdu_i.header['DETBIA3']=( np.float32(self.information['i_detbia3']) , 'amplifier bias voltage (channel 3)') - hdu_i.header['DETBIA4']=( np.float32(self.information['i_detbia4']) , 'amplifier bias voltage (channel 4)') - hdu_i.header['DETBIA5']=( np.float32(self.information['i_detbia5']) , 'amplifier bias voltage (channel 5)') - hdu_i.header['DETBIA6']=( np.float32(self.information['i_detbia6']) , 'amplifier bias voltage (channel 6)') - hdu_i.header['DETBIA7']=( np.float32(self.information['i_detbia7']) , 'amplifier bias voltage (channel 7)') - hdu_i.header['DETBIA8']=( np.float32(self.information['i_detbia8']) , 'amplifier bias voltage (channel 8)') - hdu_i.header['DETBIA9']=( np.float32(self.information['i_detbia9']) , 'amplifier bias voltage (channel 9)') - hdu_i.header['DETBIA10']=( np.float32(self.information['i_detbia10']) , 'amplifier bias voltage (channel 10)') - hdu_i.header['DETBIA11']=( np.float32(self.information['i_detbia11']) , 'amplifier bias voltage (channel 11)') - hdu_i.header['DETBIA12']=( np.float32(self.information['i_detbia12']) , 'amplifier bias voltage (channel 12)') - hdu_i.header['DETBIA13']=( np.float32(self.information['i_detbia13']) , 'amplifier bias voltage (channel 13)') - hdu_i.header['DETBIA14']=( np.float32(self.information['i_detbia14']) , 'amplifier bias voltage (channel 14)') - hdu_i.header['DETBIA15']=( np.float32(self.information['i_detbia15']) , 'amplifier bias voltage (channel 15)') - hdu_i.header['DETBIA16']=( np.float32(self.information['i_detbia16']) , 'amplifier bias voltage (channel 16)') - - ###### - ###### - hdu_i.header['READT0'] =( hdu_g.header['READT0'] , 'read start time (UTC)') - hdu_i.header['READT1'] =( hdu_g.header['READT1'] , 'read end time (UTC)') - hdu_i.header['DETTEMP0']=( np.float32(0) , 'detector temperature at READT0') - hdu_i.header['DETTEMP1']=( np.float32(0) , 'detector temperature at READT1') - hdu_i.header['RDSPEED'] =( np.float32(3) , 'read speed (in MHz)') - - ##### Shutter information ##### - hdu_i.header['SHUTHWV'] =( 'XXXXXXXXXXXXXXXX' , 'shutter hardware version') - hdu_i.header['SHUTSWV'] =( 'XXXXXXXXXXXXXXXX' , 'shutter software') - hdu_i.header['SHUTSTAT']=( bool(True) , 'shutter status,T: open, F: close') - hdu_i.header['SHTOPEN0']=( np.float64(0) , 'shutter open time (begin)') - hdu_i.header['SHTOPEN1']=( np.float64(0) , 'shutter open time (end)') - hdu_i.header['SHTCLOS0']=( np.float64(0) , 'shutter close time (begin)') - hdu_i.header['SHTCLOS1']=( np.float64(0) , 'shutter close time (end)') - ################ finish MCI header for image layer + hdu_i.header['DETBIA01']=( np.float32(self.information['i_detbia1']) , 'amplifier bias grey value [channel 1] (ADU)') + hdu_i.header['DETBIA02']=( np.float32(self.information['i_detbia2']) , 'amplifier bias grey value [channel 2] (ADU)') + hdu_i.header['DETBIA03']=( np.float32(self.information['i_detbia3']) , 'amplifier bias grey value [channel 3] (ADU)') + hdu_i.header['DETBIA04']=( np.float32(self.information['i_detbia4']) , 'amplifier bias grey value [channel 4] (ADU)') + hdu_i.header['DETBIA05']=( np.float32(self.information['i_detbia5']) , 'amplifier bias grey value [channel 5] (ADU)') + hdu_i.header['DETBIA06']=( np.float32(self.information['i_detbia6']) , 'amplifier bias grey value [channel 6] (ADU)') + hdu_i.header['DETBIA07']=( np.float32(self.information['i_detbia7']) , 'amplifier bias grey value [channel 7] (ADU)') + hdu_i.header['DETBIA08']=( np.float32(self.information['i_detbia8']) , 'amplifier bias grey value [channel 8] (ADU)') + hdu_i.header['DETBIA09']=( np.float32(self.information['i_detbia9']) , 'amplifier bias grey value [channel 9] (ADU)') + hdu_i.header['DETBIA10']=( np.float32(self.information['i_detbia10']) , 'amplifier bias grey value [channel 10] (ADU)') + hdu_i.header['DETBIA11']=( np.float32(self.information['i_detbia11']) , 'amplifier bias grey value [channel 11] (ADU)') + hdu_i.header['DETBIA12']=( np.float32(self.information['i_detbia12']) , 'amplifier bias grey value [channel 12] (ADU)') + hdu_i.header['DETBIA13']=( np.float32(self.information['i_detbia13']) , 'amplifier bias grey value [channel 13] (ADU)') + hdu_i.header['DETBIA14']=( np.float32(self.information['i_detbia14']) , 'amplifier bias grey value [channel 14] (ADU)') + hdu_i.header['DETBIA15']=( np.float32(self.information['i_detbia15']) , 'amplifier bias grey value [channel 15] (ADU)') + hdu_i.header['DETBIA16']=( np.float32(self.information['i_detbia16']) , 'amplifier bias grey value [channel 16] (ADU)') + hdu_i.header['ROSPEED'] =( np.float32(100) , 'readout speed (MHz)') + + ###################################### + #### exposure and shutter information ##### + hdu_i.header['EXPSTART']=(np.float64(time2mjd(self.dt)), 'exposure start time (MJD)') + hdu_i.header['EXPEND'] =(float(time2mjd(t2)), 'exposure end time (MJD)') + hdu_i.header['EXPTIME'] =(np.float32(self.information['exptime']), 'exposure times (s)') + hdu_i.header['DARKTIME'] =(np.float32(self.information['exptime']), 'dark current time (s)') + hdu_i.header['SHTSTAT']=( bool(True) , 'shutter status') + + ###### satellite and its allitide information ############## + hdu_i.header['REFFRAME']=('CSSTGSC-1.0' , 'guiding catalog version') + hdu_i.header['SATESWV']=('softwave-1.0', 'satellite software version') + hdu_i.header['CABSTART']=(np.float64(time2jd(self.dt)), 'first cabin time after exposure start (MJD)') + hdu_i.header['SUNANGL0']=(np.float32(0.0) , 'angle between the Sun and opt axis at CABSTART') + hdu_i.header['MOONANG0']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABSTART') + hdu_i.header['TEL_ALT0']=(np.float64(0.0), 'angle between opt axis and Elimb at CABSTART') + hdu_i.header['POS_ANG0']=(np.float64(0.0), 'angle between y axis and North Pole at CABSTART') + hdu_i.header['POSI0_X'] =(np.float64(self.information['pos_x']) , 'orbital position in X at CABSTART (km)') + hdu_i.header['POSI0_Y'] =(np.float64(self.information['pos_y']) , 'orbital position in Y at CABSTART (km)') + hdu_i.header['POSI0_Z'] =(np.float64(self.information['pos_z']) , 'orbital position in Z at CABSTART (km)') + hdu_i.header['VELO0_X']=( np.float64(self.information['velocity_x']) , 'orbital velocity in X at CABSTART (km/s)') + hdu_i.header['VELO0_Y']=( np.float64(self.information['velocity_y']) , 'orbital velocity in Y at CABSTART (km/s)') + hdu_i.header['VELO0_Z']=( np.float64(self.information['velocity_z']) , 'orbital velocity in Z at CABSTART (km/s)') + hdu_i.header['Euler0_1']=( np.float64(0.0), 'Euler angle 1 at CABSTART (deg)') + hdu_i.header['Euler0_2']=( np.float64(0.0), 'Euler angle 2 at CABSTART (deg)') + hdu_i.header['Euler0_3']=( np.float64(0.0), 'Euler angle 3 at CABSTART (deg)') + hdu_i.header['RA_PNT0']=( float(self.information['ra_pnt0']) , 'pointing RA at CABSTART (deg)') + hdu_i.header['DEC_PNT0']=(float(self.information['dec_pnt0']) , 'pointing Dec at CABSTART (deg)') + hdu_i.header['CABEND'] =(float(time2jd(t2)) , 'first cabin time after exposure end (MJD)') + hdu_i.header['SUNANGL1']=(np.float32(0.0), 'angle between the Sun and opt axis at CABEND') + hdu_i.header['MOONANG1']=(np.float32(0.0) , 'angle between the Moon and opt axis at CABEND') + hdu_i.header['TEL_ALT1']=(np.float64(0.0) , 'angle between opt axis and Elimb at CABEND') + hdu_i.header['POS_ANG1']=(float(0.0) , 'angle between y axis and North Pole at CABEND') + hdu_i.header['POSI1_X'] =(float(p1x) , 'orbital position in X at CABEND (km)') + hdu_i.header['POSI1_Y'] =(float(p1y) , 'orbital position in Y at CABEND (km)') + hdu_i.header['POSI1_Z'] =(float(p1z) , 'orbital position in Z at CABEND (km)') + hdu_i.header['VELO1_X']=(float(p1vx) , 'orbital velocity in X at CABEND (km/s)') + hdu_i.header['VELO1_Y']=(float(p1vy) , 'orbital velocity in Y at CABEND (km/s)') + hdu_i.header['VELO1_Z']=(float(p1vz), 'orbital velocity in Z at CABEND (km/s)') + hdu_i.header['Euler1_1']=( np.float64(0.0), 'Euler angle 1 at CABEND (deg)') + hdu_i.header['Euler1_2']=( np.float64(0.0), 'Euler angle 2 at CABEND (deg)') + hdu_i.header['Euler1_3']=( np.float64(0.0), 'Euler angle 3 at CABEND (deg)') + hdu_i.header['RA_PNT1'] =(float(hdu_i.header['RA_PNT0']), 'pointing RA at CABEND (deg)') + hdu_i.header['DEC_PNT1']=(float(hdu_i.header['DEC_PNT0']), 'pointing Dec at CABEND (deg)') + hdu_i.header['EPOCH'] =(np.float32(time2jd(t3.utcnow())), 'equinox of pointing RA and Dec') + + ############################################################## + ##### - #write the actual file + ################ finish MCI header for image layer in G channel + ##############################################################################################333 + hdulist_i=fits.HDUList([ofd_i, hdu_i]) + #### + ofd_i.header.add_comment('========================================================================',after='FITSSWV') + ofd_i.header.add_comment('OBJECT INFORMATION',after='FITSSWV') + ofd_i.header.add_comment('========================================================================',after='FITSSWV') + + ofd_i.header.add_comment('========================================================================',after='DEC_OBJ') + ofd_i.header.add_comment('TELESCOPE INFORMATION',after='DEC_OBJ') + ofd_i.header.add_comment('========================================================================',after='DEC_OBJ') + + ofd_i.header.add_comment('========================================================================',after='EPOCH') + ofd_i.header.add_comment('VERIFICATION INFORMATION',after='EPOCH') + ofd_i.header.add_comment('========================================================================',after='EPOCH') - #file_i=self.result_path+'/sky_Data/'+filename_i + ####################################################################### + hdu_i.header.add_comment('========================================================================',after='BUNIT') + hdu_i.header.add_comment('FILE INFORMATION',after='BUNIT') + hdu_i.header.add_comment('========================================================================',after='BUNIT') + + hdu_i.header.add_comment('========================================================================',after='FITSSWV') + hdu_i.header.add_comment('INSTRUMENT STATUS AND OBJECT INFORMATION',after='FITSSWV') + hdu_i.header.add_comment('========================================================================',after='FITSSWV') + + hdu_i.header.add_comment('========================================================================',after='DEC_OBJ') + hdu_i.header.add_comment('DETECTOR AND FILTER INFORMATION',after='DEC_OBJ') + hdu_i.header.add_comment('========================================================================',after='DEC_OBJ') + + hdu_i.header.add_comment('========================================================================',after='BIN_Y') + hdu_i.header.add_comment('WORLD COORDINATE SYSTEM INFORMATION',after='BIN_Y') + hdu_i.header.add_comment('========================================================================',after='BIN_Y') + + hdu_i.header.add_comment('========================================================================',after='CD2_2') + hdu_i.header.add_comment('READOUT INFORMATION',after='CD2_2') + hdu_i.header.add_comment('========================================================================',after='CD2_2') + + hdu_i.header.add_comment('========================================================================',after='ROSPEED') + hdu_i.header.add_comment('EXPOSURE AND SHUTTER INFORMATION',after='ROSPEED') + hdu_i.header.add_comment('========================================================================',after='ROSPEED') + + hdu_i.header.add_comment('========================================================================',after='SHTSTAT') + hdu_i.header.add_comment('SATELLITE AND ITS ATTITUDE INFORMATION',after='SHTSTAT') + hdu_i.header.add_comment('========================================================================',after='SHTSTAT') + + hdu_i.header.add_comment('========================================================================',after='EPOCH') + hdu_i.header.add_comment('VERIFICATION INFORMATION',after='EPOCH') + hdu_i.header.add_comment('========================================================================',after='EPOCH') + ##################################### + ################ finish MCI header for image layer in i channel + ################ finish MCI header for image layer if self.source=='DARK' or self.source=='FLAT' or self.source=='BIAS': - file_i=self.result_path+'/cali_Data/'+filename_i + file_i=self.result_path+'/cali_Data/'+filename_i+'.fits' else: - file_i=self.result_path+'/sky_Data/'+filename_i + file_i=self.result_path+'/sky_Data/'+filename_i +'.fits' - hdulist_i.writeto(file_i, overwrite=True) + hdulist_i.writeto(file_i, checksum=True) ################################################################################################# @@ -3321,83 +5112,116 @@ class MCIsimulator(): ############################################################################################## ############################################################################################## - sourcelist=['XDF','CS','PI','TO'] - + sourcelist=['EXDF','STAR','PIPR','TRNS','COMB','CALI'] self.source=self.information['sourcein'] - - self.information['ver']='1.0' - - self._loadGhostModel() - - self.load_filter_PSF() - + self.information['ver']='01' + self._loadGhostModel() + self.load_filter_PSF() self.information['simnumber']=simnumber - - - ############################################################################ + + self.debug=True + ########################### flag=0 + + self.dt_num=int((self.information['simnumber']-1)*(self.information['exptime']+self.information['readouttime']+50)/120) + now_dt=datetime.utcnow() + now_jd=time2jd(now_dt) + for k in range(1,50,1): - fn=self.information['indata_path']+'/TianCe/orbit20160925/'+str(k)+'.txt'; + fn='../MCI_inputData/TianCe/orbit20160925/'+str(k)+'.txt'; d=np.loadtxt(fn); - self.dt_num=int(self.information['simnumber']*(self.information['exptime']+self.information['readouttime']+125)/120) - now_dt=datetime.utcnow() - now_jd=time2jd(now_dt) + for kk in range(len(d[:,0])): if now_jd-d[kk,0]<=0: flag=1 break if flag==1: + print('find time index...... ') break - - self.orbit_pars=d - self.orbit_file_num=k - self.orbit_exp_num =kk - - self.information['pos_x']=float(self.orbit_pars[self.orbit_exp_num,1]) - self.information['pos_y']=float(self.orbit_pars[self.orbit_exp_num,2]) - self.information['pos_z']=float(self.orbit_pars[self.orbit_exp_num,3]) - self.information['velocity_x']=float(self.orbit_pars[self.orbit_exp_num,4]) - self.information['velocity_y']=float(self.orbit_pars[self.orbit_exp_num,5]) - self.information['velocity_z']=float(self.orbit_pars[self.orbit_exp_num,6]) - exptime_start_jd=d[kk,0] #### jd time, utc format + ################################################################ - self.dt=julian.from_jd(exptime_start_jd, fmt='jd') - - ############################################################################# - ############################################################################# + if kk +self.dt_num < len(d[:,0]): + + exptime_start_jd=d[kk+self.dt_num,0] + + self.orbit_pars=d + self.orbit_file_num=k + self.orbit_exp_num =kk + + self.information['pos_x']=float(self.orbit_pars[self.orbit_exp_num,1]) + self.information['pos_y']=float(self.orbit_pars[self.orbit_exp_num,2]) + self.information['pos_z']=float(self.orbit_pars[self.orbit_exp_num,3]) + self.information['velocity_x']=float(self.orbit_pars[self.orbit_exp_num,4]) + self.information['velocity_y']=float(self.orbit_pars[self.orbit_exp_num,5]) + self.information['velocity_z']=float(self.orbit_pars[self.orbit_exp_num,6]) + + else: + + fn='../MCI_inputData/TianCe/orbit20160925/'+str(k+1)+'.txt'; + d=np.loadtxt(fn); + + self.orbit_pars=d + self.orbit_file_num=k+1 + self.orbit_exp_num =self.dt_num + + self.information['pos_x']=float(self.orbit_pars[self.orbit_exp_num,1]) + self.information['pos_y']=float(self.orbit_pars[self.orbit_exp_num,2]) + self.information['pos_z']=float(self.orbit_pars[self.orbit_exp_num,3]) + self.information['velocity_x']=float(self.orbit_pars[self.orbit_exp_num,4]) + self.information['velocity_y']=float(self.orbit_pars[self.orbit_exp_num,5]) + self.information['velocity_z']=float(self.orbit_pars[self.orbit_exp_num,6]) + ########################################## + + ###self.dt=julian.from_jd(exptime_start_jd, fmt='jd') + self.dt = jd2time(exptime_start_jd) + self.TianCe_day=str(self.dt.year)+self.dt.strftime("-%m-%d") ####str(self.dt.year)+'-'+str(self.dt.month)+'-'+str(self.dt.day) - if self.source in sourcelist: - - self.earthshine_theta=30.0 # in degree + self.TianCe_exp_start=dt2hmd(self.dt) - - - self.TianCe_day=str(self.dt.year)+self.dt.strftime("-%m-%d") ####str(self.dt.year)+'-'+str(self.dt.month)+'-'+str(self.dt.day) + ############################################################# + + if self.source in sourcelist: - self.TianCe_exp_start=dt2hmd(self.dt) + #self.earthshine_theta=30.0 # in degree ################################### - if self.sky_shift_rot: - - np.random.seed() - ud = np.random.random() # Choose a random pointing ra in degree - dis_ra = 2*(ud-1)*10/3600.0 - - np.random.seed() - ud = np.random.random() # Choose a random pointing dec in degree - dis_dec = 2*(ud-1)*10/3600.0 # + if self.sky_shift_rot: - np.random.seed() - ud = np.random.random() # Choose a random telescope rotation in degree - rotTelPos = 2*(ud-1)*5.0*galsim.degrees # the image will rotate in clockwise rotaion between -10-10 degree - rotSkyPos = 0.0*galsim.degrees + if self.information['simnumber']>1: + + np.random.seed(self.information['simnumber']) + ud = np.random.random() # Choose a random pointing ra in degree + dis_ra = 2*(ud-1)*10/3600.0 + + np.random.seed(10*self.information['simnumber']) + ud = np.random.random() # Choose a random pointing dec in degree + dis_dec = 2*(ud-1)*10/3600.0 # + + np.random.seed(100*self.information['simnumber']) + ud = np.random.random() # Choose a random telescope rotation in degree + rotTelPos = 2*(ud-1)*5.0*galsim.degrees # the image will rotate in clockwise rotaion between -10-10 degree + rotSkyPos = 0.0*galsim.degrees + + ################################ + # ### test code + # rotTelPos = 90.0*galsim.degrees + # dis_dec= -200*0.05/3600 + # dis_ra = 100*0.05/3600 + + + else: + + dis_ra = 0 # + dis_dec = 0 # T + + rotTelPos = 0.0*galsim.degrees # the image will rotate in clockwise rotaion between -10-10 degree + rotSkyPos = 0.0*galsim.degrees + - ################################ - else: dis_ra = 0 # @@ -3419,34 +5243,56 @@ class MCIsimulator(): theta = self.information['rotTelPos'] - self.information['rotSkyPos'] self.information['rotangle']=theta.deg - + #print('rotangle',theta.deg ) self.log.info('dis_ra(in pixel)=%f, dis_dec(in pixel)=%f, sky_rot(in deg)=%f' % (dis_ra*3600/0.05, dis_dec*3600/0.05, theta.deg)) ####################################################################################################### ############################################################################# - ########## simulate star images from star SED data ################## + ######### simulate star images from star SED data ################## - if self.sim_star : - ############################ + if self.sim_star : + ########################### starimg=self.cal_StarSED_img() + if 'starimg' in dir(): + self.log.info('Generate artifical stars finished...') + # fits.writeto(self.result_path+'/ori_Sky/starimg_C1_'+str(simnumber)+'.fits',starimg['g'], overwrite=True) + # fits.writeto(self.result_path+'/ori_Sky/starimg_C2_'+str(simnumber)+'.fits',starimg['r'], overwrite=True) + # fits.writeto(self.result_path+'/ori_Sky/starimg_C3_'+str(simnumber)+'.fits',starimg['i'], overwrite=True) + + self.img_fits_save(starimg['g'], 'star_ori_C1_'+str(simnumber)) + self.img_fits_save(starimg['r'], 'star_ori_C2_'+str(simnumber)) + self.img_fits_save(starimg['i'], 'star_ori_C3_'+str(simnumber)) + + + print('star image finished') + ########################################################################## # # ######################################################################## # ###### generate galaxy SED image without Lensing effect ########## - if self.sim_galaxy : + if self.sim_galaxy and self.source=='EXDF' : losimg=self.cal_Lensing_galaxy_img() + if 'losimg' in dir(): + self.log.info('Generate los finished...') + print('losimage finished') + fits.writeto(self.result_path+'/ori_Sky/galimg_C1_'+str(simnumber)+'.fits',losimg['g'], overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/galimg_C2_'+str(simnumber)+'.fits',losimg['r'], overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/galimg_C3_'+str(simnumber)+'.fits',losimg['i'], overwrite=True) + + self.img_fits_save(losimg['g'], 'gal_ori_C1_'+str(simnumber)) + self.img_fits_save(losimg['r'], 'gal_ori_C2_'+str(simnumber)) + self.img_fits_save(losimg['i'], 'gal_ori_C3_'+str(simnumber)) + + + ################################################################## - if self.sim_star ==False and self.sim_galaxy == False: - print('error: No image will be simulated...... ') - sys.exit(1) - - #### stack the image + ### stack the image if 'losimg' in dir(): self.image_g+=losimg['g'] @@ -3460,7 +5306,15 @@ class MCIsimulator(): ########################################################################################################### - + + fits.writeto(self.result_path+'/ori_Sky/original_C1_'+str(simnumber)+'.fits',self.image_g, overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/original_C2_'+str(simnumber)+'.fits',self.image_r, overwrite=True) + fits.writeto(self.result_path+'/ori_Sky/original_C3_'+str(simnumber)+'.fits',self.image_i, overwrite=True) + + self.img_fits_save(self.image_g, 'full_ori_C1_'+str(simnumber)) + self.img_fits_save(self.image_g, 'full_ori_C2_'+str(simnumber)) + self.img_fits_save(self.image_g, 'full_ori_C3_'+str(simnumber)) + ######################################################################################################### ####### end if source =='SKY' @@ -3468,20 +5322,20 @@ class MCIsimulator(): elif self.source=='FLAT': theta=0 - + self.information['exptime']=100*self.information['simnumber']#np.ceil(self.information['simnumber']/2.0) self.information['name_obj']='FLAT' self.information['rotangle']=0 self.information['CRVAL1']=0 - self.information['CRVAL2']=0 - - self.information['CRPIX1']=self.information['xsize']/2-0.5 #### - self.information['CRPIX2']=self.information['ysize']/2-0.5 #### + self.information['CRVAL2']=0 self.information['tel_Pra']=0 self.information['tel_Pdec']=0 - + + self.information['CRPIX1']=self.information['tel_Pra']*self.information['pixel_size'] #### + self.information['CRPIX2']=self.information['tel_Pdec']*self.information['pixel_size'] #### + self.information['CD1_1']=-np.cos(theta)*self.information['pixel_size'] #### self.information['CD1_2']= np.sin(theta)*self.information['pixel_size'] #### @@ -3492,17 +5346,17 @@ class MCIsimulator(): self.information['dec_obj'] =0 self.information['ra_pnt0'] =0 self.information['dec_pnt0']=0 - self.information['target'] =0 + self.information['target'] ='FLAT' - self.image_g +=100*self.information['exptime'] - self.image_r +=100*self.information['exptime'] - self.image_i +=100*self.information['exptime'] + self.image_g +=5000*self.information['simnumber'] + self.image_r +=5000*self.information['simnumber'] + self.image_i +=5000*self.information['simnumber'] elif self.source=='DARK': theta=0 - + self.information['exptime']=2*3600*self.information['simnumber'] self.information['name_obj']='DARK' self.information['rotangle']=0 @@ -3512,9 +5366,8 @@ class MCIsimulator(): self.information['tel_Pra']=0 self.information['tel_Pdec']=0 - - self.information['CRPIX1']=self.information['xsize']/2-0.5 #### - self.information['CRPIX2']=self.information['ysize']/2-0.5 #### + self.information['CRPIX1']=self.information['tel_Pra']*self.information['pixel_size'] #### + self.information['CRPIX2']=self.information['tel_Pdec']*self.information['pixel_size'] #### self.information['CD1_1']=-np.cos(theta)*self.information['pixel_size'] #### self.information['CD1_2']= np.sin(theta)*self.information['pixel_size'] #### @@ -3526,11 +5379,11 @@ class MCIsimulator(): self.information['dec_obj'] =0 self.information['ra_pnt0'] =0 self.information['dec_pnt0']=0 - self.information['target'] =0 + self.information['target'] ='DARK' - self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) + self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) elif self.source=='BIAS': @@ -3548,8 +5401,8 @@ class MCIsimulator(): self.information['tel_Pra']=0 self.information['tel_Pdec']=0 - self.information['CRPIX1']=self.information['xsize']/2-0.5 #### - self.information['CRPIX2']=self.information['ysize']/2-0.5 #### + self.information['CRPIX1']=self.information['tel_Pra']*self.information['pixel_size'] #### + self.information['CRPIX2']=self.information['tel_Pdec']*self.information['pixel_size'] #### self.information['CD1_1']=-np.cos(theta)*self.information['pixel_size'] #### self.information['CD1_2']= np.sin(theta)*self.information['pixel_size'] #### @@ -3557,15 +5410,15 @@ class MCIsimulator(): self.information['CD2_1']= np.sin(theta)*self.information['pixel_size'] #### self.information['CD2_2']= np.cos(theta)*self.information['pixel_size'] #### + self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=float) + self.information['target'] ='BIAS' self.information['ra_obj'] =0 self.information['dec_obj'] =0 self.information['ra_pnt0'] =0 self.information['dec_pnt0']=0 - self.information['target'] =0 - - self.image_g=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_r=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) - self.image_i=np.zeros((self.information['ysize'], self.information['xsize']), dtype=np.float64) + else: print('Souce is not correct and programe will return') @@ -3573,95 +5426,101 @@ class MCIsimulator(): ######################################################################################################################## - ######################################################################################################################## #Apply flat-field large scale structure for one chip if self.flatfieldM: self.applyFlat() - #print('applyFlat') + print('applyFlat') ######################################################## if self.PRNUeffect: self.applyPRNUeffect() - #print('applyPRNUeffect') + print('applyPRNUeffect') #################################################################### if self.source in sourcelist: if self.cosmicRays: - self.addCosmicRays() - #print('addCosmicRays finisth') + if self.debug == False: + self.addCosmicRays() + print('addCosmicRays finisth') ################################################## - if self.skyback and self.source in sourcelist: - self.applyPoissonSkyNoise() - #print('apply Poisson Sky Noise') + if self.skyback: + if self.source in sourcelist: + self.applyPoissonSkyNoise() + print('apply Poisson Sky Noise') ################################################# if self.darknoise: self.applyDarkCurrent() - #print('applyDarkCurrent finisth') + print('applyDarkCurrent finisth') ################################################# - if self.shutterEffect: + if self.shutterEffect and self.information['exptime']>2.6: self.addshuttereffect() - #print('add shutter effect ') - ################################################# - - if self.source not in sourcelist: - self.applyPoissonNoise() + print('add shutter effect ') - ################################################### + ################################################# + + if self.bleeding: + if self.debug== False: + self.image_g=self.applyBleeding(self.image_g.copy()) + self.image_r=self.applyBleeding(self.image_r.copy()) + self.image_i=self.applyBleeding(self.image_i.copy()) + print('apply bleeding effect finisth') + + ################################################ + if self.nonlinearity: self.applyNonlinearity() - #print('applyNonlinearity') + print('applyNonlinearity') # ################################################ - if self.bleeding: - self.image_g=self.applyBleeding(self.image_g.copy()) - self.image_r=self.applyBleeding(self.image_r.copy()) - self.image_i=self.applyBleeding(self.image_i.copy()) - #print('apply bleeding effect finisth') - - ################################################ + - #### read CCD image to output matrix as defined + + #### read CCD image to output matrix as defined + if self.overscans and self.information['xsize']==9216 and self.information['ysize']==9232 : self.image_g=self.addScanEffect(self.image_g.copy()) self.image_r=self.addScanEffect(self.image_r.copy()) self.image_i=self.addScanEffect(self.image_i.copy()) - #print('apply overscan zone 1-16') + print('apply overscan zone 1-16') ################################################################# - - if self.radiationDamage: - self.applyRadiationDamage() - #print('applyRadiationDamage()') + if self.source in sourcelist: + if self.radiationDamage: + if self.debug == False: + self.applyRadiationDamage() + print('applyRadiationDamage()') ###################################################################### ###### apply readoutNoise ###### - + + if self.readoutNoise: self.applyReadoutNoise() - #print('apply readout noise') + print('apply readout noise') ###################################################################### - if self.information['xsize']==9216 and self.information['ysize']==9232 : + if self.information['xsize']==9216 and self.information['ysize']==9232 and self.overscans : self.electrons2ADU() ### apply gain - #print('apply 1-16 zone by different gain ') + print('apply 1-16 zone by different gain ') else: self.image_g=self.image_g/1.5 self.image_r=self.image_r/1.5 self.image_i=self.image_i/1.5 - #print('apply gain finish') + print('apply gain finish') ###################################################################### #size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232 - if self.information['xsize']==9216 and self.information['ysize']==9232 : + + if self.information['xsize']==9216 and self.information['ysize']==9232 and self.overscans : self.applyBias() ### - #print('apply bias finish') + print('apply bias finish') else: self.image_g=self.image_g+500.0 self.image_r=self.image_r+500.0 @@ -3669,8 +5528,9 @@ class MCIsimulator(): ################################################################### if self.cosmetics and self.information['xsize']==9216 and self.information['ysize']==9232 : - self.applyCosmetics() - #print('applyCosmetics') + if self.debug== False: + self.applyCosmetics() + print('apply Cosmetics...') ################################################## if self.intscale: @@ -3678,21 +5538,43 @@ class MCIsimulator(): ################################################## self.writeOutputs(simnumber) - self.log.info('Finished the simulation.') - #print('The iLoop= % d simlaiton finished. ' ) + ####################################################### + self.log.info('Using the following input values:') + + for key, value in self.information.items(): + self.log.info('%s = %s' % (key, value)) + self.log.info('Using the following booleans:') + + for key, value in self.booleans.items(): + self.log.info('%s = %s' % (key, value)) + ####################################################### + + + self.log.info('Finished the ith_Exposure = %i' % (simnumber)) + + print('The iLoop= % d simlaiton finished. ' %simnumber) ################################################################################################ -def mcisim(iLoop,configfile): +def runMCIsim(sourcein,configfile,dir_path,iLoop): + + print('Simulation iLoop = ', iLoop) - opts, args = processArgs() - opts.configfile=configfile - simulate = MCIsimulator(opts) - simulate.configure(1) + # opts, args = processArgs() + # opts.configfile=configfile - simulate.simulate(1) + sim= dict() + sim[iLoop] = MCIsimulator(configfile) + + sim[iLoop].configure(iLoop,sourcein) # load the configfile; + + sim[iLoop].information['sourcein'] =sourcein + + sim[iLoop].information['dir_path'] = dir_path + + sim[iLoop].simulate(iLoop) return @@ -3701,33 +5583,8 @@ def mcisim(iLoop,configfile): ################################################################################################ ################################### main function ############################################# -############################################################################# - -if __name__ == "__main__": - - - - if len(sys.argv[:]) <2: - - configfile='./mci_data/mci_sim_example.config' - - - ########################################################################################### - - if len(sys.argv[:]) >=2: - configfile=sys.argv[1] - if not os.path.exists(configfile): - print('The given input configfile path is wrong......') - sys.exit(1) - - - - - mcisim(1, configfile) - - print('MCI simulation is successful!') - - - +# wfetimes= 2.0 #### wavefront error is wfetimes of CSST primary mirrors; +# # #### calculte MCI filters's PSF date Cube #### - \ No newline at end of file +# cal_Filter_PSF(wfetimes) +# print('finish calculate filter PSF...') diff --git a/csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc b/csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f77477e17534effbf643611de36058aa48b97e93 Binary files /dev/null and b/csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc differ diff --git a/csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc b/csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b97f2768fe746570ce1cadcf9c9e54fdbbb83b4 Binary files /dev/null and b/csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc differ diff --git a/csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc b/csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71d7f3c4c973d74370e9fe6231971f87a80af69c Binary files /dev/null and b/csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc differ diff --git a/csst_mci_sim/support/__pycache__/logger.cpython-311.pyc b/csst_mci_sim/support/__pycache__/logger.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4be3b6f4491eaf8663bc93746e998a93daa41922 Binary files /dev/null and b/csst_mci_sim/support/__pycache__/logger.cpython-311.pyc differ diff --git a/csst_mci_sim/support/__pycache__/sed.cpython-311.pyc b/csst_mci_sim/support/__pycache__/sed.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ab26dd45afb028bdb8bb8347fbbdba1bbd25a27 Binary files /dev/null and b/csst_mci_sim/support/__pycache__/sed.cpython-311.pyc differ diff --git a/csst_mci_sim/support/__pycache__/shao.cpython-311.pyc b/csst_mci_sim/support/__pycache__/shao.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6195600f5a5949ab8fa6657334a6e58e2ed2655 Binary files /dev/null and b/csst_mci_sim/support/__pycache__/shao.cpython-311.pyc differ diff --git a/csst_mci_sim/support/sed.py b/csst_mci_sim/support/sed.py old mode 100644 new mode 100755 index dccb65403796c1f69a76507ade362c717cdf761c..a6bfc57e0802cbc8004f9a0951dc070d95fab407 --- a/csst_mci_sim/support/sed.py +++ b/csst_mci_sim/support/sed.py @@ -56,7 +56,7 @@ def reddening(wave, flux, ebv = 0.0, law = 'calzetti', Rv = 4.05): fluxNew = flux / (10. ** (0.4 * ebv * curve)) return fluxNew -def flux_to_mag(wave, flux, filepath, band='GAIA_bp'): +def flux_to_mag(wave, flux, band='GAIA_bp'): """Convert flux of given spectra to magnitude Args: @@ -70,12 +70,9 @@ def flux_to_mag(wave, flux, filepath, band='GAIA_bp'): # /home/yan/MCI_sim/MCI_input/SED_Code/data import os - #parent = os.path.dirname(os.path.realpath(__file__)) - - parent=filepath - - band = ascii.read(parent+'/SED_Code/seddata/' + band + '.dat') - + parent = os.path.dirname(os.path.realpath(__file__)) + + band = ascii.read(parent+'/seddata/' + band + '.dat') wave0= band['col1'] curv0= band['col2'] @@ -92,7 +89,7 @@ def flux_to_mag(wave, flux, filepath, band='GAIA_bp'): return -2.5 * np.log10(Tflux) -def calibrate(wave, flux, mag, filepath,band='GAIA_bp'): +def calibrate(wave, flux, mag, band='GAIA_bp'): """ Calibrate the spectra according to the magnitude. @@ -105,7 +102,7 @@ def calibrate(wave, flux, mag, filepath,band='GAIA_bp'): Returns: float: Flux of calibrated spectra. Units: 1e-17 erg/s/A/cm^2 """ - inst_mag = flux_to_mag(wave, flux,filepath ,band = band) + inst_mag = flux_to_mag(wave, flux, band = band) instflux = 10 ** (-0.4 * inst_mag) realflux = (mag * u.STmag).to(u.erg/u.s/u.cm**2/u.AA).value @@ -123,12 +120,12 @@ class Gal_Temp(): Template of Galaxy SED """ - def __init__(self,parent): + def __init__(self): import os - self.parent = parent + parent = os.path.dirname(os.path.realpath(__file__)) - hdulist = fits.open(self.parent+'/SED_Code/seddata/galaxy_temp.fits') + hdulist = fits.open(parent+'/seddata/galaxy_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.age_grid = hdulist[3].data['logAge'] @@ -141,43 +138,43 @@ class Gal_Temp(): redshift (float, optional): redshift of spectra. Defaults to 0. """ wave = self.wave * (1 + redshift) - self.umag = flux_to_mag(wave, self.flux, self.parent,band='SDSS_u') - self.gmag = flux_to_mag(wave, self.flux, self.parent,band='SDSS_g') - self.rmag = flux_to_mag(wave, self.flux, self.parent,band='SDSS_r') - self.imag = flux_to_mag(wave, self.flux, self.parent,band='SDSS_i') - self.zmag = flux_to_mag(wave, self.flux, self.parent,band='SDSS_z') + self.umag = flux_to_mag(wave, self.flux, band='SDSS_u') + self.gmag = flux_to_mag(wave, self.flux, band='SDSS_g') + self.rmag = flux_to_mag(wave, self.flux, band='SDSS_r') + self.imag = flux_to_mag(wave, self.flux, band='SDSS_i') + self.zmag = flux_to_mag(wave, self.flux, band='SDSS_z') class Star_Temp(): """ Template of Stellar SED """ - def __init__(self, parent): - - #import os + def __init__(self): - #parent = os.path.dirname(os.path.realpath(__file__)) - - ##/home/yan/MCI_sim_Fabu/MCI_inputData/SED_Code - - self.parent = parent + import os - hdulist = fits.open(parent+'/SED_Code/seddata/stellar_temp.fits') + parent = os.path.dirname(os.path.realpath(__file__)) + ###print("获取其父目录——" + parent) # 从当前文件路径中获取目录 + hdulist = fits.open(parent+'/seddata/stellar_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.Teff_grid = hdulist[3].data['Teff'] self.FeH_grid = hdulist[3].data['FeH'] + self.bpmag = flux_to_mag(self.wave, self.flux, band='GAIA_bp') + self.rpmag = flux_to_mag(self.wave, self.flux, band='GAIA_rp') + + def toMag(self): wave = self.wave - self.bpmag = flux_to_mag(wave, self.flux, self.parent,band='GAIA_bp') - self.rpmag = flux_to_mag(wave, self.flux, self.parent,band='GAIA_rp') + self.bpmag = flux_to_mag(wave, self.flux, band='GAIA_bp') + self.rpmag = flux_to_mag(wave, self.flux, band='GAIA_rp') # ------------- # SED Modelling -def Model_Stellar_SED(wave, bp, rp, temp, filepath): +def Model_Stellar_SED(wave, bp, rp, temp): """Modelling stellar SED based on bp, rp magnitude Args: @@ -197,7 +194,7 @@ def Model_Stellar_SED(wave, bp, rp, temp, filepath): idx = np.argmin(np.abs(colors - color0)) flux0 = temp.flux[idx] flux1 = np.interp(wave, temp.wave, flux0) - flux = calibrate(wave, flux1, rp, filepath, band = 'GAIA_rp') + flux = calibrate(wave, flux1, rp, band = 'GAIA_rp') return flux def Model_Galaxy_SED(wave, ugriz, z, temp): diff --git a/csst_mci_sim/support/seddata/.DS_Store b/csst_mci_sim/support/seddata/.DS_Store new file mode 100755 index 0000000000000000000000000000000000000000..c74d19996a57c2660debeb472e968fcf2510ce84 Binary files /dev/null and b/csst_mci_sim/support/seddata/.DS_Store differ diff --git a/csst_mci_sim/support/seddata/GAIA_bp.dat b/csst_mci_sim/support/seddata/GAIA_bp.dat new file mode 100755 index 0000000000000000000000000000000000000000..c4cde87260a561e289f3c1a5766acf1f5b967155 --- /dev/null +++ b/csst_mci_sim/support/seddata/GAIA_bp.dat @@ -0,0 +1,1701 @@ +3250 0.000159322 +3252.5 0.000287249 +3255 0.000428428 +3257.5 0.000582891 +3260 0.000750667 +3262.5 0.00125919 +3265 0.00185359 +3267.5 0.00253405 +3270 0.00330077 +3272.5 0.00464812 +3275 0.0061413 +3277.5 0.00778064 +3280 0.00956649 +3282.5 0.0119762 +3285 0.0145045 +3287.5 0.0171517 +3290 0.0199181 +3292.5 0.0234236 +3295 0.0269204 +3297.5 0.0304084 +3300 0.0338877 +3302.5 0.0387112 +3305 0.0435392 +3307.5 0.0483715 +3310 0.0532082 +3312.5 0.0593841 +3315 0.0655812 +3317.5 0.0717994 +3320 0.0780389 +3322.5 0.0857511 +3325 0.0936351 +3327.5 0.101691 +3330 0.10992 +3332.5 0.118351 +3335 0.126947 +3337.5 0.135706 +3340 0.14463 +3342.5 0.153064 +3345 0.161618 +3347.5 0.170291 +3350 0.179084 +3352.5 0.186458 +3355 0.19384 +3357.5 0.201228 +3360 0.208624 +3362.5 0.213766 +3365 0.218758 +3367.5 0.223599 +3370 0.22829 +3372.5 0.231918 +3375 0.235449 +3377.5 0.238885 +3380 0.242224 +3382.5 0.249527 +3385 0.256924 +3387.5 0.264416 +3390 0.272002 +3392.5 0.276952 +3395 0.281894 +3397.5 0.286827 +3400 0.291751 +3402.5 0.291586 +3405 0.29121 +3407.5 0.290622 +3410 0.289823 +3412.5 0.283465 +3415 0.276804 +3417.5 0.269838 +3420 0.262567 +3422.5 0.254538 +3425 0.246286 +3427.5 0.23781 +3430 0.229109 +3432.5 0.230896 +3435 0.23268 +3437.5 0.234463 +3440 0.236244 +3442.5 0.247814 +3445 0.259545 +3447.5 0.271436 +3450 0.283487 +3452.5 0.297606 +3455 0.311841 +3457.5 0.326194 +3460 0.340665 +3462.5 0.353224 +3465 0.365862 +3467.5 0.378579 +3470 0.391376 +3472.5 0.397257 +3475 0.403164 +3477.5 0.409098 +3480 0.415059 +3482.5 0.415748 +3485 0.416437 +3487.5 0.417128 +3490 0.417819 +3492.5 0.416867 +3495 0.415915 +3497.5 0.414962 +3500 0.414009 +3502.5 0.41387 +3505 0.413728 +3507.5 0.413584 +3510 0.413437 +3512.5 0.414463 +3515 0.415472 +3517.5 0.416465 +3520 0.417443 +3522.5 0.417751 +3525 0.41804 +3527.5 0.418309 +3530 0.418558 +3532.5 0.416992 +3535 0.415425 +3537.5 0.413856 +3540 0.412286 +3542.5 0.409024 +3545 0.405771 +3547.5 0.402526 +3550 0.399289 +3552.5 0.396629 +3555 0.39397 +3557.5 0.391311 +3560 0.388652 +3562.5 0.386299 +3565 0.383932 +3567.5 0.38155 +3570 0.379154 +3572.5 0.377875 +3575 0.376577 +3577.5 0.375259 +3580 0.373921 +3582.5 0.37194 +3585 0.369928 +3587.5 0.367885 +3590 0.365811 +3592.5 0.363374 +3595 0.36092 +3597.5 0.358449 +3600 0.355961 +3602.5 0.35317 +3605 0.350373 +3607.5 0.347571 +3610 0.344763 +3612.5 0.34086 +3615 0.33695 +3617.5 0.333032 +3620 0.329106 +3622.5 0.326245 +3625 0.32338 +3627.5 0.320509 +3630 0.317632 +3632.5 0.314089 +3635 0.31054 +3637.5 0.306986 +3640 0.303425 +3642.5 0.30046 +3645 0.297485 +3647.5 0.294502 +3650 0.29151 +3652.5 0.288078 +3655 0.284642 +3657.5 0.281201 +3660 0.277754 +3662.5 0.273687 +3665 0.269614 +3667.5 0.265536 +3670 0.261451 +3672.5 0.258003 +3675 0.25455 +3677.5 0.251091 +3680 0.247628 +3682.5 0.244357 +3685 0.241081 +3687.5 0.237801 +3690 0.234516 +3692.5 0.230742 +3695 0.226962 +3697.5 0.223177 +3700 0.219386 +3702.5 0.216716 +3705 0.214043 +3707.5 0.211365 +3710 0.208683 +3712.5 0.205193 +3715 0.201697 +3717.5 0.198196 +3720 0.19469 +3722.5 0.191294 +3725 0.187892 +3727.5 0.184486 +3730 0.181074 +3732.5 0.178012 +3735 0.174946 +3737.5 0.171876 +3740 0.168801 +3742.5 0.166267 +3745 0.163729 +3747.5 0.161188 +3750 0.158643 +3752.5 0.156816 +3755 0.154987 +3757.5 0.153155 +3760 0.151321 +3762.5 0.149158 +3765 0.146992 +3767.5 0.144823 +3770 0.142651 +3772.5 0.140208 +3775 0.137763 +3777.5 0.135314 +3780 0.132861 +3782.5 0.131624 +3785 0.130386 +3787.5 0.129146 +3790 0.127904 +3792.5 0.127332 +3795 0.126759 +3797.5 0.126185 +3800 0.12561 +3802.5 0.125628 +3805 0.125647 +3807.5 0.125665 +3810 0.125684 +3812.5 0.126653 +3815 0.127623 +3817.5 0.128595 +3820 0.129567 +3822.5 0.130604 +3825 0.131643 +3827.5 0.132682 +3830 0.133723 +3832.5 0.13549 +3835 0.137259 +3837.5 0.13903 +3840 0.140803 +3842.5 0.143034 +3845 0.145268 +3847.5 0.147504 +3850 0.149743 +3852.5 0.153139 +3855 0.156539 +3857.5 0.159943 +3860 0.163352 +3862.5 0.166822 +3865 0.170295 +3867.5 0.173774 +3870 0.177256 +3872.5 0.180792 +3875 0.184332 +3877.5 0.187877 +3880 0.191426 +3882.5 0.195616 +3885 0.199811 +3887.5 0.204011 +3890 0.208216 +3892.5 0.212828 +3895 0.217445 +3897.5 0.222068 +3900 0.226697 +3902.5 0.231609 +3905 0.236527 +3907.5 0.241452 +3910 0.246382 +3912.5 0.251649 +3915 0.256923 +3917.5 0.262204 +3920 0.267491 +3922.5 0.272155 +3925 0.276826 +3927.5 0.281502 +3930 0.286184 +3932.5 0.291656 +3935 0.297135 +3937.5 0.302621 +3940 0.308113 +3942.5 0.312621 +3945 0.317134 +3947.5 0.321653 +3950 0.326177 +3952.5 0.330725 +3955 0.335278 +3957.5 0.339837 +3960 0.344402 +3962.5 0.348273 +3965 0.352149 +3967.5 0.356029 +3970 0.359914 +3972.5 0.363417 +3975 0.366924 +3977.5 0.370435 +3980 0.373951 +3982.5 0.378652 +3985 0.38336 +3987.5 0.388072 +3990 0.392791 +3992.5 0.396883 +3995 0.40098 +3997.5 0.405082 +4000 0.409189 +4002.5 0.412002 +4005 0.414818 +4007.5 0.417638 +4010 0.420461 +4012.5 0.423793 +4015 0.42713 +4017.5 0.43047 +4020 0.433815 +4022.5 0.438125 +4025 0.442441 +4027.5 0.446762 +4030 0.451088 +4032.5 0.453396 +4035 0.455707 +4037.5 0.45802 +4040 0.460336 +4042.5 0.462325 +4045 0.464316 +4047.5 0.46631 +4050 0.468305 +4052.5 0.470943 +4055 0.473584 +4057.5 0.476228 +4060 0.478875 +4062.5 0.480342 +4065 0.48181 +4067.5 0.483281 +4070 0.484752 +4072.5 0.486377 +4075 0.488003 +4077.5 0.489631 +4080 0.49126 +4082.5 0.493393 +4085 0.495527 +4087.5 0.497664 +4090 0.499803 +4092.5 0.501996 +4095 0.504191 +4097.5 0.506388 +4100 0.508587 +4102.5 0.511981 +4105 0.515379 +4107.5 0.518781 +4110 0.522186 +4112.5 0.525286 +4115 0.528389 +4117.5 0.531496 +4120 0.534606 +4122.5 0.536249 +4125 0.537893 +4127.5 0.53954 +4130 0.541188 +4132.5 0.542206 +4135 0.543226 +4137.5 0.544246 +4140 0.545267 +4142.5 0.547112 +4145 0.548959 +4147.5 0.550808 +4150 0.552658 +4152.5 0.554343 +4155 0.556029 +4157.5 0.557717 +4160 0.559406 +4162.5 0.560932 +4165 0.562459 +4167.5 0.563988 +4170 0.565518 +4172.5 0.567358 +4175 0.5692 +4177.5 0.571044 +4180 0.57289 +4182.5 0.574103 +4185 0.575316 +4187.5 0.576531 +4190 0.577746 +4192.5 0.579134 +4195 0.580522 +4197.5 0.581913 +4200 0.583304 +4202.5 0.585007 +4205 0.586711 +4207.5 0.588417 +4210 0.590125 +4212.5 0.591219 +4215 0.592313 +4217.5 0.593409 +4220 0.594506 +4222.5 0.596824 +4225 0.599145 +4227.5 0.601468 +4230 0.603793 +4232.5 0.604794 +4235 0.605795 +4237.5 0.606797 +4240 0.6078 +4242.5 0.607937 +4245 0.608074 +4247.5 0.60821 +4250 0.608346 +4252.5 0.60978 +4255 0.611215 +4257.5 0.612652 +4260 0.61409 +4262.5 0.616209 +4265 0.618331 +4267.5 0.620455 +4270 0.622582 +4272.5 0.623991 +4275 0.625402 +4277.5 0.626813 +4280 0.628226 +4282.5 0.629063 +4285 0.629901 +4287.5 0.630739 +4290 0.631577 +4292.5 0.632908 +4295 0.634239 +4297.5 0.635571 +4300 0.636905 +4302.5 0.637809 +4305 0.638713 +4307.5 0.639618 +4310 0.640523 +4312.5 0.641419 +4315 0.642315 +4317.5 0.643212 +4320 0.644109 +4322.5 0.645836 +4325 0.647564 +4327.5 0.649294 +4330 0.651025 +4332.5 0.652721 +4335 0.654418 +4337.5 0.656117 +4340 0.657817 +4342.5 0.65977 +4345 0.661726 +4347.5 0.663683 +4350 0.665641 +4352.5 0.667042 +4355 0.668443 +4357.5 0.669846 +4360 0.671249 +4362.5 0.671023 +4365 0.670796 +4367.5 0.670569 +4370 0.67034 +4372.5 0.671068 +4375 0.671797 +4377.5 0.672525 +4380 0.673254 +4382.5 0.674201 +4385 0.675149 +4387.5 0.676097 +4390 0.677045 +4392.5 0.678498 +4395 0.679953 +4397.5 0.681408 +4400 0.682865 +4402.5 0.68422 +4405 0.685577 +4407.5 0.686934 +4410 0.688293 +4412.5 0.689858 +4415 0.691424 +4417.5 0.692991 +4420 0.694559 +4422.5 0.69642 +4425 0.698282 +4427.5 0.700146 +4430 0.702011 +4432.5 0.703244 +4435 0.704478 +4437.5 0.705712 +4440 0.706948 +4442.5 0.708571 +4445 0.710195 +4447.5 0.71182 +4450 0.713447 +4452.5 0.714217 +4455 0.714989 +4457.5 0.71576 +4460 0.716532 +4462.5 0.716722 +4465 0.716911 +4467.5 0.717099 +4470 0.717288 +4472.5 0.718893 +4475 0.720499 +4477.5 0.722106 +4480 0.723715 +4482.5 0.725688 +4485 0.727662 +4487.5 0.729638 +4490 0.731616 +4492.5 0.731876 +4495 0.732135 +4497.5 0.732394 +4500 0.732652 +4502.5 0.732738 +4505 0.732823 +4507.5 0.732907 +4510 0.732992 +4512.5 0.735034 +4515 0.737077 +4517.5 0.739123 +4520 0.74117 +4522.5 0.742314 +4525 0.743459 +4527.5 0.744604 +4530 0.745751 +4532.5 0.746094 +4535 0.746437 +4537.5 0.74678 +4540 0.747122 +4542.5 0.748328 +4545 0.749534 +4547.5 0.750741 +4550 0.751949 +4552.5 0.753128 +4555 0.754308 +4557.5 0.755488 +4560 0.75667 +4562.5 0.756846 +4565 0.757023 +4567.5 0.757198 +4570 0.757374 +4572.5 0.758109 +4575 0.758845 +4577.5 0.759581 +4580 0.760317 +4582.5 0.761873 +4585 0.763429 +4587.5 0.764988 +4590 0.766547 +4592.5 0.767425 +4595 0.768304 +4597.5 0.769184 +4600 0.770064 +4602.5 0.771073 +4605 0.772083 +4607.5 0.773094 +4610 0.774105 +4612.5 0.774786 +4615 0.775466 +4617.5 0.776147 +4620 0.776828 +4622.5 0.776995 +4625 0.777161 +4627.5 0.777327 +4630 0.777492 +4632.5 0.778344 +4635 0.779196 +4637.5 0.780049 +4640 0.780902 +4642.5 0.782717 +4645 0.784533 +4647.5 0.786351 +4650 0.788171 +4652.5 0.789432 +4655 0.790695 +4657.5 0.791958 +4660 0.793222 +4662.5 0.792967 +4665 0.792711 +4667.5 0.792454 +4670 0.792196 +4672.5 0.792085 +4675 0.791974 +4677.5 0.791861 +4680 0.791748 +4682.5 0.793294 +4685 0.794841 +4687.5 0.796389 +4690 0.797938 +4692.5 0.798278 +4695 0.798618 +4697.5 0.798958 +4700 0.799297 +4702.5 0.799019 +4705 0.798741 +4707.5 0.798461 +4710 0.798181 +4712.5 0.799856 +4715 0.801532 +4717.5 0.803209 +4720 0.804888 +4722.5 0.805774 +4725 0.80666 +4727.5 0.807547 +4730 0.808434 +4732.5 0.808231 +4735 0.808028 +4737.5 0.807823 +4740 0.807618 +4742.5 0.807883 +4745 0.808147 +4747.5 0.808411 +4750 0.808675 +4752.5 0.809828 +4755 0.810983 +4757.5 0.812138 +4760 0.813294 +4762.5 0.814806 +4765 0.81632 +4767.5 0.817835 +4770 0.819351 +4772.5 0.819979 +4775 0.820607 +4777.5 0.821236 +4780 0.821864 +4782.5 0.821518 +4785 0.821171 +4787.5 0.820823 +4790 0.820474 +4792.5 0.820169 +4795 0.819862 +4797.5 0.819555 +4800 0.819247 +4802.5 0.821361 +4805 0.823477 +4807.5 0.825595 +4810 0.827714 +4812.5 0.827333 +4815 0.826951 +4817.5 0.826568 +4820 0.826184 +4822.5 0.824987 +4825 0.823788 +4827.5 0.822588 +4830 0.821386 +4832.5 0.821353 +4835 0.821319 +4837.5 0.821285 +4840 0.821251 +4842.5 0.822218 +4845 0.823186 +4847.5 0.824155 +4850 0.825124 +4852.5 0.826071 +4855 0.827018 +4857.5 0.827965 +4860 0.828914 +4862.5 0.829829 +4865 0.830745 +4867.5 0.831661 +4870 0.832578 +4872.5 0.832676 +4875 0.832773 +4877.5 0.83287 +4880 0.832967 +4882.5 0.833053 +4885 0.833138 +4887.5 0.833223 +4890 0.833308 +4892.5 0.8336 +4895 0.833893 +4897.5 0.834185 +4900 0.834477 +4902.5 0.834434 +4905 0.834391 +4907.5 0.834347 +4910 0.834303 +4912.5 0.833509 +4915 0.832715 +4917.5 0.831919 +4920 0.831122 +4922.5 0.83126 +4925 0.831397 +4927.5 0.831533 +4930 0.83167 +4932.5 0.83277 +4935 0.83387 +4937.5 0.834971 +4940 0.836073 +4942.5 0.837982 +4945 0.839892 +4947.5 0.841804 +4950 0.843717 +4952.5 0.84409 +4955 0.844463 +4957.5 0.844836 +4960 0.845209 +4962.5 0.845289 +4965 0.845369 +4967.5 0.845448 +4970 0.845527 +4972.5 0.84554 +4975 0.845551 +4977.5 0.845563 +4980 0.845573 +4982.5 0.844237 +4985 0.842899 +4987.5 0.841559 +4990 0.840217 +4992.5 0.839671 +4995 0.839123 +4997.5 0.838574 +5000 0.838025 +5002.5 0.838561 +5005 0.839097 +5007.5 0.839634 +5010 0.84017 +5012.5 0.842252 +5015 0.844336 +5017.5 0.846422 +5020 0.848509 +5022.5 0.848076 +5025 0.847642 +5027.5 0.847207 +5030 0.846771 +5032.5 0.846275 +5035 0.845777 +5037.5 0.845279 +5040 0.84478 +5042.5 0.845326 +5045 0.845873 +5047.5 0.84642 +5050 0.846967 +5052.5 0.847101 +5055 0.847236 +5057.5 0.84737 +5060 0.847504 +5062.5 0.848643 +5065 0.849782 +5067.5 0.850922 +5070 0.852063 +5072.5 0.851546 +5075 0.851028 +5077.5 0.850509 +5080 0.849989 +5082.5 0.848503 +5085 0.847015 +5087.5 0.845525 +5090 0.844033 +5092.5 0.845032 +5095 0.846031 +5097.5 0.84703 +5100 0.84803 +5102.5 0.849105 +5105 0.850181 +5107.5 0.851258 +5110 0.852335 +5112.5 0.851753 +5115 0.85117 +5117.5 0.850586 +5120 0.850001 +5122.5 0.848185 +5125 0.846366 +5127.5 0.844546 +5130 0.842723 +5132.5 0.844404 +5135 0.846086 +5137.5 0.84777 +5140 0.849455 +5142.5 0.84951 +5145 0.849564 +5147.5 0.849618 +5150 0.849672 +5152.5 0.848702 +5155 0.847731 +5157.5 0.846759 +5160 0.845785 +5162.5 0.845469 +5165 0.845152 +5167.5 0.844835 +5170 0.844517 +5172.5 0.843866 +5175 0.843214 +5177.5 0.842561 +5180 0.841907 +5182.5 0.84256 +5185 0.843213 +5187.5 0.843867 +5190 0.844521 +5192.5 0.84622 +5195 0.84792 +5197.5 0.849621 +5200 0.851324 +5202.5 0.851778 +5205 0.852233 +5207.5 0.852688 +5210 0.853142 +5212.5 0.8524 +5215 0.851656 +5217.5 0.850911 +5220 0.850165 +5222.5 0.849062 +5225 0.847958 +5227.5 0.846852 +5230 0.845745 +5232.5 0.84555 +5235 0.845354 +5237.5 0.845157 +5240 0.84496 +5242.5 0.845457 +5245 0.845954 +5247.5 0.84645 +5250 0.846947 +5252.5 0.846684 +5255 0.84642 +5257.5 0.846156 +5260 0.845891 +5262.5 0.845668 +5265 0.845444 +5267.5 0.845219 +5270 0.844994 +5272.5 0.844543 +5275 0.844092 +5277.5 0.84364 +5280 0.843187 +5282.5 0.842377 +5285 0.841566 +5287.5 0.840753 +5290 0.83994 +5292.5 0.839245 +5295 0.838548 +5297.5 0.837851 +5300 0.837152 +5302.5 0.838202 +5305 0.839251 +5307.5 0.840302 +5310 0.841353 +5312.5 0.842035 +5315 0.842716 +5317.5 0.843398 +5320 0.844081 +5322.5 0.844785 +5325 0.84549 +5327.5 0.846196 +5330 0.846901 +5332.5 0.847807 +5335 0.848713 +5337.5 0.84962 +5340 0.850527 +5342.5 0.849392 +5345 0.848256 +5347.5 0.847119 +5350 0.84598 +5352.5 0.84568 +5355 0.845379 +5357.5 0.845078 +5360 0.844776 +5362.5 0.844324 +5365 0.84387 +5367.5 0.843416 +5370 0.84296 +5372.5 0.842844 +5375 0.842727 +5377.5 0.842609 +5380 0.842491 +5382.5 0.843315 +5385 0.844139 +5387.5 0.844964 +5390 0.845789 +5392.5 0.846654 +5395 0.847519 +5397.5 0.848385 +5400 0.849251 +5402.5 0.849463 +5405 0.849675 +5407.5 0.849887 +5410 0.850099 +5412.5 0.849948 +5415 0.849797 +5417.5 0.849645 +5420 0.849492 +5422.5 0.848263 +5425 0.847032 +5427.5 0.8458 +5430 0.844566 +5432.5 0.84367 +5435 0.842772 +5437.5 0.841873 +5440 0.840973 +5442.5 0.84135 +5445 0.841727 +5447.5 0.842104 +5450 0.842481 +5452.5 0.844048 +5455 0.845616 +5457.5 0.847185 +5460 0.848755 +5462.5 0.850252 +5465 0.85175 +5467.5 0.853249 +5470 0.854748 +5472.5 0.854008 +5475 0.853267 +5477.5 0.852526 +5480 0.851782 +5482.5 0.851436 +5485 0.851089 +5487.5 0.850741 +5490 0.850393 +5492.5 0.850419 +5495 0.850446 +5497.5 0.850471 +5500 0.850497 +5502.5 0.84975 +5505 0.849001 +5507.5 0.848252 +5510 0.847502 +5512.5 0.846718 +5515 0.845933 +5517.5 0.845147 +5520 0.84436 +5522.5 0.847093 +5525 0.849828 +5527.5 0.852566 +5530 0.855305 +5532.5 0.856217 +5535 0.857129 +5537.5 0.858042 +5540 0.858955 +5542.5 0.858614 +5545 0.858272 +5547.5 0.857929 +5550 0.857586 +5552.5 0.857868 +5555 0.858151 +5557.5 0.858433 +5560 0.858715 +5562.5 0.85892 +5565 0.859125 +5567.5 0.85933 +5570 0.859535 +5572.5 0.859221 +5575 0.858905 +5577.5 0.858589 +5580 0.858273 +5582.5 0.857909 +5585 0.857544 +5587.5 0.857179 +5590 0.856813 +5592.5 0.858176 +5595 0.85954 +5597.5 0.860905 +5600 0.862271 +5602.5 0.861842 +5605 0.861413 +5607.5 0.860983 +5610 0.860552 +5612.5 0.862103 +5615 0.863655 +5617.5 0.865208 +5620 0.866762 +5622.5 0.866794 +5625 0.866825 +5627.5 0.866856 +5630 0.866887 +5632.5 0.867877 +5635 0.868867 +5637.5 0.869858 +5640 0.87085 +5642.5 0.871291 +5645 0.871731 +5647.5 0.872172 +5650 0.872613 +5652.5 0.87269 +5655 0.872767 +5657.5 0.872843 +5660 0.87292 +5662.5 0.874611 +5665 0.876303 +5667.5 0.877996 +5670 0.879691 +5672.5 0.880264 +5675 0.880838 +5677.5 0.881412 +5680 0.881985 +5682.5 0.880637 +5685 0.879287 +5687.5 0.877935 +5690 0.876582 +5692.5 0.878165 +5695 0.87975 +5697.5 0.881335 +5700 0.882922 +5702.5 0.882417 +5705 0.881912 +5707.5 0.881406 +5710 0.880899 +5712.5 0.88125 +5715 0.881601 +5717.5 0.881951 +5720 0.882302 +5722.5 0.88274 +5725 0.883178 +5727.5 0.883617 +5730 0.884055 +5732.5 0.885615 +5735 0.887177 +5737.5 0.888739 +5740 0.890303 +5742.5 0.889965 +5745 0.889627 +5747.5 0.889289 +5750 0.888949 +5752.5 0.889287 +5755 0.889624 +5757.5 0.889961 +5760 0.890298 +5762.5 0.89096 +5765 0.891621 +5767.5 0.892283 +5770 0.892945 +5772.5 0.895062 +5775 0.897181 +5777.5 0.899301 +5780 0.901422 +5782.5 0.901062 +5785 0.900702 +5787.5 0.90034 +5790 0.899978 +5792.5 0.900468 +5795 0.900958 +5797.5 0.901449 +5800 0.901939 +5802.5 0.90348 +5805 0.905021 +5807.5 0.906564 +5810 0.908108 +5812.5 0.907385 +5815 0.906661 +5817.5 0.905936 +5820 0.90521 +5822.5 0.906967 +5825 0.908725 +5827.5 0.910484 +5830 0.912245 +5832.5 0.911872 +5835 0.911499 +5837.5 0.911125 +5840 0.91075 +5842.5 0.910227 +5845 0.909704 +5847.5 0.90918 +5850 0.908655 +5852.5 0.907548 +5855 0.90644 +5857.5 0.90533 +5860 0.904219 +5862.5 0.907025 +5865 0.909833 +5867.5 0.912643 +5870 0.915455 +5872.5 0.916243 +5875 0.917031 +5877.5 0.917819 +5880 0.918607 +5882.5 0.920416 +5885 0.922226 +5887.5 0.924037 +5890 0.925849 +5892.5 0.927034 +5895 0.92822 +5897.5 0.929406 +5900 0.930593 +5902.5 0.929247 +5905 0.9279 +5907.5 0.926552 +5910 0.925202 +5912.5 0.923045 +5915 0.920886 +5917.5 0.918725 +5920 0.916561 +5922.5 0.918989 +5925 0.921418 +5927.5 0.923849 +5930 0.926282 +5932.5 0.926886 +5935 0.927491 +5937.5 0.928096 +5940 0.928701 +5942.5 0.929464 +5945 0.930227 +5947.5 0.93099 +5950 0.931754 +5952.5 0.934524 +5955 0.937296 +5957.5 0.94007 +5960 0.942847 +5962.5 0.940996 +5965 0.939144 +5967.5 0.93729 +5970 0.935434 +5972.5 0.935713 +5975 0.935993 +5977.5 0.936272 +5980 0.936551 +5982.5 0.935731 +5985 0.934909 +5987.5 0.934087 +5990 0.933263 +5992.5 0.933884 +5995 0.934506 +5997.5 0.935127 +6000 0.935749 +6002.5 0.939578 +6005 0.943411 +6007.5 0.947246 +6010 0.951084 +6012.5 0.949195 +6015 0.947305 +6017.5 0.945412 +6020 0.943518 +6022.5 0.943657 +6025 0.943795 +6027.5 0.943934 +6030 0.944072 +6032.5 0.945483 +6035 0.946896 +6037.5 0.948309 +6040 0.949723 +6042.5 0.948614 +6045 0.947503 +6047.5 0.946392 +6050 0.945279 +6052.5 0.945711 +6055 0.946144 +6057.5 0.946577 +6060 0.94701 +6062.5 0.946294 +6065 0.945578 +6067.5 0.944861 +6070 0.944143 +6072.5 0.945499 +6075 0.946855 +6077.5 0.948213 +6080 0.949571 +6082.5 0.950397 +6085 0.951223 +6087.5 0.952049 +6090 0.952876 +6092.5 0.952583 +6095 0.95229 +6097.5 0.951996 +6100 0.951701 +6102.5 0.953249 +6105 0.954798 +6107.5 0.956348 +6110 0.957899 +6112.5 0.956558 +6115 0.955216 +6117.5 0.953872 +6120 0.952527 +6122.5 0.953298 +6125 0.95407 +6127.5 0.954842 +6130 0.955614 +6132.5 0.955694 +6135 0.955772 +6137.5 0.955851 +6140 0.955929 +6142.5 0.956893 +6145 0.957857 +6147.5 0.958821 +6150 0.959786 +6152.5 0.960122 +6155 0.960457 +6157.5 0.960792 +6160 0.961128 +6162.5 0.960649 +6165 0.96017 +6167.5 0.95969 +6170 0.95921 +6172.5 0.957429 +6175 0.955647 +6177.5 0.953863 +6180 0.952077 +6182.5 0.953345 +6185 0.954612 +6187.5 0.955881 +6190 0.95715 +6192.5 0.958492 +6195 0.959836 +6197.5 0.961179 +6200 0.962524 +6202.5 0.962971 +6205 0.963418 +6207.5 0.963865 +6210 0.964312 +6212.5 0.966531 +6215 0.968752 +6217.5 0.970975 +6220 0.973199 +6222.5 0.971552 +6225 0.969904 +6227.5 0.968254 +6230 0.966602 +6232.5 0.964682 +6235 0.962761 +6237.5 0.960838 +6240 0.958912 +6242.5 0.959642 +6245 0.960372 +6247.5 0.961103 +6250 0.961833 +6252.5 0.962171 +6255 0.962508 +6257.5 0.962846 +6260 0.963184 +6262.5 0.964267 +6265 0.965352 +6267.5 0.966436 +6270 0.967522 +6272.5 0.967195 +6275 0.966868 +6277.5 0.966541 +6280 0.966213 +6282.5 0.966936 +6285 0.96766 +6287.5 0.968385 +6290 0.969109 +6292.5 0.968165 +6295 0.96722 +6297.5 0.966274 +6300 0.965326 +6302.5 0.966226 +6305 0.967126 +6307.5 0.968026 +6310 0.968927 +6312.5 0.970816 +6315 0.972705 +6317.5 0.974596 +6320 0.976488 +6322.5 0.975741 +6325 0.974994 +6327.5 0.974245 +6330 0.973496 +6332.5 0.97349 +6335 0.973484 +6337.5 0.973478 +6340 0.973471 +6342.5 0.97258 +6345 0.971688 +6347.5 0.970795 +6350 0.969901 +6352.5 0.971666 +6355 0.973432 +6357.5 0.9752 +6360 0.976968 +6362.5 0.977146 +6365 0.977324 +6367.5 0.977502 +6370 0.97768 +6372.5 0.979324 +6375 0.980969 +6377.5 0.982615 +6380 0.984262 +6382.5 0.982821 +6385 0.981378 +6387.5 0.979934 +6390 0.978489 +6392.5 0.978322 +6395 0.978156 +6397.5 0.977988 +6400 0.97782 +6402.5 0.978094 +6405 0.978367 +6407.5 0.97864 +6410 0.978912 +6412.5 0.98065 +6415 0.982389 +6417.5 0.984128 +6420 0.985867 +6422.5 0.986912 +6425 0.987956 +6427.5 0.988998 +6430 0.990038 +6432.5 0.990027 +6435 0.990011 +6437.5 0.989991 +6440 0.989965 +6442.5 0.989116 +6445 0.988258 +6447.5 0.98739 +6450 0.98651 +6452.5 0.98705 +6455 0.987575 +6457.5 0.988081 +6460 0.988567 +6462.5 0.991471 +6465 0.994347 +6467.5 0.997192 +6470 0.999999 +6472.5 0.999662 +6475 0.999275 +6477.5 0.99883 +6480 0.99832 +6482.5 0.996475 +6485 0.994546 +6487.5 0.992524 +6490 0.990395 +6492.5 0.991033 +6495 0.991535 +6497.5 0.991886 +6500 0.992068 +6502.5 0.99147 +6505 0.990668 +6507.5 0.989639 +6510 0.988364 +6512.5 0.986338 +6515 0.984019 +6517.5 0.981384 +6520 0.978407 +6522.5 0.975542 +6525 0.972277 +6527.5 0.968585 +6530 0.964437 +6532.5 0.958933 +6535 0.952928 +6537.5 0.946395 +6540 0.939309 +6542.5 0.931149 +6545 0.922397 +6547.5 0.913033 +6550 0.903039 +6552.5 0.893732 +6555 0.883736 +6557.5 0.873037 +6560 0.861625 +6562.5 0.848567 +6565 0.834818 +6567.5 0.820381 +6570 0.805264 +6572.5 0.791232 +6575 0.776478 +6577.5 0.761019 +6580 0.744876 +6582.5 0.726169 +6585 0.706933 +6587.5 0.687208 +6590 0.667037 +6592.5 0.648199 +6595 0.628903 +6597.5 0.609199 +6600 0.589141 +6602.5 0.567563 +6605 0.545838 +6607.5 0.524026 +6610 0.502189 +6612.5 0.480711 +6615 0.459302 +6617.5 0.438022 +6620 0.416932 +6622.5 0.395484 +6625 0.374403 +6627.5 0.353739 +6630 0.333541 +6632.5 0.31451 +6635 0.295951 +6637.5 0.277905 +6640 0.260408 +6642.5 0.243539 +6645 0.227271 +6647.5 0.211628 +6650 0.196628 +6652.5 0.182383 +6655 0.168792 +6657.5 0.155861 +6660 0.143593 +6662.5 0.13192 +6665 0.120916 +6667.5 0.110573 +6670 0.100879 +6672.5 0.0917096 +6675 0.0831771 +6677.5 0.0752593 +6680 0.0679326 +6682.5 0.0611365 +6685 0.0548876 +6687.5 0.0491579 +6690 0.0439192 +6692.5 0.0391434 +6695 0.0348012 +6697.5 0.0308645 +6700 0.0273054 +6702.5 0.0241541 +6705 0.0213133 +6707.5 0.0187595 +6710 0.0164704 +6712.5 0.0143839 +6715 0.0125302 +6717.5 0.0108878 +6720 0.00943682 +6722.5 0.00819302 +6725 0.00709512 +6727.5 0.00612874 +6730 0.00528057 +6732.5 0.0045253 +6735 0.00386829 +6737.5 0.00329836 +6740 0.00280536 +6742.5 0.00237949 +6745 0.00201329 +6747.5 0.00169928 +6750 0.00143079 +6752.5 0.00120109 +6755 0.00100592 +6757.5 0.000840566 +6760 0.000700863 +6762.5 0.000583864 +6765 0.000485448 +6767.5 0.000402896 +6770 0.000333848 +6772.5 0.000276473 +6775 0.000228714 +6777.5 0.000189073 +6780 0.000156264 +6782.5 0.000129198 +6785 0.000106922 +6787.5 8.86396e-05 +6790 7.36785e-05 +6792.5 6.13966e-05 +6795 5.1414e-05 +6797.5 4.33233e-05 +6800 3.67846e-05 +6802.5 3.15182e-05 +6805 2.72863e-05 +6807.5 2.38955e-05 +6810 2.11866e-05 +6812.5 1.90214e-05 +6815 1.73018e-05 +6817.5 1.59399e-05 +6820 1.48646e-05 +6822.5 1.40256e-05 +6825 1.33679e-05 +6827.5 1.28543e-05 +6830 1.24548e-05 +6832.5 1.21448e-05 +6835 1.19057e-05 +6837.5 1.17222e-05 +6840 1.15823e-05 +6842.5 1.14808e-05 +6845 1.14056e-05 +6847.5 1.13509e-05 +6850 1.13121e-05 +6852.5 1.12822e-05 +6855 1.12617e-05 +6857.5 1.12484e-05 +6860 1.12407e-05 +6862.5 1.12345e-05 +6865 1.12314e-05 +6867.5 1.12308e-05 +6870 1.1232e-05 +6872.5 1.12342e-05 +6875 1.12373e-05 +6877.5 1.12413e-05 +6880 1.12458e-05 +6882.5 1.12659e-05 +6885 1.12864e-05 +6887.5 1.13071e-05 +6890 1.1328e-05 +6892.5 1.13189e-05 +6895 1.13099e-05 +6897.5 1.1301e-05 +6900 1.12921e-05 +6902.5 1.13083e-05 +6905 1.13246e-05 +6907.5 1.13409e-05 +6910 1.13572e-05 +6912.5 1.13888e-05 +6915 1.14205e-05 +6917.5 1.14523e-05 +6920 1.1484e-05 +6922.5 1.14515e-05 +6925 1.1419e-05 +6927.5 1.13865e-05 +6930 1.1354e-05 +6932.5 1.13798e-05 +6935 1.14056e-05 +6937.5 1.14314e-05 +6940 1.14572e-05 +6942.5 1.14514e-05 +6945 1.14456e-05 +6947.5 1.14398e-05 +6950 1.14339e-05 +6952.5 1.14491e-05 +6955 1.14642e-05 +6957.5 1.14794e-05 +6960 1.14946e-05 +6962.5 1.15003e-05 +6965 1.15061e-05 +6967.5 1.15118e-05 +6970 1.15176e-05 +6972.5 1.15217e-05 +6975 1.15258e-05 +6977.5 1.153e-05 +6980 1.15341e-05 +6982.5 1.15582e-05 +6985 1.15823e-05 +6987.5 1.16065e-05 +6990 1.16306e-05 +6992.5 1.16371e-05 +6995 1.16436e-05 +6997.5 1.16501e-05 +7000 1.16566e-05 +7002.5 1.16664e-05 +7005 1.16762e-05 +7007.5 1.16861e-05 +7010 1.16959e-05 +7012.5 1.1667e-05 +7015 1.1638e-05 +7017.5 1.16091e-05 +7020 1.158e-05 +7022.5 1.15835e-05 +7025 1.15869e-05 +7027.5 1.15904e-05 +7030 1.15938e-05 +7032.5 1.16245e-05 +7035 1.16551e-05 +7037.5 1.16858e-05 +7040 1.17166e-05 +7042.5 1.17276e-05 +7045 1.17386e-05 +7047.5 1.17497e-05 +7050 1.17607e-05 +7052.5 1.17731e-05 +7055 1.17856e-05 +7057.5 1.1798e-05 +7060 1.18104e-05 +7062.5 1.18008e-05 +7065 1.1791e-05 +7067.5 1.17813e-05 +7070 1.17716e-05 +7072.5 1.1763e-05 +7075 1.17544e-05 +7077.5 1.17457e-05 +7080 1.17371e-05 +7082.5 1.17366e-05 +7085 1.17361e-05 +7087.5 1.17356e-05 +7090 1.17352e-05 +7092.5 1.17485e-05 +7095 1.17618e-05 +7097.5 1.17751e-05 +7100 1.17884e-05 +7102.5 1.17982e-05 +7105 1.18081e-05 +7107.5 1.18179e-05 +7110 1.18277e-05 +7112.5 1.18339e-05 +7115 1.18401e-05 +7117.5 1.18462e-05 +7120 1.18524e-05 +7122.5 1.1856e-05 +7125 1.18596e-05 +7127.5 1.18633e-05 +7130 1.18669e-05 +7132.5 1.18776e-05 +7135 1.18884e-05 +7137.5 1.18992e-05 +7140 1.191e-05 +7142.5 1.18993e-05 +7145 1.18887e-05 +7147.5 1.1878e-05 +7150 1.18673e-05 +7152.5 1.18772e-05 +7155 1.18871e-05 +7157.5 1.1897e-05 +7160 1.19069e-05 +7162.5 1.19172e-05 +7165 1.19274e-05 +7167.5 1.19377e-05 +7170 1.19479e-05 +7172.5 1.19387e-05 +7175 1.19294e-05 +7177.5 1.19202e-05 +7180 1.19109e-05 +7182.5 1.19127e-05 +7185 1.19145e-05 +7187.5 1.19163e-05 +7190 1.1918e-05 +7192.5 1.19535e-05 +7195 1.1989e-05 +7197.5 1.20246e-05 +7200 1.20601e-05 +7202.5 1.20363e-05 +7205 1.20126e-05 +7207.5 1.19888e-05 +7210 1.1965e-05 +7212.5 1.19647e-05 +7215 1.19644e-05 +7217.5 1.19641e-05 +7220 1.19638e-05 +7222.5 1.19584e-05 +7225 1.19529e-05 +7227.5 1.19475e-05 +7230 1.1942e-05 +7232.5 1.19754e-05 +7235 1.20088e-05 +7237.5 1.20422e-05 +7240 1.20757e-05 +7242.5 1.20618e-05 +7245 1.20479e-05 +7247.5 1.2034e-05 +7250 1.20201e-05 +7252.5 1.20579e-05 +7255 1.20957e-05 +7257.5 1.21335e-05 +7260 1.21714e-05 +7262.5 1.21607e-05 +7265 1.21499e-05 +7267.5 1.21392e-05 +7270 1.21284e-05 +7272.5 1.21068e-05 +7275 1.20851e-05 +7277.5 1.20634e-05 +7280 1.20418e-05 +7282.5 1.20432e-05 +7285 1.20446e-05 +7287.5 1.2046e-05 +7290 1.20474e-05 +7292.5 1.20383e-05 +7295 1.20292e-05 +7297.5 1.20201e-05 +7300 1.2011e-05 +7302.5 1.20349e-05 +7305 1.20587e-05 +7307.5 1.20825e-05 +7310 1.21064e-05 +7312.5 1.21026e-05 +7315 1.20987e-05 +7317.5 1.20949e-05 +7320 1.2091e-05 +7322.5 1.21021e-05 +7325 1.21133e-05 +7327.5 1.21244e-05 +7330 1.21355e-05 +7332.5 1.21408e-05 +7335 1.2146e-05 +7337.5 1.21512e-05 +7340 1.21565e-05 +7342.5 1.21587e-05 +7345 1.21609e-05 +7347.5 1.21631e-05 +7350 1.21653e-05 +7352.5 1.2148e-05 +7355 1.21306e-05 +7357.5 1.21133e-05 +7360 1.20959e-05 +7362.5 1.20913e-05 +7365 1.20868e-05 +7367.5 1.20822e-05 +7370 1.20776e-05 +7372.5 1.20975e-05 +7375 1.21175e-05 +7377.5 1.21374e-05 +7380 1.21574e-05 +7382.5 1.2174e-05 +7385 1.21906e-05 +7387.5 1.22072e-05 +7390 1.22238e-05 +7392.5 1.22252e-05 +7395 1.22267e-05 +7397.5 1.22281e-05 +7400 1.22296e-05 +7402.5 1.22214e-05 +7405 1.22132e-05 +7407.5 1.2205e-05 +7410 1.21968e-05 +7412.5 1.21948e-05 +7415 1.21928e-05 +7417.5 1.21907e-05 +7420 1.21887e-05 +7422.5 1.22007e-05 +7425 1.22128e-05 +7427.5 1.22248e-05 +7430 1.22369e-05 +7432.5 1.22302e-05 +7435 1.22235e-05 +7437.5 1.22168e-05 +7440 1.22101e-05 +7442.5 1.22258e-05 +7445 1.22415e-05 +7447.5 1.22572e-05 +7450 1.22729e-05 +7452.5 1.2262e-05 +7455 1.22511e-05 +7457.5 1.22402e-05 +7460 1.22293e-05 +7462.5 1.22332e-05 +7465 1.22371e-05 +7467.5 1.2241e-05 +7470 1.22449e-05 +7472.5 1.22735e-05 +7475 1.23022e-05 +7477.5 1.23308e-05 +7480 1.23595e-05 +7482.5 1.23614e-05 +7485 1.23634e-05 +7487.5 1.23653e-05 +7490 1.23673e-05 +7492.5 1.23639e-05 +7495 1.23605e-05 +7497.5 1.23571e-05 +7500 1.23537e-05 diff --git a/csst_mci_sim/support/seddata/GAIA_rp.dat b/csst_mci_sim/support/seddata/GAIA_rp.dat new file mode 100755 index 0000000000000000000000000000000000000000..9a1766dd09e3158cea55d7afab9f6d161eca7b55 --- /dev/null +++ b/csst_mci_sim/support/seddata/GAIA_rp.dat @@ -0,0 +1,1881 @@ +6100 1.04805e-05 +6102.5 1.07607e-05 +6105 1.10945e-05 +6107.5 1.14919e-05 +6110 1.19645e-05 +6112.5 1.2521e-05 +6115 1.31816e-05 +6117.5 1.39647e-05 +6120 1.48917e-05 +6122.5 1.59918e-05 +6125 1.72903e-05 +6127.5 1.88207e-05 +6130 2.06221e-05 +6132.5 2.27374e-05 +6135 2.522e-05 +6137.5 2.81297e-05 +6140 3.15349e-05 +6142.5 3.55182e-05 +6145 4.01668e-05 +6147.5 4.55841e-05 +6150 5.1888e-05 +6152.5 5.92077e-05 +6155 6.77e-05 +6157.5 7.75384e-05 +6160 8.89197e-05 +6162.5 0.000102055 +6165 0.000117203 +6167.5 0.000134649 +6170 0.000154711 +6172.5 0.000177715 +6175 0.000204086 +6177.5 0.000234272 +6180 0.000268775 +6182.5 0.000308276 +6185 0.000353311 +6187.5 0.000404582 +6190 0.000462865 +6192.5 0.000529024 +6195 0.000604013 +6197.5 0.000688885 +6200 0.000784802 +6202.5 0.000892934 +6205 0.00101476 +6207.5 0.00115183 +6210 0.0013058 +6212.5 0.00147886 +6215 0.00167275 +6217.5 0.00188966 +6220 0.00213197 +6222.5 0.00240104 +6225 0.00270057 +6227.5 0.00303352 +6230 0.00340307 +6232.5 0.00381251 +6235 0.00426561 +6237.5 0.0047663 +6240 0.00531876 +6242.5 0.00592952 +6245 0.0066017 +6247.5 0.00734042 +6250 0.00815107 +6252.5 0.00903889 +6255 0.0100102 +6257.5 0.0110714 +6260 0.0122291 +6262.5 0.0134914 +6265 0.0148646 +6267.5 0.0163562 +6270 0.017974 +6272.5 0.0197225 +6275 0.0216131 +6277.5 0.0236543 +6280 0.0258548 +6282.5 0.0282275 +6285 0.0307783 +6287.5 0.0335167 +6290 0.036452 +6292.5 0.0395853 +6295 0.0429333 +6297.5 0.0465054 +6300 0.0503111 +6302.5 0.0543727 +6305 0.0586884 +6307.5 0.0632675 +6310 0.0681188 +6312.5 0.0732601 +6315 0.0786921 +6317.5 0.0844227 +6320 0.0904595 +6322.5 0.0967757 +6325 0.103407 +6327.5 0.110359 +6330 0.117636 +6332.5 0.125255 +6335 0.133207 +6337.5 0.141496 +6340 0.150123 +6342.5 0.15907 +6345 0.168353 +6347.5 0.177971 +6350 0.187922 +6352.5 0.198268 +6355 0.208945 +6357.5 0.219949 +6360 0.231271 +6362.5 0.242853 +6365 0.254732 +6367.5 0.266898 +6370 0.279341 +6372.5 0.292101 +6375 0.305116 +6377.5 0.318372 +6380 0.331854 +6382.5 0.345404 +6385 0.359135 +6387.5 0.373029 +6390 0.387067 +6392.5 0.401295 +6395 0.415632 +6397.5 0.43006 +6400 0.444556 +6402.5 0.459125 +6405 0.473723 +6407.5 0.488327 +6410 0.502918 +6412.5 0.51757 +6415 0.532172 +6417.5 0.546701 +6420 0.561139 +6422.5 0.575411 +6425 0.589549 +6427.5 0.603533 +6430 0.617346 +6432.5 0.630884 +6435 0.644212 +6437.5 0.657315 +6440 0.670177 +6442.5 0.682711 +6445 0.694975 +6447.5 0.706958 +6450 0.718649 +6452.5 0.730173 +6455 0.741391 +6457.5 0.752296 +6460 0.762881 +6462.5 0.773385 +6465 0.783567 +6467.5 0.793422 +6470 0.802949 +6472.5 0.811821 +6475 0.820355 +6477.5 0.828555 +6480 0.836421 +6482.5 0.843817 +6485 0.850885 +6487.5 0.857629 +6490 0.864053 +6492.5 0.87049 +6495 0.876625 +6497.5 0.882466 +6500 0.888018 +6502.5 0.893219 +6505 0.898147 +6507.5 0.902811 +6510 0.907221 +6512.5 0.911323 +6515 0.915188 +6517.5 0.918825 +6520 0.922244 +6522.5 0.92551 +6525 0.928576 +6527.5 0.931453 +6530 0.93415 +6532.5 0.936559 +6535 0.938806 +6537.5 0.940898 +6540 0.942845 +6542.5 0.944588 +6545 0.946202 +6547.5 0.947695 +6550 0.949074 +6552.5 0.950526 +6555 0.95188 +6557.5 0.953141 +6560 0.954317 +6562.5 0.955275 +6565 0.956158 +6567.5 0.956973 +6570 0.957724 +6572.5 0.958691 +6575 0.959605 +6577.5 0.96047 +6580 0.961289 +6582.5 0.961731 +6585 0.962135 +6587.5 0.962504 +6590 0.962841 +6592.5 0.963487 +6595 0.964107 +6597.5 0.964703 +6600 0.965277 +6602.5 0.965554 +6605 0.965813 +6607.5 0.966057 +6610 0.966285 +6612.5 0.966587 +6615 0.966877 +6617.5 0.967156 +6620 0.967426 +6622.5 0.967491 +6625 0.967549 +6627.5 0.9676 +6630 0.967646 +6632.5 0.967951 +6635 0.968251 +6637.5 0.968548 +6640 0.96884 +6642.5 0.969152 +6645 0.969461 +6647.5 0.969767 +6650 0.970071 +6652.5 0.970441 +6655 0.970809 +6657.5 0.971175 +6660 0.971541 +6662.5 0.971834 +6665 0.972127 +6667.5 0.972418 +6670 0.972709 +6672.5 0.972838 +6675 0.972965 +6677.5 0.973093 +6680 0.973219 +6682.5 0.973262 +6685 0.973305 +6687.5 0.973347 +6690 0.973388 +6692.5 0.973428 +6695 0.973467 +6697.5 0.973507 +6700 0.973545 +6702.5 0.973892 +6705 0.974239 +6707.5 0.974585 +6710 0.974931 +6712.5 0.974894 +6715 0.974856 +6717.5 0.974819 +6720 0.974781 +6722.5 0.9753 +6725 0.97582 +6727.5 0.976339 +6730 0.976859 +6732.5 0.976988 +6735 0.977118 +6737.5 0.977247 +6740 0.977376 +6742.5 0.977464 +6745 0.977551 +6747.5 0.977639 +6750 0.977726 +6752.5 0.977719 +6755 0.977711 +6757.5 0.977704 +6760 0.977696 +6762.5 0.977847 +6765 0.977996 +6767.5 0.978146 +6770 0.978296 +6772.5 0.978545 +6775 0.978795 +6777.5 0.979044 +6780 0.979293 +6782.5 0.979548 +6785 0.979803 +6787.5 0.980058 +6790 0.980313 +6792.5 0.9804 +6795 0.980487 +6797.5 0.980574 +6800 0.98066 +6802.5 0.980759 +6805 0.980858 +6807.5 0.980957 +6810 0.981056 +6812.5 0.981106 +6815 0.981157 +6817.5 0.981207 +6820 0.981256 +6822.5 0.981389 +6825 0.981521 +6827.5 0.981654 +6830 0.981786 +6832.5 0.981921 +6835 0.982056 +6837.5 0.982191 +6840 0.982326 +6842.5 0.982518 +6845 0.98271 +6847.5 0.982901 +6850 0.983092 +6852.5 0.983249 +6855 0.983405 +6857.5 0.983561 +6860 0.983717 +6862.5 0.983849 +6865 0.983981 +6867.5 0.984113 +6870 0.984245 +6872.5 0.984373 +6875 0.984501 +6877.5 0.984628 +6880 0.984756 +6882.5 0.98508 +6885 0.985404 +6887.5 0.985728 +6890 0.986051 +6892.5 0.986001 +6895 0.985951 +6897.5 0.985901 +6900 0.98585 +6902.5 0.986114 +6905 0.986378 +6907.5 0.986642 +6910 0.986906 +6912.5 0.987358 +6915 0.98781 +6917.5 0.988262 +6920 0.988714 +6922.5 0.988349 +6925 0.987983 +6927.5 0.987617 +6930 0.987251 +6932.5 0.987621 +6935 0.98799 +6937.5 0.98836 +6940 0.988729 +6942.5 0.988695 +6945 0.98866 +6947.5 0.988625 +6950 0.98859 +6952.5 0.988819 +6955 0.989047 +6957.5 0.989275 +6960 0.989503 +6962.5 0.989606 +6965 0.989709 +6967.5 0.989811 +6970 0.989913 +6972.5 0.989992 +6975 0.990071 +6977.5 0.990149 +6980 0.990227 +6982.5 0.990556 +6985 0.990884 +6987.5 0.991212 +6990 0.991539 +6992.5 0.991632 +6995 0.991724 +6997.5 0.991816 +7000 0.991907 +7002.5 0.992045 +7005 0.992183 +7007.5 0.992321 +7010 0.992459 +7012.5 0.992104 +7015 0.99175 +7017.5 0.991396 +7020 0.991041 +7022.5 0.9911 +7025 0.99116 +7027.5 0.991219 +7030 0.991278 +7032.5 0.991692 +7035 0.992105 +7037.5 0.992519 +7040 0.992932 +7042.5 0.993098 +7045 0.993263 +7047.5 0.993428 +7050 0.993593 +7052.5 0.993781 +7055 0.993968 +7057.5 0.994155 +7060 0.994342 +7062.5 0.994248 +7065 0.994154 +7067.5 0.994059 +7070 0.993964 +7072.5 0.993884 +7075 0.993804 +7077.5 0.993723 +7080 0.993642 +7082.5 0.993675 +7085 0.993708 +7087.5 0.993741 +7090 0.993773 +7092.5 0.993983 +7095 0.994193 +7097.5 0.994402 +7100 0.994611 +7102.5 0.994769 +7105 0.994928 +7107.5 0.995086 +7110 0.995243 +7112.5 0.995358 +7115 0.995472 +7117.5 0.995586 +7120 0.9957 +7122.5 0.995776 +7125 0.995853 +7127.5 0.995929 +7130 0.996005 +7132.5 0.996165 +7135 0.996325 +7137.5 0.996484 +7140 0.996644 +7142.5 0.996517 +7145 0.99639 +7147.5 0.996263 +7150 0.996135 +7152.5 0.996274 +7155 0.996413 +7157.5 0.996552 +7160 0.99669 +7162.5 0.996832 +7165 0.996974 +7167.5 0.997116 +7170 0.997257 +7172.5 0.997131 +7175 0.997004 +7177.5 0.996878 +7180 0.996751 +7182.5 0.996768 +7185 0.996784 +7187.5 0.996801 +7190 0.996817 +7192.5 0.997273 +7195 0.997728 +7197.5 0.998184 +7200 0.998639 +7202.5 0.998321 +7205 0.998002 +7207.5 0.997683 +7210 0.997364 +7212.5 0.997347 +7215 0.99733 +7217.5 0.997313 +7220 0.997296 +7222.5 0.997215 +7225 0.997135 +7227.5 0.997054 +7230 0.996972 +7232.5 0.997411 +7235 0.99785 +7237.5 0.998289 +7240 0.998727 +7242.5 0.998549 +7245 0.99837 +7247.5 0.998191 +7250 0.998011 +7252.5 0.998509 +7255 0.999006 +7257.5 0.999504 +7260 1 +7262.5 0.999872 +7265 0.999742 +7267.5 0.999613 +7270 0.999483 +7272.5 0.999217 +7275 0.998951 +7277.5 0.998685 +7280 0.998418 +7282.5 0.998459 +7285 0.9985 +7287.5 0.99854 +7290 0.99858 +7292.5 0.998471 +7295 0.998361 +7297.5 0.998251 +7300 0.998141 +7302.5 0.998461 +7305 0.998781 +7307.5 0.999101 +7310 0.99942 +7312.5 0.999372 +7315 0.999324 +7317.5 0.999275 +7320 0.999226 +7322.5 0.999365 +7325 0.999505 +7327.5 0.999643 +7330 0.999782 +7332.5 0.999822 +7335 0.999862 +7337.5 0.999902 +7340 0.999941 +7342.5 0.999932 +7345 0.999923 +7347.5 0.999914 +7350 0.999905 +7352.5 0.999644 +7355 0.999384 +7357.5 0.999123 +7360 0.998862 +7362.5 0.998746 +7365 0.998631 +7367.5 0.998514 +7370 0.998398 +7372.5 0.998597 +7375 0.998796 +7377.5 0.998995 +7380 0.999194 +7382.5 0.999328 +7385 0.999462 +7387.5 0.999596 +7390 0.99973 +7392.5 0.99967 +7395 0.99961 +7397.5 0.99955 +7400 0.99949 +7402.5 0.999287 +7405 0.999085 +7407.5 0.998882 +7410 0.998679 +7412.5 0.998543 +7415 0.998406 +7417.5 0.99827 +7420 0.998133 +7422.5 0.998175 +7425 0.998217 +7427.5 0.998259 +7430 0.9983 +7432.5 0.998098 +7435 0.997896 +7437.5 0.997693 +7440 0.99749 +7442.5 0.997585 +7445 0.997679 +7447.5 0.997773 +7450 0.997867 +7452.5 0.997583 +7455 0.9973 +7457.5 0.997016 +7460 0.996732 +7462.5 0.996644 +7465 0.996556 +7467.5 0.996467 +7470 0.996379 +7472.5 0.996604 +7475 0.99683 +7477.5 0.997055 +7480 0.99728 +7482.5 0.997168 +7485 0.997055 +7487.5 0.996943 +7490 0.99683 +7492.5 0.996604 +7495 0.996379 +7497.5 0.996152 +7500 0.995926 +7502.5 0.995876 +7505 0.995826 +7507.5 0.995776 +7510 0.995725 +7512.5 0.995783 +7515 0.995841 +7517.5 0.995899 +7520 0.995957 +7522.5 0.995592 +7525 0.995227 +7527.5 0.994861 +7530 0.994495 +7532.5 0.994388 +7535 0.994281 +7537.5 0.994174 +7540 0.994067 +7542.5 0.994505 +7545 0.994942 +7547.5 0.99538 +7550 0.995817 +7552.5 0.995728 +7555 0.995638 +7557.5 0.995548 +7560 0.995458 +7562.5 0.995455 +7565 0.995451 +7567.5 0.995447 +7570 0.995442 +7572.5 0.995299 +7575 0.995155 +7577.5 0.995012 +7580 0.994868 +7582.5 0.994971 +7585 0.995073 +7587.5 0.995176 +7590 0.995278 +7592.5 0.994932 +7595 0.994586 +7597.5 0.994239 +7600 0.993892 +7602.5 0.993902 +7605 0.993911 +7607.5 0.99392 +7610 0.993929 +7612.5 0.994144 +7615 0.994359 +7617.5 0.994573 +7620 0.994787 +7622.5 0.994697 +7625 0.994606 +7627.5 0.994515 +7630 0.994423 +7632.5 0.994569 +7635 0.994714 +7637.5 0.99486 +7640 0.995005 +7642.5 0.994897 +7645 0.994789 +7647.5 0.994681 +7650 0.994572 +7652.5 0.994394 +7655 0.994215 +7657.5 0.994037 +7660 0.993858 +7662.5 0.993346 +7665 0.992834 +7667.5 0.992322 +7670 0.991809 +7672.5 0.991928 +7675 0.992046 +7677.5 0.992164 +7680 0.992282 +7682.5 0.991783 +7685 0.991285 +7687.5 0.990786 +7690 0.990287 +7692.5 0.990035 +7695 0.989782 +7697.5 0.989529 +7700 0.989276 +7702.5 0.989133 +7705 0.988989 +7707.5 0.988846 +7710 0.988702 +7712.5 0.988406 +7715 0.98811 +7717.5 0.987814 +7720 0.987517 +7722.5 0.987321 +7725 0.987125 +7727.5 0.986929 +7730 0.986732 +7732.5 0.986737 +7735 0.986742 +7737.5 0.986746 +7740 0.98675 +7742.5 0.986298 +7745 0.985846 +7747.5 0.985393 +7750 0.984941 +7752.5 0.984641 +7755 0.984342 +7757.5 0.984042 +7760 0.983742 +7762.5 0.983028 +7765 0.982314 +7767.5 0.981601 +7770 0.980887 +7772.5 0.980784 +7775 0.980681 +7777.5 0.980578 +7780 0.980475 +7782.5 0.980372 +7785 0.980269 +7787.5 0.980166 +7790 0.980063 +7792.5 0.979232 +7795 0.9784 +7797.5 0.977568 +7800 0.976737 +7802.5 0.976275 +7805 0.975812 +7807.5 0.97535 +7810 0.974887 +7812.5 0.975061 +7815 0.975233 +7817.5 0.975406 +7820 0.975578 +7822.5 0.975322 +7825 0.975066 +7827.5 0.974809 +7830 0.974552 +7832.5 0.973733 +7835 0.972913 +7837.5 0.972094 +7840 0.971274 +7842.5 0.970778 +7845 0.970282 +7847.5 0.969786 +7850 0.969289 +7852.5 0.968843 +7855 0.968396 +7857.5 0.96795 +7860 0.967503 +7862.5 0.967122 +7865 0.966742 +7867.5 0.966361 +7870 0.96598 +7872.5 0.96556 +7875 0.96514 +7877.5 0.96472 +7880 0.964299 +7882.5 0.963948 +7885 0.963597 +7887.5 0.963245 +7890 0.962894 +7892.5 0.962507 +7895 0.962121 +7897.5 0.961734 +7900 0.961348 +7902.5 0.960925 +7905 0.960503 +7907.5 0.96008 +7910 0.959657 +7912.5 0.959474 +7915 0.959291 +7917.5 0.959108 +7920 0.958925 +7922.5 0.958511 +7925 0.958098 +7927.5 0.957684 +7930 0.95727 +7932.5 0.956819 +7935 0.956368 +7937.5 0.955917 +7940 0.955465 +7942.5 0.954652 +7945 0.953838 +7947.5 0.953025 +7950 0.952212 +7952.5 0.951993 +7955 0.951774 +7957.5 0.951554 +7960 0.951334 +7962.5 0.950877 +7965 0.950419 +7967.5 0.949962 +7970 0.949504 +7972.5 0.949367 +7975 0.949231 +7977.5 0.949093 +7980 0.948956 +7982.5 0.948585 +7985 0.948213 +7987.5 0.94784 +7990 0.947467 +7992.5 0.946957 +7995 0.946447 +7997.5 0.945937 +8000 0.945426 +8002.5 0.944912 +8005 0.944397 +8007.5 0.943882 +8010 0.943366 +8012.5 0.943304 +8015 0.943241 +8017.5 0.943178 +8020 0.943115 +8022.5 0.943006 +8025 0.942898 +8027.5 0.942789 +8030 0.94268 +8032.5 0.94219 +8035 0.9417 +8037.5 0.941209 +8040 0.940719 +8042.5 0.94034 +8045 0.93996 +8047.5 0.93958 +8050 0.939199 +8052.5 0.93862 +8055 0.938041 +8057.5 0.937462 +8060 0.936882 +8062.5 0.936664 +8065 0.936446 +8067.5 0.936227 +8070 0.936009 +8072.5 0.935543 +8075 0.935076 +8077.5 0.934609 +8080 0.934141 +8082.5 0.934291 +8085 0.934439 +8087.5 0.934588 +8090 0.934736 +8092.5 0.934091 +8095 0.933445 +8097.5 0.9328 +8100 0.932155 +8102.5 0.932088 +8105 0.93202 +8107.5 0.931952 +8110 0.931884 +8112.5 0.93135 +8115 0.930816 +8117.5 0.930281 +8120 0.929746 +8122.5 0.929792 +8125 0.929837 +8127.5 0.929883 +8130 0.929928 +8132.5 0.929742 +8135 0.929556 +8137.5 0.929369 +8140 0.929183 +8142.5 0.928559 +8145 0.927935 +8147.5 0.92731 +8150 0.926685 +8152.5 0.925978 +8155 0.92527 +8157.5 0.924562 +8160 0.923854 +8162.5 0.9234 +8165 0.922945 +8167.5 0.92249 +8170 0.922035 +8172.5 0.921579 +8175 0.921123 +8177.5 0.920668 +8180 0.920212 +8182.5 0.919765 +8185 0.919318 +8187.5 0.91887 +8190 0.918422 +8192.5 0.917622 +8195 0.916822 +8197.5 0.916022 +8200 0.915221 +8202.5 0.914624 +8205 0.914027 +8207.5 0.91343 +8210 0.912833 +8212.5 0.912435 +8215 0.912037 +8217.5 0.911638 +8220 0.91124 +8222.5 0.910539 +8225 0.909838 +8227.5 0.909137 +8230 0.908437 +8232.5 0.907917 +8235 0.907396 +8237.5 0.906876 +8240 0.906356 +8242.5 0.905309 +8245 0.904262 +8247.5 0.903215 +8250 0.902168 +8252.5 0.90151 +8255 0.900851 +8257.5 0.900193 +8260 0.899534 +8262.5 0.898672 +8265 0.897811 +8267.5 0.896949 +8270 0.896088 +8272.5 0.895358 +8275 0.894627 +8277.5 0.893897 +8280 0.893167 +8282.5 0.8923 +8285 0.891432 +8287.5 0.890565 +8290 0.889698 +8292.5 0.889137 +8295 0.888576 +8297.5 0.888014 +8300 0.887453 +8302.5 0.886812 +8305 0.886172 +8307.5 0.885531 +8310 0.88489 +8312.5 0.883866 +8315 0.882842 +8317.5 0.881818 +8320 0.880794 +8322.5 0.880057 +8325 0.879321 +8327.5 0.878584 +8330 0.877847 +8332.5 0.877398 +8335 0.876948 +8337.5 0.876498 +8340 0.876048 +8342.5 0.875285 +8345 0.874522 +8347.5 0.873759 +8350 0.872996 +8352.5 0.872282 +8355 0.871568 +8357.5 0.870854 +8360 0.87014 +8362.5 0.868856 +8365 0.86757 +8367.5 0.866284 +8370 0.864997 +8372.5 0.864229 +8375 0.863462 +8377.5 0.862695 +8380 0.861928 +8382.5 0.861528 +8385 0.861128 +8387.5 0.860728 +8390 0.860327 +8392.5 0.859272 +8395 0.858218 +8397.5 0.857165 +8400 0.856112 +8402.5 0.855425 +8405 0.854739 +8407.5 0.854052 +8410 0.853364 +8412.5 0.852653 +8415 0.851941 +8417.5 0.851228 +8420 0.850514 +8422.5 0.84982 +8425 0.849126 +8427.5 0.848432 +8430 0.847738 +8432.5 0.847983 +8435 0.848228 +8437.5 0.848472 +8440 0.848716 +8442.5 0.847627 +8445 0.846538 +8447.5 0.845448 +8450 0.844357 +8452.5 0.843839 +8455 0.84332 +8457.5 0.8428 +8460 0.842279 +8462.5 0.841472 +8465 0.840664 +8467.5 0.839856 +8470 0.839046 +8472.5 0.838478 +8475 0.837909 +8477.5 0.837339 +8480 0.836768 +8482.5 0.832069 +8485 0.827377 +8487.5 0.82269 +8490 0.818008 +8492.5 0.816959 +8495 0.815908 +8497.5 0.814855 +8500 0.813801 +8502.5 0.813889 +8505 0.813976 +8507.5 0.814063 +8510 0.814149 +8512.5 0.813436 +8515 0.812722 +8517.5 0.812009 +8520 0.811294 +8522.5 0.810372 +8525 0.809449 +8527.5 0.808524 +8530 0.807599 +8532.5 0.807299 +8535 0.806998 +8537.5 0.806697 +8540 0.806396 +8542.5 0.805768 +8545 0.805138 +8547.5 0.804507 +8550 0.803875 +8552.5 0.803473 +8555 0.803071 +8557.5 0.802668 +8560 0.802264 +8562.5 0.801794 +8565 0.801323 +8567.5 0.800851 +8570 0.800379 +8572.5 0.799248 +8575 0.798117 +8577.5 0.796985 +8580 0.795852 +8582.5 0.795065 +8585 0.794277 +8587.5 0.793489 +8590 0.7927 +8592.5 0.792179 +8595 0.791658 +8597.5 0.791135 +8600 0.790612 +8602.5 0.789638 +8605 0.788665 +8607.5 0.78769 +8610 0.786715 +8612.5 0.786267 +8615 0.785819 +8617.5 0.785371 +8620 0.784923 +8622.5 0.784123 +8625 0.783322 +8627.5 0.782521 +8630 0.781719 +8632.5 0.780807 +8635 0.779894 +8637.5 0.778981 +8640 0.778068 +8642.5 0.776722 +8645 0.775376 +8647.5 0.77403 +8650 0.772685 +8652.5 0.772021 +8655 0.771356 +8657.5 0.770692 +8660 0.770027 +8662.5 0.768938 +8665 0.767848 +8667.5 0.766758 +8670 0.765668 +8672.5 0.763615 +8675 0.761563 +8677.5 0.759512 +8680 0.757461 +8682.5 0.757019 +8685 0.756577 +8687.5 0.756135 +8690 0.755692 +8692.5 0.755295 +8695 0.754898 +8697.5 0.7545 +8700 0.754103 +8702.5 0.75247 +8705 0.750837 +8707.5 0.749206 +8710 0.747574 +8712.5 0.74636 +8715 0.745145 +8717.5 0.743932 +8720 0.742718 +8722.5 0.742612 +8725 0.742505 +8727.5 0.742398 +8730 0.742292 +8732.5 0.740589 +8735 0.738888 +8737.5 0.737186 +8740 0.735486 +8742.5 0.734398 +8745 0.73331 +8747.5 0.732222 +8750 0.731134 +8752.5 0.730007 +8755 0.72888 +8757.5 0.727753 +8760 0.726627 +8762.5 0.72492 +8765 0.723214 +8767.5 0.721509 +8770 0.719805 +8772.5 0.719167 +8775 0.718529 +8777.5 0.717891 +8780 0.717252 +8782.5 0.715148 +8785 0.713044 +8787.5 0.710941 +8790 0.708839 +8792.5 0.707437 +8795 0.706035 +8797.5 0.704634 +8800 0.703234 +8802.5 0.702581 +8805 0.701927 +8807.5 0.701274 +8810 0.700621 +8812.5 0.699013 +8815 0.697406 +8817.5 0.6958 +8820 0.694193 +8822.5 0.693489 +8825 0.692785 +8827.5 0.69208 +8830 0.691376 +8832.5 0.689699 +8835 0.688022 +8837.5 0.686347 +8840 0.684672 +8842.5 0.683279 +8845 0.681885 +8847.5 0.680492 +8850 0.679098 +8852.5 0.678593 +8855 0.678088 +8857.5 0.677583 +8860 0.677078 +8862.5 0.675363 +8865 0.67365 +8867.5 0.671937 +8870 0.670225 +8872.5 0.669526 +8875 0.668826 +8877.5 0.668126 +8880 0.667426 +8882.5 0.666531 +8885 0.665635 +8887.5 0.664739 +8890 0.663843 +8892.5 0.662092 +8895 0.660341 +8897.5 0.658591 +8900 0.656841 +8902.5 0.656012 +8905 0.655183 +8907.5 0.654354 +8910 0.653525 +8912.5 0.652093 +8915 0.65066 +8917.5 0.649227 +8920 0.647794 +8922.5 0.646204 +8925 0.644614 +8927.5 0.643024 +8930 0.641434 +8932.5 0.640847 +8935 0.640261 +8937.5 0.639674 +8940 0.639087 +8942.5 0.637497 +8945 0.635906 +8947.5 0.634315 +8950 0.632723 +8952.5 0.631498 +8955 0.630272 +8957.5 0.629046 +8960 0.627821 +8962.5 0.62718 +8965 0.62654 +8967.5 0.625899 +8970 0.625258 +8972.5 0.623719 +8975 0.62218 +8977.5 0.620641 +8980 0.619102 +8982.5 0.617541 +8985 0.61598 +8987.5 0.61442 +8990 0.612859 +8992.5 0.611701 +8995 0.610543 +8997.5 0.609384 +9000 0.608226 +9002.5 0.606933 +9005 0.605639 +9007.5 0.604346 +9010 0.603052 +9012.5 0.601624 +9015 0.600196 +9017.5 0.598769 +9020 0.597341 +9022.5 0.59617 +9025 0.594999 +9027.5 0.593828 +9030 0.592656 +9032.5 0.591529 +9035 0.590401 +9037.5 0.589274 +9040 0.588146 +9042.5 0.586729 +9045 0.585312 +9047.5 0.583895 +9050 0.582479 +9052.5 0.581514 +9055 0.58055 +9057.5 0.579585 +9060 0.578621 +9062.5 0.576964 +9065 0.575307 +9067.5 0.57365 +9070 0.571993 +9072.5 0.570425 +9075 0.568857 +9077.5 0.567289 +9080 0.565722 +9082.5 0.565102 +9085 0.564482 +9087.5 0.563862 +9090 0.563242 +9092.5 0.561482 +9095 0.559724 +9097.5 0.557966 +9100 0.556208 +9102.5 0.554675 +9105 0.553142 +9107.5 0.551609 +9110 0.550077 +9112.5 0.549021 +9115 0.547966 +9117.5 0.546911 +9120 0.545856 +9122.5 0.543959 +9125 0.542061 +9127.5 0.540164 +9130 0.538267 +9132.5 0.537258 +9135 0.536249 +9137.5 0.535239 +9140 0.53423 +9142.5 0.533227 +9145 0.532224 +9147.5 0.531221 +9150 0.530219 +9152.5 0.528111 +9155 0.526004 +9157.5 0.523898 +9160 0.521794 +9162.5 0.521092 +9165 0.52039 +9167.5 0.519688 +9170 0.518986 +9172.5 0.5176 +9175 0.516215 +9177.5 0.51483 +9180 0.513445 +9182.5 0.511276 +9185 0.509107 +9187.5 0.506939 +9190 0.504771 +9192.5 0.504219 +9195 0.503667 +9197.5 0.503114 +9200 0.502562 +9202.5 0.500975 +9205 0.499389 +9207.5 0.497804 +9210 0.496219 +9212.5 0.494188 +9215 0.492157 +9217.5 0.490127 +9220 0.488098 +9222.5 0.487419 +9225 0.48674 +9227.5 0.486061 +9230 0.485383 +9232.5 0.483644 +9235 0.481906 +9237.5 0.480169 +9240 0.478433 +9242.5 0.47686 +9245 0.475288 +9247.5 0.473717 +9250 0.472145 +9252.5 0.471324 +9255 0.470503 +9257.5 0.469682 +9260 0.468861 +9262.5 0.467014 +9265 0.465168 +9267.5 0.463322 +9270 0.461477 +9272.5 0.460032 +9275 0.458587 +9277.5 0.457143 +9280 0.455699 +9282.5 0.454813 +9285 0.453928 +9287.5 0.453043 +9290 0.452158 +9292.5 0.450506 +9295 0.448856 +9297.5 0.447205 +9300 0.445555 +9302.5 0.444156 +9305 0.442758 +9307.5 0.441359 +9310 0.439961 +9312.5 0.43893 +9315 0.437899 +9317.5 0.436869 +9320 0.435838 +9322.5 0.434353 +9325 0.432867 +9327.5 0.431382 +9330 0.429898 +9332.5 0.428549 +9335 0.427201 +9337.5 0.425853 +9340 0.424506 +9342.5 0.423019 +9345 0.421532 +9347.5 0.420046 +9350 0.41856 +9352.5 0.417256 +9355 0.415952 +9357.5 0.414649 +9360 0.413346 +9362.5 0.411978 +9365 0.410611 +9367.5 0.409244 +9370 0.407877 +9372.5 0.406258 +9375 0.40464 +9377.5 0.403022 +9380 0.401404 +9382.5 0.400398 +9385 0.399392 +9387.5 0.398387 +9390 0.397382 +9392.5 0.395972 +9395 0.394562 +9397.5 0.393152 +9400 0.391743 +9402.5 0.390058 +9405 0.388373 +9407.5 0.38669 +9410 0.385007 +9412.5 0.384242 +9415 0.383478 +9417.5 0.382713 +9420 0.381949 +9422.5 0.380273 +9425 0.378598 +9427.5 0.376923 +9430 0.375249 +9432.5 0.373461 +9435 0.371672 +9437.5 0.369884 +9440 0.368096 +9442.5 0.367515 +9445 0.366935 +9447.5 0.366355 +9450 0.365774 +9452.5 0.364348 +9455 0.362922 +9457.5 0.361496 +9460 0.36007 +9462.5 0.358299 +9465 0.356528 +9467.5 0.354757 +9470 0.352985 +9472.5 0.352428 +9475 0.351871 +9477.5 0.351313 +9480 0.350756 +9482.5 0.349374 +9485 0.347992 +9487.5 0.34661 +9490 0.345229 +9492.5 0.343415 +9495 0.341602 +9497.5 0.339789 +9500 0.337975 +9502.5 0.337106 +9505 0.336237 +9507.5 0.335367 +9510 0.334498 +9512.5 0.333434 +9515 0.33237 +9517.5 0.331305 +9520 0.330241 +9522.5 0.328709 +9525 0.327177 +9527.5 0.325646 +9530 0.324114 +9532.5 0.323268 +9535 0.322423 +9537.5 0.321578 +9540 0.320733 +9542.5 0.31954 +9545 0.318348 +9547.5 0.317155 +9550 0.315963 +9552.5 0.314227 +9555 0.312492 +9557.5 0.310758 +9560 0.309023 +9562.5 0.307972 +9565 0.30692 +9567.5 0.305869 +9570 0.304818 +9572.5 0.303584 +9575 0.302351 +9577.5 0.301117 +9580 0.299884 +9582.5 0.298572 +9585 0.29726 +9587.5 0.295949 +9590 0.294638 +9592.5 0.29346 +9595 0.292282 +9597.5 0.291104 +9600 0.289927 +9602.5 0.288515 +9605 0.287103 +9607.5 0.285692 +9610 0.284281 +9612.5 0.283187 +9615 0.282093 +9617.5 0.281 +9620 0.279907 +9622.5 0.278777 +9625 0.277647 +9627.5 0.276517 +9630 0.275388 +9632.5 0.273828 +9635 0.272269 +9637.5 0.27071 +9640 0.269152 +9642.5 0.26823 +9645 0.267309 +9647.5 0.266389 +9650 0.265468 +9652.5 0.264399 +9655 0.263331 +9657.5 0.262262 +9660 0.261194 +9662.5 0.259536 +9665 0.257878 +9667.5 0.256222 +9670 0.254566 +9672.5 0.253709 +9675 0.252853 +9677.5 0.251997 +9680 0.251141 +9682.5 0.250124 +9685 0.249107 +9687.5 0.24809 +9690 0.247075 +9692.5 0.245398 +9695 0.243721 +9697.5 0.242046 +9700 0.240371 +9702.5 0.239445 +9705 0.238519 +9707.5 0.237594 +9710 0.23667 +9712.5 0.235802 +9715 0.234935 +9717.5 0.234067 +9720 0.233201 +9722.5 0.23149 +9725 0.22978 +9727.5 0.22807 +9730 0.226362 +9732.5 0.225364 +9735 0.224366 +9737.5 0.223369 +9740 0.222372 +9742.5 0.221723 +9745 0.221075 +9747.5 0.220428 +9750 0.21978 +9752.5 0.218155 +9755 0.21653 +9757.5 0.214906 +9760 0.213283 +9762.5 0.212078 +9765 0.210874 +9767.5 0.20967 +9770 0.208467 +9772.5 0.207947 +9775 0.207427 +9777.5 0.206907 +9780 0.206388 +9782.5 0.205024 +9785 0.20366 +9787.5 0.202298 +9790 0.200936 +9792.5 0.199536 +9795 0.198136 +9797.5 0.196738 +9800 0.195339 +9802.5 0.194751 +9805 0.194163 +9807.5 0.193575 +9810 0.192987 +9812.5 0.191938 +9815 0.190888 +9817.5 0.189839 +9820 0.188791 +9822.5 0.187253 +9825 0.185715 +9827.5 0.184179 +9830 0.182643 +9832.5 0.181887 +9835 0.181131 +9837.5 0.180375 +9840 0.17962 +9842.5 0.179005 +9845 0.178389 +9847.5 0.177774 +9850 0.177159 +9852.5 0.175672 +9855 0.174186 +9857.5 0.1727 +9860 0.171214 +9862.5 0.170246 +9865 0.169278 +9867.5 0.16831 +9870 0.167342 +9872.5 0.166731 +9875 0.16612 +9877.5 0.165509 +9880 0.164898 +9882.5 0.163722 +9885 0.162546 +9887.5 0.161371 +9890 0.160197 +9892.5 0.159022 +9895 0.157847 +9897.5 0.156672 +9900 0.155498 +9902.5 0.154806 +9905 0.154113 +9907.5 0.153421 +9910 0.152728 +9912.5 0.151928 +9915 0.151127 +9917.5 0.150327 +9920 0.149528 +9922.5 0.148283 +9925 0.14704 +9927.5 0.145796 +9930 0.144554 +9932.5 0.143787 +9935 0.143021 +9937.5 0.142254 +9940 0.141489 +9942.5 0.140805 +9945 0.140121 +9947.5 0.139438 +9950 0.138755 +9952.5 0.137543 +9955 0.136331 +9957.5 0.13512 +9960 0.133909 +9962.5 0.133064 +9965 0.132218 +9967.5 0.131373 +9970 0.130528 +9972.5 0.129841 +9975 0.129154 +9977.5 0.128467 +9980 0.12778 +9982.5 0.126799 +9985 0.125819 +9987.5 0.12484 +9990 0.12386 +9992.5 0.12303 +9995 0.1222 +9997.5 0.121371 +10000 0.120542 +10002.5 0.119851 +10005 0.119161 +10007.5 0.118471 +10010 0.117782 +10012.5 0.116838 +10015 0.115895 +10017.5 0.114952 +10020 0.114009 +10022.5 0.113211 +10025 0.112414 +10027.5 0.111618 +10030 0.110821 +10032.5 0.110184 +10035 0.109548 +10037.5 0.108912 +10040 0.108276 +10042.5 0.107402 +10045 0.106528 +10047.5 0.105655 +10050 0.104782 +10052.5 0.103899 +10055 0.103017 +10057.5 0.102135 +10060 0.101253 +10062.5 0.100705 +10065 0.100158 +10067.5 0.0996111 +10070 0.0990644 +10072.5 0.09835 +10075 0.0976359 +10077.5 0.0969221 +10080 0.0962087 +10082.5 0.0952245 +10085 0.0942409 +10087.5 0.0932577 +10090 0.0922751 +10092.5 0.0917553 +10095 0.0912357 +10097.5 0.0907164 +10100 0.0901973 +10102.5 0.0896328 +10105 0.0890686 +10107.5 0.0885047 +10110 0.087941 +10112.5 0.086981 +10115 0.0860215 +10117.5 0.0850625 +10120 0.0841039 +10122.5 0.0834647 +10125 0.0828258 +10127.5 0.0821872 +10130 0.081549 +10132.5 0.081117 +10135 0.0806852 +10137.5 0.0802537 +10140 0.0798223 +10142.5 0.0790584 +10145 0.0782948 +10147.5 0.0775317 +10150 0.0767689 +10152.5 0.0759714 +10155 0.0751742 +10157.5 0.0743776 +10160 0.0735814 +10162.5 0.0732147 +10165 0.0728481 +10167.5 0.0724817 +10170 0.0721155 +10172.5 0.0715495 +10175 0.0709839 +10177.5 0.0704186 +10180 0.0698536 +10182.5 0.0690039 +10185 0.0681547 +10187.5 0.0673058 +10190 0.0664575 +10192.5 0.0659436 +10195 0.0654301 +10197.5 0.0649168 +10200 0.0644038 +10202.5 0.0640455 +10205 0.0636874 +10207.5 0.0633295 +10210 0.0629717 +10212.5 0.062253 +10215 0.0615348 +10217.5 0.060817 +10220 0.0600996 +10222.5 0.0594714 +10225 0.0588434 +10227.5 0.0582158 +10230 0.0575885 +10232.5 0.0572339 +10235 0.0568795 +10237.5 0.0565253 +10240 0.0561713 +10242.5 0.0557322 +10245 0.0552933 +10247.5 0.0548546 +10250 0.0544162 +10252.5 0.0537114 +10255 0.0530071 +10257.5 0.0523032 +10260 0.0515997 +10262.5 0.0511659 +10265 0.0507324 +10267.5 0.0502991 +10270 0.049866 +10272.5 0.0495312 +10275 0.0491966 +10277.5 0.0488621 +10280 0.0485279 +10282.5 0.0479518 +10285 0.0473761 +10287.5 0.0468007 +10290 0.0462256 +10292.5 0.0456997 +10295 0.0451742 +10297.5 0.0446489 +10300 0.0441239 +10302.5 0.0438051 +10305 0.0434864 +10307.5 0.0431679 +10310 0.0428496 +10312.5 0.0424604 +10315 0.0420714 +10317.5 0.0416826 +10320 0.0412941 +10322.5 0.0407242 +10325 0.0401547 +10327.5 0.0395855 +10330 0.0390166 +10332.5 0.0386528 +10335 0.0382891 +10337.5 0.0379257 +10340 0.0375625 +10342.5 0.0372636 +10345 0.0369648 +10347.5 0.0366661 +10350 0.0363676 +10352.5 0.0359305 +10355 0.0354935 +10357.5 0.0350567 +10360 0.0346202 +10362.5 0.034197 +10365 0.033774 +10367.5 0.0333512 +10370 0.0329287 +10372.5 0.0326579 +10375 0.0323872 +10377.5 0.0321166 +10380 0.0318461 +10382.5 0.0315273 +10385 0.0312086 +10387.5 0.03089 +10390 0.0305716 +10392.5 0.0301244 +10395 0.0296773 +10397.5 0.0292304 +10400 0.0287837 +10402.5 0.0284854 +10405 0.0281872 +10407.5 0.0278893 +10410 0.0275914 +10412.5 0.0273472 +10415 0.0271031 +10417.5 0.026859 +10420 0.0266151 +10422.5 0.0262715 +10425 0.025928 +10427.5 0.0255848 +10430 0.0252418 +10432.5 0.0248893 +10435 0.0245369 +10437.5 0.0241848 +10440 0.0238328 +10442.5 0.0236159 +10445 0.0233991 +10447.5 0.0231825 +10450 0.0229659 +10452.5 0.0227302 +10455 0.0224946 +10457.5 0.0222592 +10460 0.0220239 +10462.5 0.0216627 +10465 0.0213017 +10467.5 0.0209409 +10470 0.0205802 +10472.5 0.0203355 +10475 0.020091 +10477.5 0.0198466 +10480 0.0196023 +10482.5 0.0194228 +10485 0.0192434 +10487.5 0.0190641 +10490 0.0188849 +10492.5 0.0186396 +10495 0.0183944 +10497.5 0.0181494 +10500 0.0179045 +10502.5 0.0176049 +10505 0.0173054 +10507.5 0.017006 +10510 0.0167067 +10512.5 0.0165314 +10515 0.0163563 +10517.5 0.0161812 +10520 0.0160062 +10522.5 0.0158427 +10525 0.0156794 +10527.5 0.0155161 +10530 0.0153529 +10532.5 0.0151055 +10535 0.0148582 +10537.5 0.014611 +10540 0.014364 +10542.5 0.0141383 +10545 0.0139129 +10547.5 0.0136875 +10550 0.0134623 +10552.5 0.0133336 +10555 0.0132051 +10557.5 0.0130766 +10560 0.0129482 +10562.5 0.0128008 +10565 0.0126535 +10567.5 0.0125063 +10570 0.0123592 +10572.5 0.0121197 +10575 0.0118803 +10577.5 0.011641 +10580 0.0114019 +10582.5 0.0112375 +10585 0.0110732 +10587.5 0.0109091 +10590 0.0107451 +10592.5 0.0106427 +10595 0.0105404 +10597.5 0.0104382 +10600 0.010336 +10602.5 0.0101908 +10605 0.0100456 +10607.5 0.00990058 +10610 0.0097556 +10612.5 0.00955399 +10615 0.00935251 +10617.5 0.00915116 +10620 0.00894995 +10622.5 0.00883905 +10625 0.00872821 +10627.5 0.00861744 +10630 0.00850673 +10632.5 0.00841757 +10635 0.00832848 +10637.5 0.00823944 +10640 0.00815046 +10642.5 0.00801128 +10645 0.00787217 +10647.5 0.00773315 +10650 0.0075942 +10652.5 0.00744119 +10655 0.00728828 +10657.5 0.00713548 +10660 0.00698278 +10662.5 0.0068993 +10665 0.00681587 +10667.5 0.00673251 +10670 0.0066492 +10672.5 0.00657229 +10675 0.00649543 +10677.5 0.00641862 +10680 0.00634186 +10682.5 0.00621513 +10685 0.00608848 +10687.5 0.00596191 +10690 0.00583541 +10692.5 0.0057245 +10695 0.00561367 +10697.5 0.00550291 +10700 0.00539222 +10702.5 0.00532734 +10705 0.00526249 +10707.5 0.00519768 +10710 0.00513292 +10712.5 0.00506521 +10715 0.00499754 +10717.5 0.00492992 +10720 0.00486234 +10722.5 0.00475452 +10725 0.00464678 +10727.5 0.00453912 +10730 0.00443152 +10732.5 0.00435164 +10735 0.00427182 +10737.5 0.00419205 +10740 0.00411234 +10742.5 0.00406395 +10745 0.00401559 +10747.5 0.00396726 +10750 0.00391896 +10752.5 0.00386084 +10755 0.00380276 +10757.5 0.00374472 +10760 0.00368673 +10762.5 0.00359917 +10765 0.00351167 +10767.5 0.00342423 +10770 0.00333685 +10772.5 0.00328102 +10775 0.00322524 +10777.5 0.0031695 +10780 0.00311379 +10782.5 0.00307527 +10785 0.00303678 +10787.5 0.00299831 +10790 0.00295987 +10792.5 0.00291061 +10795 0.00286137 +10797.5 0.00281217 +10800 0.002763 diff --git a/csst_mci_sim/support/seddata/SDSS_g.dat b/csst_mci_sim/support/seddata/SDSS_g.dat new file mode 100755 index 0000000000000000000000000000000000000000..ef08beaea3195ede9f81f10f0ff2554ad7cbdc8b --- /dev/null +++ b/csst_mci_sim/support/seddata/SDSS_g.dat @@ -0,0 +1,89 @@ +3630.0 0.0000000000 +3655.0 0.0003000000 +3680.0 0.0008000000 +3705.0 0.0013000000 +3730.0 0.0019000000 +3755.0 0.0024000000 +3780.0 0.0034000000 +3805.0 0.0055000000 +3830.0 0.0103000000 +3855.0 0.0194000000 +3880.0 0.0326000000 +3905.0 0.0492000000 +3930.0 0.0686000000 +3955.0 0.0900000000 +3980.0 0.1123000000 +4005.0 0.1342000000 +4030.0 0.1545000000 +4055.0 0.1722000000 +4080.0 0.1873000000 +4105.0 0.2003000000 +4130.0 0.2116000000 +4155.0 0.2214000000 +4180.0 0.2301000000 +4205.0 0.2378000000 +4230.0 0.2448000000 +4255.0 0.2513000000 +4280.0 0.2574000000 +4305.0 0.2633000000 +4330.0 0.2691000000 +4355.0 0.2747000000 +4380.0 0.2801000000 +4405.0 0.2852000000 +4430.0 0.2899000000 +4455.0 0.2940000000 +4480.0 0.2979000000 +4505.0 0.3016000000 +4530.0 0.3055000000 +4555.0 0.3097000000 +4580.0 0.3141000000 +4605.0 0.3184000000 +4630.0 0.3224000000 +4655.0 0.3257000000 +4680.0 0.3284000000 +4705.0 0.3307000000 +4730.0 0.3327000000 +4755.0 0.3346000000 +4780.0 0.3364000000 +4805.0 0.3383000000 +4830.0 0.3403000000 +4855.0 0.3425000000 +4880.0 0.3448000000 +4905.0 0.3472000000 +4930.0 0.3495000000 +4955.0 0.3519000000 +4980.0 0.3541000000 +5005.0 0.3562000000 +5030.0 0.3581000000 +5055.0 0.3597000000 +5080.0 0.3609000000 +5105.0 0.3613000000 +5130.0 0.3609000000 +5155.0 0.3595000000 +5180.0 0.3581000000 +5205.0 0.3558000000 +5230.0 0.3452000000 +5255.0 0.3194000000 +5280.0 0.2807000000 +5305.0 0.2339000000 +5330.0 0.1839000000 +5355.0 0.1352000000 +5380.0 0.0911000000 +5405.0 0.0548000000 +5430.0 0.0295000000 +5455.0 0.0166000000 +5480.0 0.0112000000 +5505.0 0.0077000000 +5530.0 0.0050000000 +5555.0 0.0032000000 +5580.0 0.0021000000 +5605.0 0.0015000000 +5630.0 0.0012000000 +5655.0 0.0010000000 +5680.0 0.0009000000 +5705.0 0.0008000000 +5730.0 0.0006000000 +5755.0 0.0005000000 +5780.0 0.0003000000 +5805.0 0.0001000000 +5830.0 0.0000000000 diff --git a/csst_mci_sim/support/seddata/SDSS_i.dat b/csst_mci_sim/support/seddata/SDSS_i.dat new file mode 100755 index 0000000000000000000000000000000000000000..aac944e67f9fded30ee6454262da8490aa6eb01c --- /dev/null +++ b/csst_mci_sim/support/seddata/SDSS_i.dat @@ -0,0 +1,89 @@ +6430.0 0.0000000000 +6455.0 0.0001000000 +6480.0 0.0003000000 +6505.0 0.0004000000 +6530.0 0.0004000000 +6555.0 0.0003000000 +6580.0 0.0003000000 +6605.0 0.0004000000 +6630.0 0.0009000000 +6655.0 0.0019000000 +6680.0 0.0034000000 +6705.0 0.0056000000 +6730.0 0.0103000000 +6755.0 0.0194000000 +6780.0 0.0344000000 +6805.0 0.0561000000 +6830.0 0.0839000000 +6855.0 0.1164000000 +6880.0 0.1528000000 +6905.0 0.1948000000 +6930.0 0.2408000000 +6955.0 0.2857000000 +6980.0 0.3233000000 +7005.0 0.3503000000 +7030.0 0.3759000000 +7055.0 0.3990000000 +7080.0 0.4162000000 +7105.0 0.4233000000 +7130.0 0.4165000000 +7155.0 0.3943000000 +7180.0 0.3760000000 +7205.0 0.3823000000 +7230.0 0.3918000000 +7255.0 0.3892000000 +7280.0 0.3828000000 +7305.0 0.3820000000 +7330.0 0.3884000000 +7355.0 0.3872000000 +7380.0 0.3821000000 +7405.0 0.3787000000 +7430.0 0.3759000000 +7455.0 0.3727000000 +7480.0 0.3681000000 +7505.0 0.3618000000 +7530.0 0.3565000000 +7555.0 0.3554000000 +7580.0 0.3478000000 +7605.0 0.1473000000 +7630.0 0.2096000000 +7655.0 0.2648000000 +7680.0 0.3300000000 +7705.0 0.3256000000 +7730.0 0.3223000000 +7755.0 0.3179000000 +7780.0 0.3129000000 +7805.0 0.3077000000 +7830.0 0.3026000000 +7855.0 0.2980000000 +7880.0 0.2944000000 +7905.0 0.2921000000 +7930.0 0.2916000000 +7955.0 0.2921000000 +7980.0 0.2927000000 +8005.0 0.2923000000 +8030.0 0.2896000000 +8055.0 0.2840000000 +8080.0 0.2758000000 +8105.0 0.2642000000 +8130.0 0.2427000000 +8155.0 0.2091000000 +8180.0 0.1689000000 +8205.0 0.1276000000 +8230.0 0.0901000000 +8255.0 0.0603000000 +8280.0 0.0378000000 +8305.0 0.0218000000 +8330.0 0.0117000000 +8355.0 0.0068000000 +8380.0 0.0048000000 +8405.0 0.0033000000 +8430.0 0.0020000000 +8455.0 0.0013000000 +8480.0 0.0010000000 +8505.0 0.0009000000 +8530.0 0.0009000000 +8555.0 0.0008000000 +8580.0 0.0005000000 +8605.0 0.0002000000 +8630.0 0.0000000000 diff --git a/csst_mci_sim/support/seddata/SDSS_r.dat b/csst_mci_sim/support/seddata/SDSS_r.dat new file mode 100755 index 0000000000000000000000000000000000000000..813c48e619b1ca5e2e0a7e3c4f11116a32f585c3 --- /dev/null +++ b/csst_mci_sim/support/seddata/SDSS_r.dat @@ -0,0 +1,75 @@ +5380.0 0.0000000000 +5405.0 0.0014000000 +5430.0 0.0099000000 +5455.0 0.0259000000 +5480.0 0.0497000000 +5505.0 0.0807000000 +5530.0 0.1186000000 +5555.0 0.1625000000 +5580.0 0.2093000000 +5605.0 0.2555000000 +5630.0 0.2975000000 +5655.0 0.3326000000 +5680.0 0.3609000000 +5705.0 0.3834000000 +5730.0 0.4010000000 +5755.0 0.4147000000 +5780.0 0.4253000000 +5805.0 0.4333000000 +5830.0 0.4395000000 +5855.0 0.4446000000 +5880.0 0.4489000000 +5905.0 0.4527000000 +5930.0 0.4563000000 +5955.0 0.4599000000 +5980.0 0.4634000000 +6005.0 0.4665000000 +6030.0 0.4689000000 +6055.0 0.4703000000 +6080.0 0.4711000000 +6105.0 0.4717000000 +6130.0 0.4727000000 +6155.0 0.4744000000 +6180.0 0.4767000000 +6205.0 0.4792000000 +6230.0 0.4819000000 +6255.0 0.4844000000 +6280.0 0.4867000000 +6305.0 0.4887000000 +6330.0 0.4902000000 +6355.0 0.4909000000 +6380.0 0.4912000000 +6405.0 0.4912000000 +6430.0 0.4912000000 +6455.0 0.4914000000 +6480.0 0.4915000000 +6505.0 0.4912000000 +6530.0 0.4901000000 +6555.0 0.4878000000 +6580.0 0.4852000000 +6605.0 0.4818000000 +6630.0 0.4697000000 +6655.0 0.4421000000 +6680.0 0.4009000000 +6705.0 0.3499000000 +6730.0 0.2924000000 +6755.0 0.2318000000 +6780.0 0.1715000000 +6805.0 0.1152000000 +6830.0 0.0687000000 +6855.0 0.0380000000 +6880.0 0.0212000000 +6905.0 0.0134000000 +6930.0 0.0099000000 +6955.0 0.0076000000 +6980.0 0.0055000000 +7005.0 0.0039000000 +7030.0 0.0027000000 +7055.0 0.0020000000 +7080.0 0.0015000000 +7105.0 0.0012000000 +7130.0 0.0010000000 +7155.0 0.0007000000 +7180.0 0.0004000000 +7205.0 0.0002000000 +7230.0 0.0000000000 diff --git a/csst_mci_sim/support/seddata/SDSS_u.dat b/csst_mci_sim/support/seddata/SDSS_u.dat new file mode 100755 index 0000000000000000000000000000000000000000..62901697fd0537da8343155d12bb6566b2887411 --- /dev/null +++ b/csst_mci_sim/support/seddata/SDSS_u.dat @@ -0,0 +1,47 @@ +2980.0 0.0000000000 +3005.0 0.0001000000 +3030.0 0.0005000000 +3055.0 0.0013000000 +3080.0 0.0026000000 +3105.0 0.0052000000 +3130.0 0.0093000000 +3155.0 0.0161000000 +3180.0 0.0240000000 +3205.0 0.0323000000 +3230.0 0.0405000000 +3255.0 0.0485000000 +3280.0 0.0561000000 +3305.0 0.0634000000 +3330.0 0.0700000000 +3355.0 0.0756000000 +3380.0 0.0803000000 +3405.0 0.0848000000 +3430.0 0.0883000000 +3455.0 0.0917000000 +3480.0 0.0959000000 +3505.0 0.1001000000 +3530.0 0.1029000000 +3555.0 0.1044000000 +3580.0 0.1053000000 +3605.0 0.1063000000 +3630.0 0.1075000000 +3655.0 0.1085000000 +3680.0 0.1084000000 +3705.0 0.1064000000 +3730.0 0.1024000000 +3755.0 0.0966000000 +3780.0 0.0887000000 +3805.0 0.0787000000 +3830.0 0.0672000000 +3855.0 0.0549000000 +3880.0 0.0413000000 +3905.0 0.0268000000 +3930.0 0.0145000000 +3955.0 0.0075000000 +3980.0 0.0042000000 +4005.0 0.0022000000 +4030.0 0.0010000000 +4055.0 0.0006000000 +4080.0 0.0004000000 +4105.0 0.0002000000 +4130.0 0.0000000000 diff --git a/csst_mci_sim/support/seddata/SDSS_z.dat b/csst_mci_sim/support/seddata/SDSS_z.dat new file mode 100755 index 0000000000000000000000000000000000000000..c20bd3ea77da77d174fcbb21aed13b780002db92 --- /dev/null +++ b/csst_mci_sim/support/seddata/SDSS_z.dat @@ -0,0 +1,141 @@ +7730.0 0.0000000000 +7755.0 0.0000000000 +7780.0 0.0001000000 +7805.0 0.0001000000 +7830.0 0.0001000000 +7855.0 0.0002000000 +7880.0 0.0002000000 +7905.0 0.0003000000 +7930.0 0.0005000000 +7955.0 0.0007000000 +7980.0 0.0011000000 +8005.0 0.0017000000 +8030.0 0.0027000000 +8055.0 0.0040000000 +8080.0 0.0057000000 +8105.0 0.0079000000 +8130.0 0.0106000000 +8155.0 0.0139000000 +8180.0 0.0178000000 +8205.0 0.0222000000 +8230.0 0.0271000000 +8255.0 0.0324000000 +8280.0 0.0382000000 +8305.0 0.0446000000 +8330.0 0.0511000000 +8355.0 0.0564000000 +8380.0 0.0603000000 +8405.0 0.0637000000 +8430.0 0.0667000000 +8455.0 0.0694000000 +8480.0 0.0717000000 +8505.0 0.0736000000 +8530.0 0.0752000000 +8555.0 0.0765000000 +8580.0 0.0775000000 +8605.0 0.0782000000 +8630.0 0.0786000000 +8655.0 0.0787000000 +8680.0 0.0785000000 +8705.0 0.0780000000 +8730.0 0.0772000000 +8755.0 0.0763000000 +8780.0 0.0751000000 +8805.0 0.0738000000 +8830.0 0.0723000000 +8855.0 0.0708000000 +8880.0 0.0693000000 +8905.0 0.0674000000 +8930.0 0.0632000000 +8955.0 0.0581000000 +8980.0 0.0543000000 +9005.0 0.0526000000 +9030.0 0.0523000000 +9055.0 0.0522000000 +9080.0 0.0512000000 +9105.0 0.0496000000 +9130.0 0.0481000000 +9155.0 0.0473000000 +9180.0 0.0476000000 +9205.0 0.0482000000 +9230.0 0.0476000000 +9255.0 0.0447000000 +9280.0 0.0391000000 +9305.0 0.0329000000 +9330.0 0.0283000000 +9355.0 0.0264000000 +9380.0 0.0271000000 +9405.0 0.0283000000 +9430.0 0.0275000000 +9455.0 0.0254000000 +9480.0 0.0252000000 +9505.0 0.0256000000 +9530.0 0.0246000000 +9555.0 0.0244000000 +9580.0 0.0252000000 +9605.0 0.0258000000 +9630.0 0.0265000000 +9655.0 0.0274000000 +9680.0 0.0279000000 +9705.0 0.0271000000 +9730.0 0.0252000000 +9755.0 0.0236000000 +9780.0 0.0227000000 +9805.0 0.0222000000 +9830.0 0.0216000000 +9855.0 0.0208000000 +9880.0 0.0196000000 +9905.0 0.0183000000 +9930.0 0.0171000000 +9955.0 0.0160000000 +9980.0 0.0149000000 +10005.0 0.0138000000 +10030.0 0.0128000000 +10055.0 0.0118000000 +10080.0 0.0108000000 +10105.0 0.0099000000 +10130.0 0.0091000000 +10155.0 0.0083000000 +10180.0 0.0075000000 +10205.0 0.0068000000 +10230.0 0.0061000000 +10255.0 0.0055000000 +10280.0 0.0050000000 +10305.0 0.0045000000 +10330.0 0.0041000000 +10355.0 0.0037000000 +10380.0 0.0033000000 +10405.0 0.0030000000 +10430.0 0.0027000000 +10455.0 0.0025000000 +10480.0 0.0023000000 +10505.0 0.0021000000 +10530.0 0.0019000000 +10555.0 0.0018000000 +10580.0 0.0017000000 +10605.0 0.0016000000 +10630.0 0.0015000000 +10655.0 0.0014000000 +10680.0 0.0013000000 +10705.0 0.0012000000 +10730.0 0.0011000000 +10755.0 0.0010000000 +10780.0 0.0009000000 +10805.0 0.0008000000 +10830.0 0.0008000000 +10855.0 0.0007000000 +10880.0 0.0006000000 +10905.0 0.0006000000 +10930.0 0.0006000000 +10955.0 0.0005000000 +10980.0 0.0005000000 +11005.0 0.0004000000 +11030.0 0.0004000000 +11055.0 0.0003000000 +11080.0 0.0003000000 +11105.0 0.0002000000 +11130.0 0.0002000000 +11155.0 0.0001000000 +11180.0 0.0001000000 +11205.0 0.0000000000 +11230.0 0.0000000000 diff --git a/csst_mci_sim/support/seddata/galaxy_temp.fits b/csst_mci_sim/support/seddata/galaxy_temp.fits new file mode 100755 index 0000000000000000000000000000000000000000..268a6ddf45124358763be193dcc2e52452a5649a Binary files /dev/null and b/csst_mci_sim/support/seddata/galaxy_temp.fits differ diff --git a/csst_mci_sim/support/seddata/stellar_temp.fits b/csst_mci_sim/support/seddata/stellar_temp.fits new file mode 100755 index 0000000000000000000000000000000000000000..770045d633ff2990d8d84bbf5f993cdd0f224073 Binary files /dev/null and b/csst_mci_sim/support/seddata/stellar_temp.fits differ diff --git a/csst_mci_sim/support/shao.py b/csst_mci_sim/support/shao.py index 3717c9fb93fd242bd9b1f524bd5cfe919dd4652d..15ed21118fb28beacbb21717ddfd58cdd655ec23 100644 --- a/csst_mci_sim/support/shao.py +++ b/csst_mci_sim/support/shao.py @@ -86,11 +86,11 @@ def onOrbitObsPosition(input_ra_list, input_dec_list, input_pmra_list, input_pmd raise TypeError("Parameter 16 second range error [0 ~ 60)!", input_second) #Inital dynamic lib - # import os - # currfile=os.getcwd() - # print(currfile) + import os + currfile=os.getcwd() + print(currfile) - shao = cdll.LoadLibrary('./mci_so/libshao.so') + shao = cdll.LoadLibrary('../mci_so/libshao.so') shao.onOrbitObs.restype = c_int