Commit 41940f8c authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

debug

parent 06298943
Pipeline #6967 failed with stage
in 0 seconds
...@@ -27,7 +27,9 @@ from scipy.interpolate import interp1d ...@@ -27,7 +27,9 @@ from scipy.interpolate import interp1d
import astropy.coordinates as coord import astropy.coordinates as coord
import ctypes import ctypes
import sys import sys
sys.path.append('./csst_ifs_sim')
##sys.path.append('./csst_ifs_sim')
conf.auto_max_age = None conf.auto_max_age = None
""" """
...@@ -230,15 +232,18 @@ class CDM03bidir(): ...@@ -230,15 +232,18 @@ class CDM03bidir():
self.log.info('quadrant=%i' % iquadrant) self.log.info('quadrant=%i' % iquadrant)
self.log.info('iflip=%i' % iflip) self.log.info('iflip=%i' % iflip)
self.log.info('jflip=%i' % jflip) self.log.info('jflip=%i' % jflip)
################
############################################
################################################################################# #################################################################################
###modify ###modify
#sys.path.append('../so') #sys.path.append('../so')
try: from .ifs_so import cdm03bidir
from ifs_so import cdm03bidir try:
from ifs_so import cdm03bidir
except: except:
from .ifs_so import cdm03bidir from .ifs_so import cdm03bidir
# from ifs_so.cdm03.cpython-38-x86_64-linux-gnu import cdm03bidir # from ifs_so.cdm03.cpython-38-x86_64-linux-gnu import cdm03bidir
# import cdm03bidir # import cdm03bidir
CTIed = cdm03bidir.cdm03(np.asfortranarray(data), CTIed = cdm03bidir.cdm03(np.asfortranarray(data),
...@@ -1936,7 +1941,7 @@ class IFSsimulator(): ...@@ -1936,7 +1941,7 @@ class IFSsimulator():
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def configure(self, simnumber): def configure(self, sourcein, dir_path, result_path, simnumber, debug, applyhole):
""" """
...@@ -1960,6 +1965,16 @@ class IFSsimulator(): ...@@ -1960,6 +1965,16 @@ class IFSsimulator():
self.processConfigs() self.processConfigs()
self._createEmpty() self._createEmpty()
self.information['dir_path']=dir_path
self.information['result_path']=result_path
self.information['debug'] = debug
self.source=sourcein
self.simnumber=simnumber
############################################################ ############################################################
...@@ -1967,10 +1982,9 @@ class IFSsimulator(): ...@@ -1967,10 +1982,9 @@ class IFSsimulator():
result_day = now.strftime("%Y-%m-%d") result_day = now.strftime("%Y-%m-%d")
# self.information['holemask']
if self.source == 'LAMP': if self.source == 'LAMP':
if self.information['holemask'] == 'yes': if applyhole == 'yes':
ss = '_with_hole_' ss = '_with_hole_'
else: else:
ss = '_no_hole_' ss = '_no_hole_'
...@@ -1978,18 +1992,23 @@ class IFSsimulator(): ...@@ -1978,18 +1992,23 @@ class IFSsimulator():
else: else:
ss = '_' ss = '_'
if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/': # if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/':
self.result_path = self.information['dir_path'] + \ # self.result_path = self.information['dir_path'] + \
self.information['result_path']+'/'+self.source+ss+result_day # self.information['result_path']+'/'+self.source+ss+result_day
else: # else:
home_path = os.environ['HOME'] # home_path = os.environ['HOME']
if home_path == '/home/yan': # if home_path == '/home/yan':
self.result_path = '../IFS_simData/'+self.source+ss+result_day # self.result_path = '../IFS_simData/'+self.source+ss+result_day
else: # else:
self.result_path = '/data/ifspip/CCD_ima/'+self.source+ss+result_day # self.result_path = '/data/ifspip/CCD_ima/'+self.source+ss+result_day
self.result_path= self.information['result_path']+'/'+self.source+ss+result_day
print(self.information['result_path'])
if os.path.isdir(self.result_path) == False: if os.path.isdir(self.result_path) == False:
os.mkdir(self.result_path) os.mkdir(self.result_path)
...@@ -5172,19 +5191,7 @@ class IFSsimulator(): ...@@ -5172,19 +5191,7 @@ class IFSsimulator():
nphoton = flux2photons(flux_1[ilam], lam) nphoton = flux2photons(flux_1[ilam], lam)
# photons/cm2/s/A/arcsec2 # photons/cm2/s/A/arcsec2
ns = nphoton*np.ones((sizeout, sizeout)) ns = nphoton*np.ones((sizeout, sizeout))
##### add code 2024.7.15 #####
sim_resolution_chart=True;
if sim_resolution_chart:
#### sim resolution chart effect
###self.log.info('load resolution chart image' )
da0 = sio.loadmat('ifs_resolution_chart.mat')
img_chart = da0['img']
ns = nphoton*img_chart
slice_image = ns*self.telarea*Width_lambda*10*exptime slice_image = ns*self.telarea*Width_lambda*10*exptime
...@@ -5466,7 +5473,8 @@ class IFSsimulator(): ...@@ -5466,7 +5473,8 @@ class IFSsimulator():
self.source = sourcein self.source = sourcein
self.simnumber = simnumber self.simnumber = simnumber
self.configure(simnumber) # print the configfile name and path;
#self.configure(simnumber,dir_path,result_path) # print the configfile name and path;
self.debug = self.information['debug'] self.debug = self.information['debug']
...@@ -5736,7 +5744,7 @@ class IFSsimulator(): ...@@ -5736,7 +5744,7 @@ class IFSsimulator():
############################################################################ ############################################################################
def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): def runIFSsim(sourcein, configfile, dir_path, result_path, iLoop, debug, applyhole):
""" """
...@@ -5760,6 +5768,9 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): ...@@ -5760,6 +5768,9 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'):
simulate = dict() simulate = dict()
simulate[iLoop] = IFSsimulator(configfile) simulate[iLoop] = IFSsimulator(configfile)
simulate[iLoop].configure(sourcein, dir_path, result_path, iLoop, debug, applyhole) # load the configfile;
if applyhole == 'yes' and sourcein == 'LAMP': if applyhole == 'yes' and sourcein == 'LAMP':
simulate[iLoop].information['holemask'] = 'yes' simulate[iLoop].information['holemask'] = 'yes'
...@@ -5767,10 +5778,12 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): ...@@ -5767,10 +5778,12 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'):
simulate[iLoop].information['holemask'] = 'no' simulate[iLoop].information['holemask'] = 'no'
### dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/') ### dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
simulate[iLoop].information['dir_path'] = dir_path # simulate[iLoop].information['dir_path'] = dir_path
simulate[iLoop].information['debug'] = debug
# simulate[iLoop].information['debug'] = debug
# simulate[iLoop].information['result_path'] = result_path
simulate[iLoop].simulate(sourcein, iLoop) simulate[iLoop].simulate(sourcein, iLoop)
return 1 return 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment