Commit 5070c190 authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent 8165a134
Pipeline #7134 failed with stage
in 0 seconds
......@@ -15,7 +15,7 @@ parameters in parallel and serial direction.
import numpy as np
#CDM03bidir
# CDM03bidir
class CDM03bidir():
"""
Class to run CDM03 CTI model, class Fortran routine to perform the actual CDM03 calculations.
......@@ -27,6 +27,7 @@ class CDM03bidir():
:param log: instance to Python logging
:type log: logging instance
"""
def __init__(self, settings, data, log=None):
"""
Class constructor.
......@@ -39,7 +40,8 @@ class CDM03bidir():
:type log: logging instance
"""
self.data = data
self.values = dict(quads=(0,1,2,3), xsize=2048, ysize=2066, dob=0.0, rdose=8.0e9)
self.values = dict(quads=(0, 1, 2, 3), xsize=2048,
ysize=2066, dob=0.0, rdose=8.0e9)
self.values.update(settings)
self.log = log
self._setupLogger()
......@@ -51,40 +53,41 @@ class CDM03bidir():
self.params = dict(beta_p=0.6, beta_s=0.6, fwc=100000., vth=1.168e7, vg=6.e-11, t=1.0e-3,
sfwc=700000., svg=1.0e-10, st=1.0e-6, parallel=1., serial=0.)
#update with inputs
# update with inputs
self.params.update(self.values)
#read in trap information
trapdata = np.loadtxt(self.values['dir_path']+self.values['paralleltrapfile'])
# read in trap information
trapdata = np.loadtxt(
self.values['dir_path']+self.values['paralleltrapfile'])
if trapdata.ndim > 1:
self.nt_p = trapdata[:, 0]
self.sigma_p = trapdata[:, 1]
self.taur_p = trapdata[:, 2]
else:
#only one trap species
# only one trap species
self.nt_p = [trapdata[0],]
self.sigma_p = [trapdata[1],]
self.taur_p = [trapdata[2],]
trapdata = np.loadtxt(self.values['dir_path']+self.values['serialtrapfile'])
trapdata = np.loadtxt(
self.values['dir_path']+self.values['serialtrapfile'])
if trapdata.ndim > 1:
self.nt_s = trapdata[:, 0]
self.sigma_s = trapdata[:, 1]
self.taur_s = trapdata[:, 2]
else:
#only one trap species
# only one trap species
self.nt_s = [trapdata[0],]
self.sigma_s = [trapdata[1],]
self.taur_s = [trapdata[2],]
#scale thibaut's values
# scale thibaut's values
if 'thibaut' in self.values['parallelTrapfile']:
self.nt_p /= 0.576 #thibaut's values traps / pixel
self.sigma_p *= 1.e4 #thibaut's values in m**2
self.nt_p /= 0.576 # thibaut's values traps / pixel
self.sigma_p *= 1.e4 # thibaut's values in m**2
if 'thibaut' in self.values['serialTrapfile']:
self.nt_s *= 0.576 #thibaut's values traps / pixel #should be division?
self.sigma_s *= 1.e4 #thibaut's values in m**2
self.nt_s *= 0.576 # thibaut's values traps / pixel #should be division?
self.sigma_s *= 1.e4 # thibaut's values in m**2
def _setupLogger(self):
"""
......@@ -94,7 +97,6 @@ class CDM03bidir():
# if self.log is None:
# self.logger = False
def applyRadiationDamage(self, data, iquadrant=0):
"""
Apply radian damage based on FORTRAN CDM03 model. The method assumes that
......@@ -133,7 +135,7 @@ class CDM03bidir():
:return: image that has been run through the CDM03 model
:rtype: ndarray
"""""
#return data
# return data
iflip = iquadrant / 2
jflip = iquadrant % 2
......@@ -158,8 +160,8 @@ class CDM03bidir():
self.log.info('jflip=%i' % jflip)
#################################################################################
###modify
#sys.path.append('../so')
# modify
# sys.path.append('../so')
from ifs_so import cdm03bidir
# from ifs_so.cdm03.cpython-38-x86_64-linux-gnu import cdm03bidir
# import cdm03bidir
......@@ -171,14 +173,9 @@ class CDM03bidir():
params,
[data.shape[0], data.shape[1], len(self.nt_p), len(self.nt_s), len(self.params)])
return np.asanyarray(CTIed)
#################################################################################################################
#################################################################################################################
This diff is collapsed.
......@@ -15,7 +15,7 @@ from csst_ifs_sim import csst_ifs_sim
import sys
### sys.path.append('IFS_git/csst_ifs_sim/csst_ifs_sim')
# sys.path.append('IFS_git/csst_ifs_sim/csst_ifs_sim')
class TestDemoFunction(unittest.TestCase):
......@@ -35,9 +35,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -45,14 +45,15 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'SCI'
print(configfile)
debug=True
debug = True
result_path=dir_path+'ifs_sim_result'
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'no')
self.assertEqual(
1 , 1,
1, 1,
"case 1: SCI sim passes.",
)
......@@ -73,9 +74,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -83,13 +84,14 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'BIAS'
print(configfile)
debug=True
result_path=dir_path+'ifs_sim_result'
debug = True
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'no')
self.assertEqual(
1 , 1,
1, 1,
"case 2: sim passes.",
)
......@@ -110,9 +112,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -120,13 +122,14 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'DARK'
print(configfile)
debug=True
result_path=dir_path+'ifs_sim_result'
debug = True
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'no')
self.assertEqual(
1 , 1,
1, 1,
"case 3: sim passes.",
)
......@@ -147,9 +150,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -157,14 +160,15 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'LAMP'
print(configfile)
debug=True
debug = True
result_path=dir_path+'ifs_sim_result'
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'no')
self.assertEqual(
1 , 1,
1, 1,
"case 4: sim passes.",
)
......@@ -185,9 +189,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -195,12 +199,13 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'LAMP'
print(configfile)
debug=True
result_path=dir_path+'ifs_sim_result'
debug = True
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'yes')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'yes')
self.assertEqual(
1 , 1,
1, 1,
"case 5: sim passes.",
)
......@@ -221,9 +226,9 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
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/')
print(dir_path)
print(sys.version )
print(sys.version)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile = './csst_ifs_sim/ifs_data/IFS_sim_C90.config'
......@@ -231,14 +236,13 @@ class TestDemoFunction(unittest.TestCase):
sourcein = 'FLAT'
print(configfile)
debug=True
debug = True
result_path=dir_path+'ifs_sim_result'
result_path = dir_path+'ifs_sim_result'
csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug, 'no')
csst_ifs_sim.runIFSsim(sourcein, configfile,
dir_path, result_path, 1, debug, 'no')
self.assertEqual(
1 , 1,
1, 1,
"case 6: sim passes.",
)
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