Commit 95f81f91 authored by GZhao's avatar GZhao
Browse files

v2.0beta update

parent b7f8c4fa
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@ dist/
starmodel/
cpism_refdata/
*.egg-info
example/example_output

refdata/starmodel
refdata/target_model

# Other files and folders
.settings/
@@ -26,6 +30,7 @@ docs/notebooks/image_files/_*
# unitest output
tests/.coverage
tests/htmlcov/
tests/*.xml

# Executables
*.swf

.gitignore copy

0 → 100644
+40 −0
Original line number Diff line number Diff line
# Build and Release Folders
bin-debug/
bin-release/
[Oo]bj/
[Bb]in/
build/
dist/
starmodel/
cpism_refdata/
*.egg-info

# Other files and folders
.settings/
_*/

~*
.VSCodeCounter
.vscode
*.log
output/
*.log.*
/*.fits
testrun/
example/example_output/

docs/notebooks/image_files/_*

# unitest output
tests/.coverage
tests/htmlcov/

# Executables
*.swf
*.air
*.ipa
*.apk

# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.

CpicImgSim/__init__.py

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
# from .main import quick_run, observation_simulation
from .optics import make_focus_image, focal_mask
from .target import star_photlam, planet_contrast, extract_target_x_y, spectrum_generator
from .camera import EMCCD, CosmicRayFrameMaker, sky_frame_maker
from .config import __version__

__all__ = [
    "EMCCD",
    "CosmicRayFrameMaker",
    "sky_frame_maker",
    "star_photlam",
    "planet_contrast",
    "extract_target_x_y",
    "spectrum_generator",
    "make_focus_image",
    "focal_mask",
    # "quick_run",
    # "observation_simulation"
]
 No newline at end of file

CpicImgSim/camera.py

deleted100644 → 0
+0 −1037

File deleted.

Preview size limit exceeded, changes collapsed.

CpicImgSim/config.py

deleted100644 → 0
+0 −63
Original line number Diff line number Diff line
import os, yaml
import warnings

cpism_refdata = os.environ.get('cpism_refdata', './cpism_refdata')

if not os.path.exists(cpism_refdata):  # pragma: no cover
    raise Exception(
        "Can not find CPISM reference data.")


if not os.path.exists(os.environ.get('PYSYN_CDBS', './trd')):  # pragma: no cover
    raise Exception(
        "Can not find PYSYN Stellar reference data.")

# we need to ignore the warning from pysynphot, because we only use the star models.
with warnings.catch_warnings():  # pragma: no cover
    warnings.filterwarnings("ignore")
    import pysynphot as S

solar_spectrum = S.FileSpectrum(
    f"{os.environ['PYSYN_CDBS']}/grid/solsys/solar_spec.fits")
solar_spectrum.convert('photlam')

config_file = cpism_refdata + '/optics/optics_config.yaml'
if not os.path.exists(config_file):  # pragma: no cover
    raise FileNotFoundError(f"光学配置文件不存在({config_file})")
with open(config_file, 'r') as f:
    optics_config = yaml.load(f, Loader=yaml.FullLoader)

MAG_SYSTEM = 'abmag'

__version__ = '2.0.0'

def which_focalplane(band):
    """
    Return the name of the focalplane which the band belongs to.

    Parameters
    -----------
    band: str
        The name of the band.
        from ['f565', 'f661', 'f743', 'f883', 'f940', 'f1265', 'f1425', 'f1542', 'wfs']

    Returns
    --------
    str
        The name of the focalplane.
        'vis' or 'nir' or 'wfs'

    Raises
    -------
    ValueError
        If the band is not in ['f565', 'f661', 'f743', 'f883', 'f940', 'f1265', 'f1425', 'f1542', 'wfs']
    """
    band = band.lower()
    if band in ['f565', 'f661', 'f743', 'f883']:
        return 'vis'
    if band in ['f940', 'f1265', 'f1425', 'f1542']:
        return 'nir'
    if band in ['wfs']:
        return 'wfs'

    raise ValueError(f"未知的波段{band}")
 No newline at end of file
Loading