diff --git a/ObservationSim/Instrument/Chip/__pycache__/Chip.cpython-38.pyc b/ObservationSim/Instrument/Chip/__pycache__/Chip.cpython-38.pyc deleted file mode 100644 index 024f6e55eb27718a99d6153eca7714a75a1289f2..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/__pycache__/Chip.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/__pycache__/ChipUtils.cpython-38.pyc b/ObservationSim/Instrument/Chip/__pycache__/ChipUtils.cpython-38.pyc deleted file mode 100644 index 54ec3424f546352d2327c7ecf9bb57982c696fe4..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/__pycache__/ChipUtils.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/__pycache__/Effects.cpython-38.pyc b/ObservationSim/Instrument/Chip/__pycache__/Effects.cpython-38.pyc deleted file mode 100644 index 661c5b51b54a66f76db46196c1aea5917dbe4314..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/__pycache__/Effects.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/__pycache__/__init__.cpython-38.pyc b/ObservationSim/Instrument/Chip/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 88fdd9681bd870a3648dd5635ee99fb7c01da9d6..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/libBF/__pycache__/__init__.cpython-38.pyc b/ObservationSim/Instrument/Chip/libBF/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index d5b238d75bc180ae1222ae9e01f4f25e5c1dfd2e..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/libBF/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/libCTI/__pycache__/CTI_modeling.cpython-38.pyc b/ObservationSim/Instrument/Chip/libCTI/__pycache__/CTI_modeling.cpython-38.pyc deleted file mode 100644 index 6e94646d36b6bf60de4c8f04a75b5049a6d9c67d..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/libCTI/__pycache__/CTI_modeling.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/libCTI/__pycache__/__init__.cpython-38.pyc b/ObservationSim/Instrument/Chip/libCTI/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 875c6baa7e8da652f4e6bb0ea811ec50c30a3c3f..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/libCTI/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/MockObject/data/led/__pycache__/__init__.cpython-38.pyc b/ObservationSim/MockObject/data/led/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 7ef0a5f3a295a16e765166aed8e9175fb7ff3158..0000000000000000000000000000000000000000 Binary files a/ObservationSim/MockObject/data/led/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/ObservationSim/ObservationSim.py b/ObservationSim/ObservationSim.py index 3d8030de425051b32de3b5d31bc273ecee3a4874..f25551e3e06e5b73786d3bfb893692f742591a49 100755 --- a/ObservationSim/ObservationSim.py +++ b/ObservationSim/ObservationSim.py @@ -119,11 +119,10 @@ class Observation(object): chip_output.Log_info("check running:1: pointing-%d chip-%d pid-%d memory-%6.2fGB"%(pointing.id, chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024) )) del chip.img - def runExposure_MPI_PointingList(self, pointing_list, chips=None, use_mpi=False): - if use_mpi: - comm = MPI.COMM_WORLD - ind_thread = comm.Get_rank() - num_thread = comm.Get_size() + def runExposure_MPI_PointingList(self, pointing_list, chips=None): + comm = MPI.COMM_WORLD + ind_thread = comm.Get_rank() + num_thread = comm.Get_size() process_counter = 0 for ipoint in range(len(pointing_list)): @@ -158,7 +157,7 @@ class Observation(object): run_filts = self.filter_list nchips_per_fp = len(self.chip_list) else: - # Only run a particular set of chips (defined in the overall config file) + # Only run a particular set of chips run_chips = [] run_filts = [] for ichip in range(len(self.chip_list)): @@ -171,9 +170,8 @@ class Observation(object): for ichip in range(nchips_per_fp): i_process = process_counter + ichip - if use_mpi: - if i_process % num_thread != ind_thread: - continue + if i_process % num_thread != ind_thread: + continue pid = os.getpid() chip = run_chips[ichip] diff --git a/config/config_50sqdeg.yaml b/config/config_50sqdeg.yaml index 0ffa694c4f5991a432ea32552a40df8f0a6913b3..f28a4cc01bfdcc891b036a8be3fcde11a86d20cc 100644 --- a/config/config_50sqdeg.yaml +++ b/config/config_50sqdeg.yaml @@ -15,7 +15,6 @@ run_name: "testRun0" # Whether to use MPI run_option: - use_mpi: YES # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/config_C6.yaml b/config/config_C6.yaml index 2c4d679cc00c3dfe59009c4fb0d7d76a340e3d09..5c7ebe6ede17d86d41d3366c3dfdd5627698844d 100644 --- a/config/config_C6.yaml +++ b/config/config_C6.yaml @@ -18,7 +18,6 @@ run_counter: 1 # Whether to use MPI run_option: - use_mpi: NO # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/config_C6_dev.yaml b/config/config_C6_dev.yaml index cb61f06bb69fb3d64cf7230aab508980c1426915..dd619d58f6f4607253e399cccccaa61167147d14 100644 --- a/config/config_C6_dev.yaml +++ b/config/config_C6_dev.yaml @@ -17,7 +17,6 @@ run_counter: 1 # Whether to use MPI run_option: - use_mpi: NO # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/config_C6_fits.yaml b/config/config_C6_fits.yaml index 3da229bf90a05ed28c2bc12371f72a7fe1f1a897..2c91057b4b51c376a6905c11f2daabad6bc92ebc 100644 --- a/config/config_C6_fits.yaml +++ b/config/config_C6_fits.yaml @@ -17,7 +17,6 @@ run_counter: 1 # Whether to use MPI run_option: - use_mpi: YES # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/config_ooc_c6.yaml b/config/config_ooc_c6.yaml index 62b468e09ffe2981c6f2fd0b8986d2393278da93..54d6ef5a0809c08f3a37f949e3e1839aac0e0626 100644 --- a/config/config_ooc_c6.yaml +++ b/config/config_ooc_c6.yaml @@ -17,7 +17,6 @@ run_counter: 1 # Whether to use MPI run_option: - use_mpi: NO # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/config_overall.yaml b/config/config_overall.yaml index ce1fa43706abd7de80c43d27537a20783dcdea7d..3e5a511ae037c426449d72960fc6bb4747c10401 100644 --- a/config/config_overall.yaml +++ b/config/config_overall.yaml @@ -19,8 +19,6 @@ run_counter: 1 # Run options run_option: - use_mpi: NO - # Output catalog only? # If yes, no imaging simulation will be run. Only the catalogs # of corresponding footprints will be generated. diff --git a/config/config_overall_newStar.yaml b/config/config_overall_newStar.yaml index 10cdeee291310bef3acb4cb6f9bcc866808dd934..fde8e0cbd08c5f6b0b4def99e9e628c2cbbdf0b5 100644 --- a/config/config_overall_newStar.yaml +++ b/config/config_overall_newStar.yaml @@ -19,8 +19,6 @@ run_counter: 1 # Run options run_option: - use_mpi: NO - # Output catalog only? # If yes, no imaging simulation will be run. Only the catalogs # of corresponding footprints will be generated. diff --git a/config/config_testCASE.yaml b/config/config_testCASE.yaml index 503d753a15be2031b5beb933fcd5e33c2b1c0af5..f44cf5c972c1d0d53a5772a1b97c94e306917653 100644 --- a/config/config_testCASE.yaml +++ b/config/config_testCASE.yaml @@ -15,7 +15,6 @@ run_name: "C6_fits_testRun" # Whether to use MPI run_option: - use_mpi: YES # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/config/obs_config_Calibration_BIAS.yaml b/config/obs_config_Calibration_BIAS.yaml index 384c74415a331ef168e76ac198783a65af3119c6..25d765f875357edc78dc8db7e845f207690d75c1 100644 --- a/config/obs_config_Calibration_BIAS.yaml +++ b/config/obs_config_Calibration_BIAS.yaml @@ -43,7 +43,11 @@ call_sequence: # Apply PRNU to accumulated photons PRNU_effect: {} # Accumulate photons caused by cosmic rays - cosmic_rays: {} + cosmic_rays: + # [Optional]: exposure time of the pointing will be used as default. + # Set it here is you want to override the default + # exptime: 150. # [s] + save_cosmic_img: NO # # Whether to export cosmic ray image # Add Poission noise and dark current poisson_and_dark: add_dark: YES diff --git a/config/obs_config_Calibration_FLAT.yaml b/config/obs_config_Calibration_FLAT.yaml index e5546276ab5d052263ffedd1745174e627b417e9..17bd5d66958a275f135243825ab74b9152ffda8a 100644 --- a/config/obs_config_Calibration_FLAT.yaml +++ b/config/obs_config_Calibration_FLAT.yaml @@ -43,7 +43,11 @@ call_sequence: # Apply PRNU to accumulated photons PRNU_effect: {} # Accumulate photons caused by cosmic rays - cosmic_rays: {} + cosmic_rays: + # [Optional]: exposure time of the pointing will be used as default. + # Set it here is you want to override the default + # exptime: 150. # [s] + save_cosmic_img: NO # # Whether to export cosmic ray image # Add Poission noise and dark current poisson_and_dark: add_dark: YES diff --git a/install.sh b/install.sh new file mode 100644 index 0000000000000000000000000000000000000000..b753ad99ae39763a9d88dcb2c0029ba5f01194b3 --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +# conda create -n csstsim_py311 python==3.11 +# conda activate csstsim_py311 +conda config --add channels conda-forge +conda install numpy==1.26.4 +conda install cython==3.0.6 +conda install sep==1.2.1 +conda install mpi4py==3.1.6 +python3 setup.py install --user +pip install -e . diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..12b61a25ad92dc287b5f8d10e1a44370689e6895 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +numpy==1.26.4 +astropy==6.0.1 +scipy==1.11.4 +GalSim==2.5.2 +PyYAML==6.0.1 +mpi4py==3.1.6 +sep==1.2.1 +healpy==1.16.6 +h5py==3.11.0 +Cython==3.0.6 +numba==0.59.1 +psutil==5.9.8 +toml==0.10.2 +lmfit==1.2.2 \ No newline at end of file diff --git a/run_sim.py b/run_sim.py index 8e612c4f561bce2516a1594363ffc950082584a2..03d8489cf0a4a188ceca6be278c8a88614f60c11 100755 --- a/run_sim.py +++ b/run_sim.py @@ -1,6 +1,6 @@ from ObservationSim.ObservationSim import Observation from ObservationSim._util import parse_args, make_run_dirs, generate_pointing_list -from pkg_resources import get_distribution +from importlib.metadata import version import os import yaml import shutil @@ -24,7 +24,7 @@ def run_sim(): None """ # Get version of CSSTSim Package - __version__ = get_distribution("CSSTSim").version + __version__ = version("CSSTSim") # Get run datetime now = datetime.datetime.now() @@ -97,9 +97,7 @@ def run_sim(): obs = Observation(config=config, Catalog=None, work_dir=config['work_dir'], data_dir=config['data_dir']) # Run simulation - obs.runExposure_MPI_PointingList( - pointing_list=pointing_list, - use_mpi=config["run_option"]["use_mpi"]) + obs.runExposure_MPI_PointingList(pointing_list=pointing_list) if __name__=='__main__': run_sim() diff --git a/setup.py b/setup.py index b0825629ba78627213b32e459360e37e9dadf84a..12b27729ca025e5679de24217289b7b74685d628 100644 --- a/setup.py +++ b/setup.py @@ -58,23 +58,32 @@ cti_module = [CTypes('ObservationSim.Instrument.Chip.libCTI.libmoduleCTI', # name = "slssim_disperse", # ext_modules = cythonize(extensions), # ) +# 读取依赖列表requirements.txt +# 忽略#开头或者版本号不明确指定的条目 +with open("requirements.txt", "r") as f: + requirements = [ + req.strip() + for req in f.readlines() + if not req.startswith("#") and req.__contains__("==") + ] setup(name='CSSTSim', version='2.1.0', packages=find_packages(), - install_requires=[ - # 'numpy>=1.18.5', - # 'galsim>=2.2.4', - # 'pyyaml>=5.3.1', - # 'astropy>=4.0.1', - # 'scipy>=1.5.0', - # 'mpi4py>=3.0.3', - # 'sep>=1.0.3', - # 'healpy>=1.14.0', - # 'h5py>=2.10.0', - # 'Cython>=0.29.21', - # 'numba>=0.50.1' - ], + # install_requires=[ + # # 'numpy>=1.18.5', + # # 'galsim>=2.2.4', + # # 'pyyaml>=5.3.1', + # # 'astropy>=4.0.1', + # # 'scipy>=1.5.0', + # # 'mpi4py>=3.0.3', + # # 'sep>=1.0.3', + # # 'healpy>=1.14.0', + # # 'h5py>=2.10.0', + # # 'Cython>=0.29.21', + # # 'numba>=0.50.1' + # ], + package_data = { 'ObservationSim.Astrometry.lib': ['libshao.so'], 'ObservationSim.Instrument.Chip.libBF': ['libmoduleBF.so'], @@ -89,11 +98,14 @@ setup(name='CSSTSim', 'ObservationSim.Instrument.data.sls_conf': ['*.conf', '*.fits'], 'ObservationSim.Instrument.data.flatCube': ['*.fits'], 'Catalog.data': ['*.fits','*.so'], - 'ObservationSim.Config.Header':['*.header','*.lst'], + 'ObservationSim.Config.Header':['*.fits','*.lst'], 'ObservationSim.Straylight.data': ['*.dat'], 'ObservationSim.Straylight.data.sky': ['*.dat'], 'ObservationSim.Straylight.lib': ['*'], }, + python_requires=">=3.11", # Python版本要求 + install_requires=requirements, + ext_modules = cythonize(extensions) + df_module + cti_module, cmdclass={'build_ext': build_ext} ) diff --git a/tests/testData/csst_fz_gc0/config_C6.yaml b/tests/testData/csst_fz_gc0/config_C6.yaml index 655d52cccc910be5e6de83edb92ae24dd031ad2b..aa44b023a90b5700a8c6875059c0d0e54f111b4d 100644 --- a/tests/testData/csst_fz_gc0/config_C6.yaml +++ b/tests/testData/csst_fz_gc0/config_C6.yaml @@ -24,7 +24,6 @@ pointing_file: "pointing_radec_246.5_40.dat" # Whether to use MPI run_option: - use_mpi: YES # NOTE: "n_threads" paramters is currently not used in the backend # simulation codes. It should be implemented later in the web frontend # in order to config the number of threads to request from NAOC cluster diff --git a/tests/test_BF_CTE.py b/tests/test_BF_CTE.py index 35ed176de3fdbcad8fc9193a3b526c6200a21429..4b3ef74015b99d9fe4d51a51fa8acc26ca248a92 100644 --- a/tests/test_BF_CTE.py +++ b/tests/test_BF_CTE.py @@ -80,7 +80,7 @@ class detModule_coverage(unittest.TestCase): def __init__(self, methodName='runTest'): super(detModule_coverage, self).__init__(methodName) ##self.dataPath = "/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA" ##os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_gc1') - self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc') + self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.iccd = 1 diff --git a/tests/test_PSFmodule.py b/tests/test_PSFmodule.py index de8bf27555161fc96c6c79c9a2f7e978690d054b..c0399aaf0ea9c1e26483ef442a9c41a218115564 100644 --- a/tests/test_PSFmodule.py +++ b/tests/test_PSFmodule.py @@ -39,7 +39,7 @@ def defineFilt(chip): class PSFInterpModule_coverage(unittest.TestCase): def __init__(self, methodName='runTest'): super(PSFInterpModule_coverage, self).__init__(methodName) - self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc') + self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.iccd = 8 def test_loadPSFSet(self): diff --git a/tests/test_SpecDisperse.py b/tests/test_SpecDisperse.py index 34b388bc2a22c36df5bae79103455240aa9a4c7d..2b9529d86724db8b4d35b5b72845dee52bd98a84 100644 --- a/tests/test_SpecDisperse.py +++ b/tests/test_SpecDisperse.py @@ -145,16 +145,22 @@ class TestSpecDisperse(unittest.TestCase): def __init__(self, methodName='runTest'): super(TestSpecDisperse,self).__init__(methodName) - self.filePath('csst_fz_gc0') + self.filePath('csst_msc_sim/test_sls_and_straylight') # self.conff = conff # self.throughputf = throughputf + def filePath(self, file_name): fn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name) self.conff= os.path.join(fn, 'CSST_GI2.conf') self.throughputf= os.path.join(fn, 'GI.Throughput.1st.fits') self.testDir = fn + self.outDataFn = os.path.join(fn,'output') + if os.path.isdir(self.outDataFn): + pass + else: + os.mkdir(self.outDataFn) def test_rotate901(self): m = np.array([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20],[21,22,23,24,25]]) @@ -231,16 +237,16 @@ class TestSpecDisperse(unittest.TestCase): ids1 = wave_pix[ids] > 6500 print('Spec disperse flux test') self.assertTrue(np.mean((wave_flux[ids][ids1] - sed_i(wave_pix[ids][ids1]))/sed_i(wave_pix[ids][ids1]))<0.004) - plt.figure() - plt.plot(wave_pix, wave_flux) - plt.plot(sed['WAVELENGTH'], sed['FLUX']) - plt.xlim(6200, 10000) - plt.ylim(1, 3) - plt.yscale('log') - plt.xlabel('$\lambda$') - plt.ylabel('$F\lambda$') - plt.legend(['extracted', 'input']) - plt.show() + # plt.figure() + # plt.plot(wave_pix, wave_flux) + # plt.plot(sed['WAVELENGTH'], sed['FLUX']) + # plt.xlim(6200, 10000) + # plt.ylim(1, 3) + # plt.yscale('log') + # plt.xlabel('$\lambda$') + # plt.ylabel('$F\lambda$') + # plt.legend(['extracted', 'input']) + # plt.show() def test_Specdistperse2(self): @@ -303,16 +309,16 @@ class TestSpecDisperse(unittest.TestCase): self.assertTrue(fwhmx/deltLamda_pix*pix_scale - psf_fwhm < np.abs(0.02)) # print('error is ',np.mean((wave_flux[ids][ids1] - sed_i(wave_pix[ids][ids1]))/sed_i(wave_pix[ids][ids1]))) # self.assertTrue(np.mean((wave_flux[ids][ids1] - sed_i(wave_pix[ids][ids1]))/sed_i(wave_pix[ids][ids1]))<0.004) - plt.figure() - plt.plot(wave_pix, wave_flux) - plt.plot(sed['WAVELENGTH'], sed['FLUX']) - plt.xlim(6200, 10000) - plt.ylim(1, 75) - plt.yscale('log') - plt.xlabel('$\lambda$') - plt.ylabel('$F\lambda$') - plt.legend(['extracted', 'input']) - plt.show() + # plt.figure() + # plt.plot(wave_pix, wave_flux) + # plt.plot(sed['WAVELENGTH'], sed['FLUX']) + # plt.xlim(6200, 10000) + # plt.ylim(1, 75) + # plt.yscale('log') + # plt.xlabel('$\lambda$') + # plt.ylabel('$F\lambda$') + # plt.legend(['extracted', 'input']) + # plt.show() def test_Specdistperse3(self): @@ -484,7 +490,7 @@ class TestSpecDisperse(unittest.TestCase): print('Spec double disperse test') from astropy.io import fits - fits.writeto('test.fits',chip.img.array, overwrite = True) + fits.writeto(os.path.join(self.outDataFn,'test_sls_doubleDisp.fits'),chip.img.array, overwrite = True) # plt.figure() # plt.imshow(chip.img.array) diff --git a/tests/test_Straylight.py b/tests/test_Straylight.py index c79dc6f7980791dc80bee79eed12bf1038cdb3fe..ea6de764327c3968c8d11fb3998019d85b99ab62 100644 --- a/tests/test_Straylight.py +++ b/tests/test_Straylight.py @@ -74,7 +74,7 @@ class TestStraylight(unittest.TestCase): # print(file_name) # fn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name) # self.pointingData = np.loadtxt(os.path.join(fn, 'Straylight_test.dat'), dtype=np.double) - self.filePath('csst_fz_gc0') + self.filePath('csst_msc_sim/test_sls_and_straylight') self.filter = filter self.grating = grating diff --git a/tests/test_darknoise_func.py b/tests/test_darknoise_func.py index 680ce7b1879ac55f3b01a841d22dc99dfbd371ae..92a1e5d36eed4d7639b3c3b362d90e0ad7afaca4 100644 --- a/tests/test_darknoise_func.py +++ b/tests/test_darknoise_func.py @@ -60,7 +60,7 @@ def defineFilt(chip): class detModule_coverage(unittest.TestCase): def __init__(self, methodName='runTest'): super(detModule_coverage, self).__init__(methodName) - self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc') + self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.iccd = 1 def test_add_dark(self): diff --git a/tests/det_effect_unit_test.py b/tests/test_effect_unit.py similarity index 93% rename from tests/det_effect_unit_test.py rename to tests/test_effect_unit.py index 51b620a0e32c4705fa7197e96c7040f8020c3260..d77c9b0bd84e8b0faeebb90270e953be9005ecf2 100644 --- a/tests/det_effect_unit_test.py +++ b/tests/test_effect_unit.py @@ -17,7 +17,7 @@ class DetTest(unittest.TestCase): def __init__(self, methodName='runTest'): super(DetTest,self).__init__(methodName) - self.filePath('csst_fz_gc0') + self.filePath('csst_msc_sim/test_sls_and_straylight') def filePath(self, file_name): self.datafn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name) @@ -138,15 +138,15 @@ class DetTest(unittest.TestCase): newimg.write(os.path.join(self.outDataFn,'test_badlines.fits')) del newimg,img - def test_cte(self): - img = galsim.Image(200,200,init_value=1000) - img.array[50,80] = 1e4 - img.array[150,150] = 3e4 - newimgcol = Effects.CTE_Effect(copy.deepcopy(img),direction='column') - newimgrow = Effects.CTE_Effect(copy.deepcopy(img),direction='row') - newimgcol.write(os.path.join(self.outDataFn,'test_ctecol.fits')) - newimgrow.write(os.path.join(self.outDataFn,'test_cterow.fits')) - del img,newimgcol,newimgrow + # def test_cte(self): + # img = galsim.Image(200,200,init_value=1000) + # img.array[50,80] = 1e4 + # img.array[150,150] = 3e4 + # newimgcol = Effects.CTE_Effect(copy.deepcopy(img),direction='column') + # newimgrow = Effects.CTE_Effect(copy.deepcopy(img),direction='row') + # newimgcol.write(os.path.join(self.outDataFn,'test_ctecol.fits')) + # newimgrow.write(os.path.join(self.outDataFn,'test_cterow.fits')) + # del img,newimgcol,newimgrow def test_readnoise(self): img = galsim.Image(200,200,init_value=1000) diff --git a/tests/test_imaging.py b/tests/test_imaging.py index 4e41563c6b641eda38960a8e2a38e8003f4c3801..7d1e5226c3b07b9d6534a45e349bf3df473d48d4 100644 --- a/tests/test_imaging.py +++ b/tests/test_imaging.py @@ -97,8 +97,8 @@ def _load_gals(file_path): param['av'] = 0.0 param['redden'] = 0 - pcs = h5.File("/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/"+"pcs.h5", "r") - lamb = h5.File("/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/"+"lamb.h5", "r") + pcs = h5.File(os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc/sedlibs/pcs.h5'), "r") + lamb = h5.File(os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc/sedlibs/lamb.h5'), "r") lamb_gal = lamb['lamb'][()] pcs = pcs['pcs'][()] @@ -158,7 +158,7 @@ def defineFilt(chip): class imagingModule_coverage(unittest.TestCase): def __init__(self, methodName='runTest'): super(imagingModule_coverage, self).__init__(methodName) - self.dataPath = "/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA" ##os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_gc1') + self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.iccd = 8 def test_imaging(self): @@ -170,7 +170,7 @@ class imagingModule_coverage(unittest.TestCase): print(chip.cen_pix_x, chip.cen_pix_y) - obj = _load_gals("UNIT_TEST_DATA/galaxies_C6_bundle000287.h5") + obj = _load_gals(os.path.join(self.dataPath, 'galaxies_C6_bundle000287.h5')) #("UNIT_TEST_DATA/galaxies_C6_bundle000287.h5") sed_data = obj['sed'] norm_filt = None diff --git a/tests/test_prescan_overscan_func.py b/tests/test_prescan_overscan_func.py index f3b17576c4a51573107939877a46e931476adad3..1a6a1303edc31c8b8482037f1d17248cfc7af11e 100644 --- a/tests/test_prescan_overscan_func.py +++ b/tests/test_prescan_overscan_func.py @@ -81,7 +81,7 @@ def defineFilt(chip): class detModule_coverage(unittest.TestCase): def __init__(self, methodName='runTest'): super(detModule_coverage, self).__init__(methodName) - self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc') + self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.iccd = 1 def test_add_prescan_overscan(self):