Commit 40d93d8b authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent f51a7714
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+182 −0
Original line number Diff line number Diff line
"""
Identifier:     ifs_sim/tests/test_ifs_sim.py
Name:           test_ifs_sim.py
Description:    Test ifs sim.
Author:         Zhaojun Yan
Created:        2024-04-09
Modified-History:
    2024-04-09, Zhaojun Yan, created

"""

import unittest
import os
from csst_ifs_sim import csst_ifs_sim
import subprocess
import sys

class TestDemoFunction(unittest.TestCase):
    def test_ifs_sim_1(self):
        """
        Aim
        ---
        Test ifs sim function: SCI case.

        Criteria
        --------
        Pass if the demo function returns `1`.

        Details
        -------
        The demo function returns the length of the input argument list.
        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/')
        print(dir_path)
        print(sys.version )
        ###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
        
        configfile = './ifs_data/IFS_sim_C90.config'
      
        sourcein = 'SCI'
        print(configfile)
                
        csst_ifs_sim.runIFSsim(sourcein,  configfile, dir_path, 1, 'no')
        self.assertEqual(
            1 , 1,
            "case 1: SCI sim passes.",
        )
        
        
    # def test_ifs_sim_2(self):
    #     """
    #     Aim
    #     ---
    #     Test ifs sim function: BIAS case.

    #     Criteria
    #     --------
    #     Pass if the demo function returns `1`.

    #     Details
    #     -------
    #     The demo function returns the length of the input argument list.
    #     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')
        
    #     csst_ifs_sim(dir_path,BIAS)
        
    #     self.assertTrue(
    #         1 == 1,
    #         "case 2 :BIAS sim passes.",
    #     )
        
    # def test_ifs_sim_3(self):
    #     """
    #     Aim
    #     ---
    #     Test ifs sim function: DARK case.

    #     Criteria
    #     --------
    #     Pass if the demo function returns `1`.

    #     Details
    #     -------
    #     The demo function returns the length of the input argument list.
    #     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')
        
    #     csst_ifs_sim(dir_path,'DARK')
        
    #     self.assertTrue(
    #         1 == 1,
    #         "case 3 :DARK sim passes.",
    #     )
        
        
        
    # def test_ifs_sim_4(self):
    #     """
    #     Aim
    #     ---
    #     Test ifs sim function: LAMP case.

    #     Criteria
    #     --------
    #     Pass if the demo function returns `1`.

    #     Details
    #     -------
    #     The demo function returns the length of the input argument list.
    #     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')
        
    #     csst_ifs_sim(dir_path,'LAMP')
        
    #     self.assertTrue(
    #         1 == 1,
    #         "case 4 :LAMP sim passes.",
    #     )
        
        
        
    # def test_ifs_sim_5(self):
    #     """
    #     Aim
    #     ---
    #     Test ifs sim function: FLAT case.

    #     Criteria
    #     --------
    #     Pass if the demo function returns `1`.

    #     Details
    #     -------
    #     The demo function returns the length of the input argument list.
    #     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')
        
    #     csst_ifs_sim(dir_path,'FLAT')
        
    #     self.assertTrue(
    #         1 == 1,
    #         "case 5 :FLAT sim passes.",
    #     )
        
        
    # def test_ifs_sim_6(self):
    #     """
    #     Aim
    #     ---
    #     Test ifs sim function: hole case.
    
    #     Criteria
    #     --------
    #     Pass if the demo function returns `1`.
    
    #     Details
    #     -------
    #     The demo function returns the length of the input argument list.
    #     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')
        
    #     csst_ifs_sim(dir_path,'LAMP', 'yes')
        
    #     self.assertTrue(
    #         1 == 1,
    #         "case 6 :Hole sim passes.",
    #     )
        
      
 No newline at end of file

requirements.txt

0 → 100644
+8 −0
Original line number Diff line number Diff line
numpy~=1.23.3
scipy~=1.9.2
setuptools~=65.5.1
pandas~=1.2.3
julian~=0.14
astropy~=5.1
tqdm~=4.59.0
galsim~=2.4.5
+48 −36
Original line number Diff line number Diff line
import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()
# 读取README.md作为长描述
with open("README.md", "r") as f:
    long_description = f.read()

# 读取依赖列表requirements.txt
# 忽略#开头或者版本号不明确指定的条目
with open("requirements.txt", "r") as f:
    requirements = [
        req.strip()
        for req in f.readlines()
        if not req.startswith("#") and req.__contains__("~=") 
    ]

setuptools.setup(
    name='csst_mci_sim',
    version='1.0.1',
    # Internal_Version = '0.7.02',
    version='1.0.0',
    author='CSST Team',
    author_email='zhaojunyan@shao.ac.cn',
    description='The CSST - mci - sim',  # short description
@@ -13,7 +24,7 @@ setuptools.setup(
    long_description_content_type="text/markdown",
    url='https://csst-tb.bao.ac.cn/',
    # project_urls={
    #     'Source': 'https://csst-tb.bao.ac.cn/code/csst-l1/ifs/csst_mci_sim',
    #     'Source': 'https://csst-tb.bao.ac.cn/code/csst-l1/ifs/csst_ifs_sim',
    # },
    packages=setuptools.find_packages(),
    license='MIT',
@@ -24,13 +35,14 @@ setuptools.setup(
                 "Programming Language :: Python :: 3.8",
                 "Topic :: Scientific/Engineering :: Physics",
                 "Topic :: Scientific/Engineering :: Astronomy"],
    package_dir={'csst_mci_sim': 'csst_mci_sim'},
    package_dir={'csst_ifs_sim': 'csst_ifs_sim'},
    # include_package_data=True,
    package_data={"": ["LICENSE", "README.md"],
                  "csst_mci_sim": ["mci_so/*", "mci_data/*"]},
                  "csst_mci_sim": ["mci_so/*", "mci_data/*","CTI/*", "support/*","mci_data/refs/*", "mci_data/refs/orbit20160925/*"]},
    # install_requires=['sphinx',
    #                   'numpy',
    #                   'scipy', 'matplotlib',
    #                   'astropy', 'healpy', 'ccdproc', 'deepCR', 'photutils'],
    python_requires='>=3.8',
    python_requires='>=3.11',
    install_requires=requirements,
)