astro-otter 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of astro-otter might be problematic. Click here for more details.
- astro_otter-0.0.1.dist-info/LICENSE +21 -0
- astro_otter-0.0.1.dist-info/METADATA +866 -0
- astro_otter-0.0.1.dist-info/RECORD +15 -0
- astro_otter-0.0.1.dist-info/WHEEL +5 -0
- astro_otter-0.0.1.dist-info/top_level.txt +1 -0
- otter/__init__.py +12 -0
- otter/_version.py +5 -0
- otter/exceptions.py +26 -0
- otter/io/__init__.py +0 -0
- otter/io/otter.py +474 -0
- otter/io/transient.py +883 -0
- otter/plotter/__init__.py +0 -0
- otter/plotter/otter_plotter.py +67 -0
- otter/plotter/plotter.py +95 -0
- otter/util.py +510 -0
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OtterPlotter Class which handles the backend of the plotting.
|
|
3
|
+
|
|
4
|
+
Currently supported backends are:
|
|
5
|
+
- matplotlib
|
|
6
|
+
- plotly
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import importlib
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class OtterPlotter:
|
|
13
|
+
def __init__(self, backend):
|
|
14
|
+
"""
|
|
15
|
+
Handles the backend for the "plotter" module
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
backend [string]: a string of the module name to import and use
|
|
19
|
+
as the backend. Currently supported are "matplotlib",
|
|
20
|
+
"matplotlib.pyplot", "plotly", and "plotly.graph_objects"
|
|
21
|
+
"""
|
|
22
|
+
if backend == "matplotlib.pyplot":
|
|
23
|
+
self.backend = backend
|
|
24
|
+
elif backend == "pyplot.graph_objects":
|
|
25
|
+
self.backend = backend
|
|
26
|
+
elif "plotly" in backend and "graph_objects" not in backend:
|
|
27
|
+
self.backend = "plotly.graph_objects"
|
|
28
|
+
elif "matplotlib" in backend and "pyplot" not in backend:
|
|
29
|
+
self.backend = "matplotlib.pyplot"
|
|
30
|
+
else:
|
|
31
|
+
raise ValueError("Not a valid backend string!")
|
|
32
|
+
|
|
33
|
+
self.plotter = importlib.import_module(self.backend)
|
|
34
|
+
|
|
35
|
+
if self.backend == "matplotlib.pyplot":
|
|
36
|
+
self.plot = self._plot_matplotlib
|
|
37
|
+
elif self.backend == "plotly.graph_objects":
|
|
38
|
+
self.plot = self._plot_plotly
|
|
39
|
+
else:
|
|
40
|
+
raise ValueError("Unknown backend!")
|
|
41
|
+
|
|
42
|
+
def _plot_matplotlib(self, x, y, xerr=None, yerr=None, ax=None, **kwargs):
|
|
43
|
+
"""
|
|
44
|
+
General plots using matplotlib, is called by _matplotlib_light_curve and
|
|
45
|
+
_matplotlib_sed
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
if ax is None:
|
|
49
|
+
_, ax = self.plotter.subplots()
|
|
50
|
+
|
|
51
|
+
ax.errorbar(x, y, xerr=xerr, yerr=yerr, **kwargs)
|
|
52
|
+
return ax
|
|
53
|
+
|
|
54
|
+
def _plot_plotly(self, x, y, xerr=None, yerr=None, go=None, *args, **kwargs):
|
|
55
|
+
"""
|
|
56
|
+
General plotting method using plotly, is called by _plotly_light_curve and
|
|
57
|
+
_plotly_sed
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
if go is None:
|
|
61
|
+
go = self.plotter.Figure()
|
|
62
|
+
|
|
63
|
+
fig = go.add_scatter(
|
|
64
|
+
x=x, y=y, error_x=dict(array=xerr), error_y=dict(array=yerr)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
return fig
|
otter/plotter/plotter.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Some utilities to create common plots for transients that use the OtterPlotter
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .otter_plotter import OtterPlotter
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_light_curve(
|
|
9
|
+
date: float,
|
|
10
|
+
flux: float,
|
|
11
|
+
date_err: float = None,
|
|
12
|
+
flux_err: float = None,
|
|
13
|
+
fig=None,
|
|
14
|
+
ax=None,
|
|
15
|
+
backend: str = "matplotlib",
|
|
16
|
+
xlabel: str = "Date",
|
|
17
|
+
ylabel: str = "Flux",
|
|
18
|
+
**kwargs,
|
|
19
|
+
):
|
|
20
|
+
"""
|
|
21
|
+
Plot the light curve for the input data
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
date [float]: MJD dates
|
|
25
|
+
flux [float]: Flux
|
|
26
|
+
date_err [float]: optional error on the MJD dates
|
|
27
|
+
flux_err [float]: optional error on the flux
|
|
28
|
+
fig [float]: matplotlib fig object, optional. Will be created if not provided.
|
|
29
|
+
ax [float]: matplitlib axis object, optional. Will be created if not provided.
|
|
30
|
+
backend [str]: backend for plotting. options: "matplotlib" (default) or "plotly"
|
|
31
|
+
xlabel [str]: x-axis label
|
|
32
|
+
ylabel [str]: y-axis label
|
|
33
|
+
**kwargs: keyword arguments to pass to either plotly.graph_objects.add_scatter
|
|
34
|
+
or matplotlib.pyplot.errorbar
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Either a matplotlib axis or plotly figure
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
plt = OtterPlotter(backend)
|
|
41
|
+
fig = plt.plot(date, flux, date_err, flux_err, ax=ax, **kwargs)
|
|
42
|
+
|
|
43
|
+
if backend == "matplotlib":
|
|
44
|
+
fig.set_ylabel(ylabel)
|
|
45
|
+
fig.set_xlabel(xlabel)
|
|
46
|
+
|
|
47
|
+
elif backend == "plotly":
|
|
48
|
+
fig.update_layout(xaxis_title=xlabel, yaxis_title=ylabel, **kwargs)
|
|
49
|
+
|
|
50
|
+
return fig
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def plot_sed(
|
|
54
|
+
wave_or_freq: float,
|
|
55
|
+
flux: float,
|
|
56
|
+
wave_or_freq_err: float = None,
|
|
57
|
+
flux_err: float = None,
|
|
58
|
+
fig=None,
|
|
59
|
+
ax=None,
|
|
60
|
+
backend: str = "matplotlib",
|
|
61
|
+
xlabel: str = "Frequency or Wavelength",
|
|
62
|
+
ylabel: str = "Flux",
|
|
63
|
+
**kwargs,
|
|
64
|
+
):
|
|
65
|
+
"""
|
|
66
|
+
Plot the SED for the input data
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
wave_or_freq [float]: wave or frequency array
|
|
70
|
+
flux [float]: Flux
|
|
71
|
+
wave_or_freq_err [float]: optional error on the MJD dates
|
|
72
|
+
flux_err [float]: optional error on the flux
|
|
73
|
+
fig [float]: matplotlib fig object, optional. Will be created if not provided.
|
|
74
|
+
ax [float]: matplitlib axis object, optional. Will be created if not provided.
|
|
75
|
+
backend [str]: backend for plotting. Options: "matplotlib" (default) or "plotly"
|
|
76
|
+
xlabel [str]: x-axis label
|
|
77
|
+
ylabel [str]: y-axis label
|
|
78
|
+
**kwargs: keyword arguments to pass to either plotly.graph_objects.add_scatter
|
|
79
|
+
or matplotlib.pyplot.errorbar
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Either a matplotlib axis or plotly figure
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
plt = OtterPlotter(backend)
|
|
86
|
+
fig = plt.plot(wave_or_freq, flux, wave_or_freq_err, flux_err, ax=ax, **kwargs)
|
|
87
|
+
|
|
88
|
+
if backend == "matplotlib":
|
|
89
|
+
fig.set_ylabel(ylabel)
|
|
90
|
+
fig.set_xlabel(xlabel)
|
|
91
|
+
|
|
92
|
+
elif backend == "plotly":
|
|
93
|
+
fig.update_layout(xaxis_title=xlabel, yaxis_title=ylabel, **kwargs)
|
|
94
|
+
|
|
95
|
+
return fig
|
otter/util.py
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Some constants, mappings, and functions to be used across the software
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import ads
|
|
7
|
+
import astropy.units as u
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Helper functions first that just don't belong anywhere else
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def filter_to_obstype(band_name):
|
|
15
|
+
"""
|
|
16
|
+
Converts a band name to either 'radio', 'uvoir', 'xray'
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
wave_eff = FILTER_MAP_WAVE[band_name] * u.nm
|
|
21
|
+
except KeyError as exc:
|
|
22
|
+
raise Exception(
|
|
23
|
+
f"No Effective Wavelength Known for {band_name}, please add it to constants"
|
|
24
|
+
) from exc
|
|
25
|
+
|
|
26
|
+
if wave_eff > 1 * u.mm:
|
|
27
|
+
return "radio"
|
|
28
|
+
elif wave_eff <= 1 * u.mm and wave_eff >= 10 * u.nm:
|
|
29
|
+
return "uvoir"
|
|
30
|
+
else:
|
|
31
|
+
return "xray"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def clean_schema(schema):
|
|
35
|
+
"""
|
|
36
|
+
Clean out Nones and empty lists from the given subschema
|
|
37
|
+
"""
|
|
38
|
+
for key, val in list(schema.items()):
|
|
39
|
+
if val is None or (isinstance(val, (list, dict)) and len(val) == 0):
|
|
40
|
+
del schema[key]
|
|
41
|
+
return schema
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def bibcode_to_hrn(bibcode):
|
|
45
|
+
"""
|
|
46
|
+
Converts a bibcode to a human_readable_name (hrn) using ADSQuery
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
adsquery = list(ads.SearchQuery(bibcode=bibcode))[0]
|
|
51
|
+
except IndexError:
|
|
52
|
+
raise ValueError(f"Could not find {bibcode} on ADS!")
|
|
53
|
+
|
|
54
|
+
authors = adsquery.author
|
|
55
|
+
year = adsquery.year
|
|
56
|
+
|
|
57
|
+
if len(authors) == 0:
|
|
58
|
+
raise ValueError("This ADS bibcode does not exist!")
|
|
59
|
+
elif len(authors) == 1:
|
|
60
|
+
author = authors[0]
|
|
61
|
+
elif len(authors) == 2:
|
|
62
|
+
author = authors[0] + " & " + authors[1]
|
|
63
|
+
else: # longer than 2
|
|
64
|
+
author = authors[0] + " et al."
|
|
65
|
+
|
|
66
|
+
# generate the human readable name
|
|
67
|
+
hrn = author + " (" + year + ")"
|
|
68
|
+
return hrn
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
"""
|
|
72
|
+
Then the constants and dictionary mappings used throughout
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
# gives the effective wavelength for each filter given
|
|
76
|
+
# these are all in nanometers!
|
|
77
|
+
FILTER_MAP_WAVE = {
|
|
78
|
+
"FUV": 153.8620701901866,
|
|
79
|
+
"NUV": 231.56631043707714,
|
|
80
|
+
"UVW2": 207.98754332676123,
|
|
81
|
+
"uvw2": 207.98754332676123,
|
|
82
|
+
"W2": 207.98754332676123,
|
|
83
|
+
"2": 207.98754332676123,
|
|
84
|
+
"uw2": 207.98754332676123,
|
|
85
|
+
"UVM2": 225.47802478793594,
|
|
86
|
+
"uvm2": 225.47802478793594,
|
|
87
|
+
"M2": 225.47802478793594,
|
|
88
|
+
"M": 225.47802478793594,
|
|
89
|
+
"um2": 225.47802478793594,
|
|
90
|
+
"UVW1": 261.3713060531025,
|
|
91
|
+
"uvw1": 261.3713060531025,
|
|
92
|
+
"W1": 261.3713060531025,
|
|
93
|
+
"1": 261.3713060531025,
|
|
94
|
+
"uw1": 261.3713060531025,
|
|
95
|
+
"u": 356.17887353001856,
|
|
96
|
+
"u'": 356.17887353001856,
|
|
97
|
+
"up": 356.17887353001856,
|
|
98
|
+
"uprime": 356.17887353001856,
|
|
99
|
+
"U_S": 347.06360491031495,
|
|
100
|
+
"s": 347.06360491031495,
|
|
101
|
+
"us": 347.06360491031495,
|
|
102
|
+
"U": 353.10502283105023,
|
|
103
|
+
"B": 443.0539845758355,
|
|
104
|
+
"B_S": 435.912081730874,
|
|
105
|
+
"b": 435.912081730874,
|
|
106
|
+
"bs": 435.912081730874,
|
|
107
|
+
"g": 471.8872246248687,
|
|
108
|
+
"g'": 471.8872246248687,
|
|
109
|
+
"gp": 471.8872246248687,
|
|
110
|
+
"gprime": 471.8872246248687,
|
|
111
|
+
"F475W": 471.8872246248687,
|
|
112
|
+
"g-DECam": 482.6787274749997,
|
|
113
|
+
"c": 540.8724658332794,
|
|
114
|
+
"cyan": 540.8724658332794,
|
|
115
|
+
"V": 553.7155963302753,
|
|
116
|
+
"V_S": 543.0131091205997,
|
|
117
|
+
"v": 543.0131091205997,
|
|
118
|
+
"vs": 543.0131091205997,
|
|
119
|
+
"Itagaki": 651.0535687558726,
|
|
120
|
+
"white": 752.0,
|
|
121
|
+
"unfilt.": 616.690135,
|
|
122
|
+
"0": 616.690135,
|
|
123
|
+
"C": 616.690135,
|
|
124
|
+
"clear": 616.690135,
|
|
125
|
+
"pseudobolometric": 616.690135,
|
|
126
|
+
"griz": 616.690135,
|
|
127
|
+
"RGB": 616.690135,
|
|
128
|
+
"LGRB": 616.690135,
|
|
129
|
+
"G": 673.5412573108297,
|
|
130
|
+
"Kepler": 641.6835660569259,
|
|
131
|
+
"TESS": 797.2360657697333,
|
|
132
|
+
"DLT40": 615.8130149792426,
|
|
133
|
+
"Open": 615.8130149792426,
|
|
134
|
+
"Clear": 615.8130149792426,
|
|
135
|
+
"w": 638.9300625093831,
|
|
136
|
+
"o": 686.6260690394873,
|
|
137
|
+
"orange": 686.6260690394873,
|
|
138
|
+
"r": 618.5194476741524,
|
|
139
|
+
"r'": 618.5194476741524,
|
|
140
|
+
"rp": 618.5194476741524,
|
|
141
|
+
"rprime": 618.5194476741524,
|
|
142
|
+
"F625W": 618.5194476741524,
|
|
143
|
+
"r-DECam": 643.2062638192127,
|
|
144
|
+
"R": 646.9439215118385,
|
|
145
|
+
"Rc": 646.9439215118385,
|
|
146
|
+
"R_s": 646.9439215118385,
|
|
147
|
+
"i": 749.9704174464691,
|
|
148
|
+
"i'": 749.9704174464691,
|
|
149
|
+
"ip": 749.9704174464691,
|
|
150
|
+
"iprime": 749.9704174464691,
|
|
151
|
+
"F775W": 749.9704174464691,
|
|
152
|
+
"i-DECam": 782.6680306208917,
|
|
153
|
+
"I": 788.558706467662,
|
|
154
|
+
"Ic": 788.558706467662,
|
|
155
|
+
"z_s": 867.9495480864285,
|
|
156
|
+
"zs": 867.9495480864285,
|
|
157
|
+
"z": 896.1488333992431,
|
|
158
|
+
"z'": 896.1488333992431,
|
|
159
|
+
"zp": 896.1488333992431,
|
|
160
|
+
"zprime": 896.1488333992431,
|
|
161
|
+
"z-DECam": 917.8949537472383,
|
|
162
|
+
"y": 963.3308299506817,
|
|
163
|
+
"y-DECam": 989.965087304703,
|
|
164
|
+
"J": 1255.0918319447906,
|
|
165
|
+
"H": 1630.5155019191195,
|
|
166
|
+
"K": 2157.3600605745955,
|
|
167
|
+
"Ks": 2157.3600605745955,
|
|
168
|
+
"F070W": 705.5727879998312,
|
|
169
|
+
"F090W": 904.2281265089156,
|
|
170
|
+
"F115W": 1157.001589027877,
|
|
171
|
+
"F150W": 1503.9880463410511,
|
|
172
|
+
"F200W": 1993.3922957570885,
|
|
173
|
+
"F225W": 2372.81,
|
|
174
|
+
"F277W": 2769.332372846113,
|
|
175
|
+
"F300M": 2990.7606605760484,
|
|
176
|
+
"F335M": 3363.887076210947,
|
|
177
|
+
"F356W": 3576.787256375927,
|
|
178
|
+
"F360M": 3626.0578695682693,
|
|
179
|
+
"F444W": 4415.974447587756,
|
|
180
|
+
"F560W": 5645.279496731566,
|
|
181
|
+
"F770W": 7663.455798629626,
|
|
182
|
+
"F1000W": 9968.161727011531,
|
|
183
|
+
"F1130W": 11310.984595876938,
|
|
184
|
+
"F1280W": 12831.396996921212,
|
|
185
|
+
"F1500W": 15091.367399905488,
|
|
186
|
+
"F1800W": 18006.083119653664,
|
|
187
|
+
"F2100W": 20842.526633138932,
|
|
188
|
+
"F2550W": 25408.228367890282,
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
# gives the effective frequency for all filters
|
|
192
|
+
# These are all in THz
|
|
193
|
+
FILTER_MAP_FREQ = {
|
|
194
|
+
"FUV": 1975.086895569116,
|
|
195
|
+
"NUV": 1346.3548820463916,
|
|
196
|
+
"UVW2": 1531.4976984760474,
|
|
197
|
+
"uvw2": 1531.4976984760474,
|
|
198
|
+
"W2": 1531.4976984760474,
|
|
199
|
+
"2": 1531.4976984760474,
|
|
200
|
+
"uw2": 1531.4976984760474,
|
|
201
|
+
"UVM2": 1360.083095675749,
|
|
202
|
+
"uvm2": 1360.083095675749,
|
|
203
|
+
"M2": 1360.083095675749,
|
|
204
|
+
"M": 1360.083095675749,
|
|
205
|
+
"um2": 1360.083095675749,
|
|
206
|
+
"UVW1": 1236.8527545450256,
|
|
207
|
+
"uvw1": 1236.8527545450256,
|
|
208
|
+
"W1": 1236.8527545450256,
|
|
209
|
+
"1": 1236.8527545450256,
|
|
210
|
+
"uw1": 1236.8527545450256,
|
|
211
|
+
"u": 849.2871562331687,
|
|
212
|
+
"u'": 849.2871562331687,
|
|
213
|
+
"up": 849.2871562331687,
|
|
214
|
+
"uprime": 849.2871562331687,
|
|
215
|
+
"U_S": 875.611103788721,
|
|
216
|
+
"s": 875.611103788721,
|
|
217
|
+
"us": 875.611103788721,
|
|
218
|
+
"U": 858.321721875779,
|
|
219
|
+
"B": 688.8500955332158,
|
|
220
|
+
"B_S": 696.7876979144597,
|
|
221
|
+
"b": 696.7876979144597,
|
|
222
|
+
"bs": 696.7876979144597,
|
|
223
|
+
"g": 648.9823425403824,
|
|
224
|
+
"g'": 648.9823425403824,
|
|
225
|
+
"gp": 648.9823425403824,
|
|
226
|
+
"gprime": 648.9823425403824,
|
|
227
|
+
"F475W": 648.9823425403824,
|
|
228
|
+
"g-DECam": 635.8015668464043,
|
|
229
|
+
"c": 580.1132515050684,
|
|
230
|
+
"cyan": 580.1132515050684,
|
|
231
|
+
"V": 548.3068934496129,
|
|
232
|
+
"V_S": 554.9815375506427,
|
|
233
|
+
"v": 554.9815375506427,
|
|
234
|
+
"vs": 554.9815375506427,
|
|
235
|
+
"Itagaki": 577.0861573682259,
|
|
236
|
+
"white": 30079.243284322874,
|
|
237
|
+
"unfilt.": 601.5655810567023,
|
|
238
|
+
"0": 601.5655810567023,
|
|
239
|
+
"C": 601.5655810567023,
|
|
240
|
+
"clear": 601.5655810567023,
|
|
241
|
+
"pseudobolometric": 601.5655810567023,
|
|
242
|
+
"griz": 601.5655810567023,
|
|
243
|
+
"RGB": 601.5655810567023,
|
|
244
|
+
"LGRB": 601.5655810567023,
|
|
245
|
+
"G": 518.6766845466752,
|
|
246
|
+
"Kepler": 519.5058608954615,
|
|
247
|
+
"TESS": 403.1881955125893,
|
|
248
|
+
"DLT40": 629.637672549936,
|
|
249
|
+
"Open": 629.637672549936,
|
|
250
|
+
"Clear": 629.637672549936,
|
|
251
|
+
"w": 520.8387777057242,
|
|
252
|
+
"o": 451.71177203298663,
|
|
253
|
+
"orange": 451.71177203298663,
|
|
254
|
+
"r": 489.2629992899134,
|
|
255
|
+
"r'": 489.2629992899134,
|
|
256
|
+
"rp": 489.2629992899134,
|
|
257
|
+
"rprime": 489.2629992899134,
|
|
258
|
+
"F625W": 489.2629992899134,
|
|
259
|
+
"r-DECam": 472.4459671948087,
|
|
260
|
+
"R": 471.26223689126897,
|
|
261
|
+
"Rc": 471.26223689126897,
|
|
262
|
+
"R_s": 471.26223689126897,
|
|
263
|
+
"i": 402.8409598867557,
|
|
264
|
+
"i'": 402.8409598867557,
|
|
265
|
+
"ip": 402.8409598867557,
|
|
266
|
+
"iprime": 402.8409598867557,
|
|
267
|
+
"F775W": 402.8409598867557,
|
|
268
|
+
"i-DECam": 386.62233825433924,
|
|
269
|
+
"I": 382.7915178046724,
|
|
270
|
+
"Ic": 382.7915178046724,
|
|
271
|
+
"z_s": 346.66628641927826,
|
|
272
|
+
"zs": 346.66628641927826,
|
|
273
|
+
"z": 337.7343708777923,
|
|
274
|
+
"z'": 337.7343708777923,
|
|
275
|
+
"zp": 337.7343708777923,
|
|
276
|
+
"zprime": 337.7343708777923,
|
|
277
|
+
"z-DECam": 328.753462451287,
|
|
278
|
+
"y": 312.24818210606065,
|
|
279
|
+
"y-DECam": 303.4727730182509,
|
|
280
|
+
"J": 239.862442505934,
|
|
281
|
+
"H": 185.33613196897403,
|
|
282
|
+
"K": 139.79431978859097,
|
|
283
|
+
"Ks": 139.79431978859097,
|
|
284
|
+
"F070W": 431.04176743403116,
|
|
285
|
+
"F090W": 336.17431986268366,
|
|
286
|
+
"F115W": 262.87628654288676,
|
|
287
|
+
"F150W": 201.94374815011136,
|
|
288
|
+
"F200W": 152.56522352568953,
|
|
289
|
+
"F277W": 110.05136786468209,
|
|
290
|
+
"F300M": 100.56915203596012,
|
|
291
|
+
"F335M": 89.41072625742719,
|
|
292
|
+
"F356W": 85.01984846997881,
|
|
293
|
+
"F360M": 82.9357933095218,
|
|
294
|
+
"F444W": 68.96667222373961,
|
|
295
|
+
"F560W": 53.67852315133938,
|
|
296
|
+
"F770W": 39.87175477126777,
|
|
297
|
+
"F1000W": 30.349460503852665,
|
|
298
|
+
"F1130W": 26.53952983680919,
|
|
299
|
+
"F1280W": 23.59741975845449,
|
|
300
|
+
"F1500W": 20.08679352819493,
|
|
301
|
+
"F1800W": 16.773842151606242,
|
|
302
|
+
"F2100W": 14.581938602646188,
|
|
303
|
+
"F2550W": 11.919267708332558,
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
# x-ray telescope areas for converting
|
|
307
|
+
# NOTE: these are estimates from the links provided
|
|
308
|
+
# Since this is inherently instrument dependent they are not entirely reliable
|
|
309
|
+
# All are for 1-2 keV
|
|
310
|
+
XRAY_AREAS = {
|
|
311
|
+
# https://swift.gsfc.nasa.gov/about_swift/Sci_Fact_Sheet.pdf
|
|
312
|
+
"swift": 135 * u.cm**2,
|
|
313
|
+
# https://heasarc.gsfc.nasa.gov/docs/rosat/ruh/handbook/node39.html#SECTION00634000000000000000
|
|
314
|
+
"rosat": 400 * u.cm**2,
|
|
315
|
+
# https://www.cosmos.esa.int/web/xmm-newton/technical-details-mirrors
|
|
316
|
+
"xmm": 1500 * u.cm**2,
|
|
317
|
+
"xmm slew": 1500 * u.cm**2,
|
|
318
|
+
"xmm pointed": 1500 * u.cm**2,
|
|
319
|
+
# https://cxc.harvard.edu/cdo/about_chandra
|
|
320
|
+
"chandra": 600 * u.cm**2,
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
# define a working base directory constant
|
|
324
|
+
BASEDIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
325
|
+
DATADIR = os.path.join(BASEDIR, "data", "base")
|
|
326
|
+
|
|
327
|
+
# Overarching schema that stops once we get down to a string or list
|
|
328
|
+
schema = {
|
|
329
|
+
"schema_version": {"value": "0", "comment": "Copied from tde.space"},
|
|
330
|
+
"name": {"default_name": None, "alias": []},
|
|
331
|
+
"coordinate": [],
|
|
332
|
+
"distance": [],
|
|
333
|
+
"classification": [],
|
|
334
|
+
"reference_alias": [],
|
|
335
|
+
"date_reference": [],
|
|
336
|
+
"photometry": [],
|
|
337
|
+
"spectra": [],
|
|
338
|
+
"filter_alias": [],
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
# sub schemas that get filled into lists
|
|
343
|
+
name_alias_schema = {"value": None, "reference": None}
|
|
344
|
+
coordinate_schema = {
|
|
345
|
+
"ra": None,
|
|
346
|
+
"dec": None,
|
|
347
|
+
"l": None,
|
|
348
|
+
"b": None,
|
|
349
|
+
"lon": None,
|
|
350
|
+
"lat": None,
|
|
351
|
+
"ra_units": None,
|
|
352
|
+
"dec_units": None,
|
|
353
|
+
"l_units": None,
|
|
354
|
+
"b_units": None,
|
|
355
|
+
"lon_units": None,
|
|
356
|
+
"lat_units": None,
|
|
357
|
+
"ra_error": None,
|
|
358
|
+
"dec_error": None,
|
|
359
|
+
"l_error": None,
|
|
360
|
+
"b_error": None,
|
|
361
|
+
"lon_error": None,
|
|
362
|
+
"lat_error": None,
|
|
363
|
+
"epoch": None,
|
|
364
|
+
"frame": None,
|
|
365
|
+
"coord_type": None,
|
|
366
|
+
"computed": None,
|
|
367
|
+
"reference": None,
|
|
368
|
+
"default": None,
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
distance_schema = {
|
|
372
|
+
"value": None,
|
|
373
|
+
"unit": None,
|
|
374
|
+
"error": None,
|
|
375
|
+
"cosmology": None,
|
|
376
|
+
"reference": None,
|
|
377
|
+
"computed": None,
|
|
378
|
+
"uuid": None,
|
|
379
|
+
"default": None,
|
|
380
|
+
"distance_type": None,
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
classification_schema = {
|
|
384
|
+
"object_class": None,
|
|
385
|
+
"confidence": None,
|
|
386
|
+
"class_type": None,
|
|
387
|
+
"reference": None,
|
|
388
|
+
"default": None,
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
reference_alias_schema = {"name": None, "human_readable_name": None}
|
|
392
|
+
|
|
393
|
+
date_reference_schema = {
|
|
394
|
+
"value": None,
|
|
395
|
+
"date_format": None,
|
|
396
|
+
"date_type": None,
|
|
397
|
+
"reference": None,
|
|
398
|
+
"computed": None,
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
photometry_schema = {
|
|
402
|
+
"raw": None,
|
|
403
|
+
"raw_err": None,
|
|
404
|
+
"raw_units": None,
|
|
405
|
+
"value": None,
|
|
406
|
+
"value_err": None,
|
|
407
|
+
"value_units": None,
|
|
408
|
+
"epoch_zeropoint": None,
|
|
409
|
+
"epoch_redshift": None,
|
|
410
|
+
"filter": None,
|
|
411
|
+
"filter_key": None,
|
|
412
|
+
"obs_type": None,
|
|
413
|
+
"telescope_area": None,
|
|
414
|
+
"date": None,
|
|
415
|
+
"date_format": None,
|
|
416
|
+
"date_err": None,
|
|
417
|
+
"ignore": None,
|
|
418
|
+
"upperlimit": None,
|
|
419
|
+
"sigma": None,
|
|
420
|
+
"sky": None,
|
|
421
|
+
"telescope": None,
|
|
422
|
+
"instrument": None,
|
|
423
|
+
"phot_type": None,
|
|
424
|
+
"exptime": None,
|
|
425
|
+
"aperature": None,
|
|
426
|
+
"observer": None,
|
|
427
|
+
"reducer": None,
|
|
428
|
+
"pipeline": None,
|
|
429
|
+
"corr_k": None,
|
|
430
|
+
"corr_av": None,
|
|
431
|
+
"corr_host": None,
|
|
432
|
+
"corr_hostav": None,
|
|
433
|
+
"val_k": None,
|
|
434
|
+
"val_s": None,
|
|
435
|
+
"val_av": None,
|
|
436
|
+
"val_host": None,
|
|
437
|
+
"val_hostav": None,
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
spectra_schema = {
|
|
441
|
+
"wavelength": None,
|
|
442
|
+
"wavelength_units": None,
|
|
443
|
+
"flux": None,
|
|
444
|
+
"fluxerr": None,
|
|
445
|
+
"raw": None,
|
|
446
|
+
"raw_err": None,
|
|
447
|
+
"sky": None,
|
|
448
|
+
"lamp": None,
|
|
449
|
+
"flux_units": None,
|
|
450
|
+
"telescope": None,
|
|
451
|
+
"instrument": None,
|
|
452
|
+
"date": None,
|
|
453
|
+
"date_format": None,
|
|
454
|
+
"date_err": None,
|
|
455
|
+
"exptime": None,
|
|
456
|
+
"slit": None,
|
|
457
|
+
"airmass": None,
|
|
458
|
+
"disperser": None,
|
|
459
|
+
"resolution": None,
|
|
460
|
+
"resolution_units": None,
|
|
461
|
+
"min_wave": None,
|
|
462
|
+
"max_wave": None,
|
|
463
|
+
"filter": None,
|
|
464
|
+
"filter_key": None,
|
|
465
|
+
"standard_name": None,
|
|
466
|
+
"ignore": None,
|
|
467
|
+
"spec_type": None,
|
|
468
|
+
"aperture": None,
|
|
469
|
+
"observer": None,
|
|
470
|
+
"reducer": None,
|
|
471
|
+
"pipeline": None,
|
|
472
|
+
"corr_k": None,
|
|
473
|
+
"corr_av": None,
|
|
474
|
+
"corr_host": None,
|
|
475
|
+
"corr_hostav": None,
|
|
476
|
+
"corr_flux": None,
|
|
477
|
+
"corr_phot": None,
|
|
478
|
+
"val_k": None,
|
|
479
|
+
"val_av": None,
|
|
480
|
+
"val_host": None,
|
|
481
|
+
"val_hostav": None,
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
filter_alias_schema = {
|
|
485
|
+
"filter_key": None,
|
|
486
|
+
"wave_eff": None,
|
|
487
|
+
"wave_min": None,
|
|
488
|
+
"wave_max": None,
|
|
489
|
+
"freq_eff": None,
|
|
490
|
+
"freq_min": None,
|
|
491
|
+
"freq_max": None,
|
|
492
|
+
"zp": None,
|
|
493
|
+
"wave_units": None,
|
|
494
|
+
"freq_units": None,
|
|
495
|
+
"zp_units": None,
|
|
496
|
+
"zp_system": None,
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
# package the subschemas by the key used for that location in the Transient object
|
|
500
|
+
subschema = {
|
|
501
|
+
"name/alias": name_alias_schema,
|
|
502
|
+
"coordinate": coordinate_schema,
|
|
503
|
+
"distance": distance_schema,
|
|
504
|
+
"classification": classification_schema,
|
|
505
|
+
"reference_alias": reference_alias_schema,
|
|
506
|
+
"date_reference": date_reference_schema,
|
|
507
|
+
"photometry": photometry_schema,
|
|
508
|
+
"spectra": spectra_schema,
|
|
509
|
+
"filter_alias": filter_alias_schema,
|
|
510
|
+
}
|