-
Notifications
You must be signed in to change notification settings - Fork 59
/
__init__.py
131 lines (106 loc) · 4 KB
/
__init__.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
WebbPSF: Simulated Point Spread Functions for the James Webb Space Telescope
----------------------------------------------------------------------------
WebbPSF produces simulated PSFs for the James Webb Space Telescope, NASA's next
flagship infrared space telescope. WebbPSF can simulate images for any of the
four science instruments plus the fine guidance sensor, including both direct
imaging and coronagraphic modes.
Developed by Marshall Perrin and collaborators at STScI, 2010-2018.
Documentation can be found online at https://webbpsf.readthedocs.io/
"""
import sys
from astropy import config as _config
try:
from .version import __version__
except ImportError:
__version__ = ""
__minimum_python_version__ = "3.10"
class UnsupportedPythonError(Exception):
pass
if sys.version_info < tuple(
(int(val) for val in __minimum_python_version__.split("."))
):
raise UnsupportedPythonError(
"webbpsf does not support Python < {}".format(__minimum_python_version__)
)
# This tuple gives the *minimum* version of the WebbPSF data package
# required. If changes to the code and data mean WebbPSF won't work
# properly with an old data package, increment this version number.
# (It's checked against $WEBBPSF_DATA/version.txt)
DATA_VERSION_MIN = (1, 3, 0)
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `webbpsf`.
"""
default_oversampling = _config.ConfigItem(
4,
"Default "
+ "oversampling factor: number of times more finely sampled than "
+ "an integer pixel for the grid spacing in the PSF calculation.",
)
default_output_mode = _config.ConfigItem(
"both",
"Should output include the oversampled PSF, a copy rebinned onto the integer detector spacing, or both?\
Options: 'oversampled','detector','both' ",
)
default_fov_arcsec = _config.ConfigItem(
5.0, "Default field of view size, in arcseconds per side of the square "
)
# Should be package settings:
WEBBPSF_PATH = _config.ConfigItem(
"from_environment_variable",
"Directory path to data files required for WebbPSF calculations, such as OPDs and filter transmissions.\
This will be overridden by the environment variable $WEBBPSF_PATH, if present.",
)
autoconfigure_logging = _config.ConfigItem(
False,
"Should WebbPSF configure logging for itself and POPPY? This adds handlers that report "
"calculation progress and information",
)
logging_level = _config.ConfigItem(
["INFO", "DEBUG", "WARN", "ERROR", "CRITICAL", "NONE"],
# (the default value is the first item in the options list)
"Desired logging level for WebbPSF optical calculations.",
)
logging_filename = _config.ConfigItem(
"none", "Desired filename to save log messages to."
)
logging_format_screen = _config.ConfigItem(
"[%(name)7s] %(message)s", "Format for lines logged to the screen."
)
logging_format_file = _config.ConfigItem(
"%(asctime)s [%(name)s:%(levelname)s] %(filename)s:%(lineno)d: %(message)s",
"Format for lines logged to a file.",
)
conf = Conf()
from . import utils # noqa - must go after config
from . import trending # noqa - must go after config
from .utils import setup_logging, restart_logging, system_diagnostic, measure_strehl # noqa - must go after config
from poppy import ( # noqa
display_psf,
display_psf_difference,
display_ee,
measure_ee,
display_profiles,
radial_profile,
measure_radial,
measure_fwhm,
measure_sharpness,
measure_centroid,
specFromSpectralType,
fwcentroid,
)
from .webbpsf_core import ( # noqa
instrument,
SpaceTelescopeInstrument,
JWInstrument,
NIRCam,
NIRISS,
NIRSpec,
MIRI,
FGS,
)
from .opds import enable_adjustable_ote # noqa
from .roman import WFI, RomanCoronagraph # noqa
from .match_data import setup_sim_to_match_file # noqa