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
import astropy.coordinates as coord
import ctypes
import sys
sys.path.append('./csst_ifs_sim')
##sys.path.append('./csst_ifs_sim')
conf.auto_max_age = None
"""
......@@ -230,10 +232,13 @@ class CDM03bidir():
self.log.info('quadrant=%i' % iquadrant)
self.log.info('iflip=%i' % iflip)
self.log.info('jflip=%i' % jflip)
################
############################################
#################################################################################
###modify
#sys.path.append('../so')
from .ifs_so import cdm03bidir
try:
from ifs_so import cdm03bidir
except:
......@@ -1936,7 +1941,7 @@ class IFSsimulator():
###############################################################################
###############################################################################
def configure(self, simnumber):
def configure(self, sourcein, dir_path, result_path, simnumber, debug, applyhole):
"""
......@@ -1961,16 +1966,25 @@ class IFSsimulator():
self._createEmpty()
self.information['dir_path']=dir_path
self.information['result_path']=result_path
self.information['debug'] = debug
self.source=sourcein
self.simnumber=simnumber
############################################################
now = datetime.utcnow()
result_day = now.strftime("%Y-%m-%d")
# self.information['holemask']
if self.source == 'LAMP':
if self.information['holemask'] == 'yes':
if applyhole == 'yes':
ss = '_with_hole_'
else:
ss = '_no_hole_'
......@@ -1978,18 +1992,23 @@ class IFSsimulator():
else:
ss = '_'
if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/':
self.result_path = self.information['dir_path'] + \
self.information['result_path']+'/'+self.source+ss+result_day
else:
# if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/':
# self.result_path = self.information['dir_path'] + \
# self.information['result_path']+'/'+self.source+ss+result_day
# 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
else:
self.result_path = '/data/ifspip/CCD_ima/'+self.source+ss+result_day
# self.result_path = '../IFS_simData/'+self.source+ss+result_day
# else:
# 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:
os.mkdir(self.result_path)
......@@ -5172,20 +5191,8 @@ class IFSsimulator():
nphoton = flux2photons(flux_1[ilam], lam)
# photons/cm2/s/A/arcsec2
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
# #####################3 transfer: photons/cm2/s/A/arcsec2 to photons
......@@ -5466,7 +5473,8 @@ class IFSsimulator():
self.source = sourcein
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']
......@@ -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):
"""
......@@ -5761,15 +5769,20 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'):
simulate = dict()
simulate[iLoop] = IFSsimulator(configfile)
simulate[iLoop].configure(sourcein, dir_path, result_path, iLoop, debug, applyhole) # load the configfile;
if applyhole == 'yes' and sourcein == 'LAMP':
simulate[iLoop].information['holemask'] = 'yes'
else:
simulate[iLoop].information['holemask'] = 'no'
### 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)
......
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