sdss-almanac 0.2.5__tar.gz → 0.2.7__tar.gz
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.
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/PKG-INFO +1 -1
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/pyproject.toml +1 -1
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/__init__.py +1 -1
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/exposure.py +25 -11
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/types.py +5 -2
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/utils.py +26 -3
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/PKG-INFO +1 -1
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/LICENSE.md +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/README.md +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/setup.cfg +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/apogee.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/cli.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/config.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/__init__.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/fps.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/data_models/plate.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/database.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/display.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/etc/__init__.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/etc/bad_exposures.csv +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/io.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/logger.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/qa.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/stash/data_models.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/stash/plugmap_models.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/almanac/utils.py +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/SOURCES.txt +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/dependency_links.txt +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/entry_points.txt +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/not-zip-safe +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/requires.txt +0 -0
- {sdss_almanac-0.2.5 → sdss_almanac-0.2.7}/src/sdss_almanac.egg-info/top_level.txt +0 -0
@@ -79,7 +79,13 @@ class Exposure(BaseModel):
|
|
79
79
|
|
80
80
|
@computed_field
|
81
81
|
def flagged_bad(self) -> bool:
|
82
|
-
|
82
|
+
marked_bad = (self.observatory, self.mjd, self.exposure) in lookup_bad_exposures
|
83
|
+
missing_plate_info = (
|
84
|
+
(self.image_type == "object")
|
85
|
+
& ((self.fps and self.config_id <= 0) or (not self.fps and self.plate_id <= 0))
|
86
|
+
)
|
87
|
+
return marked_bad or missing_plate_info
|
88
|
+
|
83
89
|
|
84
90
|
@computed_field
|
85
91
|
def chip_flags(self) -> int:
|
@@ -299,7 +305,6 @@ class Exposure(BaseModel):
|
|
299
305
|
@cached_property
|
300
306
|
def targets(self) -> Tuple[Union[FPSTarget, PlateTarget]]:
|
301
307
|
if self._targets is None:
|
302
|
-
|
303
308
|
if (
|
304
309
|
(self.image_type == "object")
|
305
310
|
& (
|
@@ -309,9 +314,18 @@ class Exposure(BaseModel):
|
|
309
314
|
):
|
310
315
|
if self.fps:
|
311
316
|
factory = FPSTarget
|
312
|
-
|
313
|
-
keep = (
|
314
|
-
|
317
|
+
rows = self.fiber_map
|
318
|
+
keep = (rows["fiberType"] == "APOGEE") & (rows["fiberId"] > 0)
|
319
|
+
rows = rows[keep]
|
320
|
+
missing = set(range(1, 301)) - set(rows["fiberId"])
|
321
|
+
for fiber_id in missing:
|
322
|
+
rows.add_row({
|
323
|
+
"fiberId": fiber_id,
|
324
|
+
"racat": np.nan,
|
325
|
+
"deccat": np.nan,
|
326
|
+
"category": "bonus",
|
327
|
+
})
|
328
|
+
rows.sort("fiberId")
|
315
329
|
else:
|
316
330
|
factory = PlateTarget
|
317
331
|
bad_exposure_notes = (
|
@@ -320,16 +334,16 @@ class Exposure(BaseModel):
|
|
320
334
|
.get("notes", None)
|
321
335
|
)
|
322
336
|
if bad_exposure_notes == "missing_plug_map_file":
|
323
|
-
|
337
|
+
rows = []
|
324
338
|
else:
|
325
|
-
|
326
|
-
if
|
339
|
+
rows = match_planned_to_plugged(self.plate_hole_map, self.plug_map)
|
340
|
+
if rows:
|
327
341
|
# Plugged MJD is necessary to understand where the fiber mapping
|
328
342
|
# went wrong in early plate era.
|
329
|
-
|
330
|
-
|
343
|
+
rows["plugged_mjd"] = self.plugged_mjd
|
344
|
+
rows["observatory"] = self.observatory
|
331
345
|
|
332
|
-
self._targets = tuple([factory(**r) for r in
|
346
|
+
self._targets = tuple([factory(**r) for r in rows])
|
333
347
|
else:
|
334
348
|
self._targets = tuple()
|
335
349
|
return self._targets
|
@@ -28,12 +28,14 @@ ImageType = Literal[
|
|
28
28
|
]
|
29
29
|
Category = Literal[
|
30
30
|
"",
|
31
|
+
"bonus",
|
31
32
|
"science",
|
32
33
|
"sky_apogee",
|
33
34
|
"sky_boss",
|
34
35
|
"standard_apogee",
|
35
36
|
"standard_boss",
|
36
|
-
"open_fiber"
|
37
|
+
"open_fiber",
|
38
|
+
"unplugged",
|
37
39
|
]
|
38
40
|
|
39
41
|
HoleType = Literal[
|
@@ -56,7 +58,8 @@ HoleType = Literal[
|
|
56
58
|
"apogee_south",
|
57
59
|
"bosshalf",
|
58
60
|
"boss_shared",
|
59
|
-
"fps"
|
61
|
+
"fps",
|
62
|
+
"unplugged",
|
60
63
|
]
|
61
64
|
|
62
65
|
ObjType = Literal[
|
@@ -17,16 +17,33 @@ def sanitise_twomass_designation(v):
|
|
17
17
|
return ""
|
18
18
|
return v
|
19
19
|
|
20
|
-
def match_planned_to_plugged(planned, plugged, tol=1e-5):
|
21
20
|
|
21
|
+
def match_planned_to_plugged(planned, plugged, tol=1e-5, enforce_300=True):
|
22
|
+
|
23
|
+
unplugged_dict = {
|
24
|
+
"holeType": "unplugged",
|
25
|
+
"holetype": "unplugged",
|
26
|
+
"targettype": "unplugged",
|
27
|
+
"ra": np.nan,
|
28
|
+
"dec": np.nan,
|
29
|
+
"objType": "na",
|
30
|
+
}
|
22
31
|
is_apogee = (
|
23
32
|
(planned["holetype"] == "APOGEE")
|
24
33
|
| (planned["holetype"] == "APOGEE_SHARED")
|
25
34
|
| (planned["holetype"] == "APOGEE_SOUTH")
|
26
35
|
)
|
27
|
-
if not any(is_apogee):
|
36
|
+
if not np.any(is_apogee) and not enforce_300:
|
28
37
|
return []
|
29
38
|
|
39
|
+
elif not np.any(is_apogee):
|
40
|
+
rows = []
|
41
|
+
for i in range(1, 301):
|
42
|
+
unplugged_dict["fiberId"] = i
|
43
|
+
rows.append(unplugged_dict.copy())
|
44
|
+
|
45
|
+
return Table(rows=rows)
|
46
|
+
|
30
47
|
planned = planned[is_apogee]
|
31
48
|
plugged = plugged[plugged["spectrographId"] == 2]
|
32
49
|
|
@@ -50,7 +67,7 @@ def match_planned_to_plugged(planned, plugged, tol=1e-5):
|
|
50
67
|
has_match = (n_matches_to_plugged_holes == 1)
|
51
68
|
planned_hole_indices = np.argmin(dist[:, has_match], axis=0)
|
52
69
|
|
53
|
-
|
70
|
+
rows = hstack(
|
54
71
|
[
|
55
72
|
plugged[has_match],
|
56
73
|
planned[planned_hole_indices]
|
@@ -59,6 +76,12 @@ def match_planned_to_plugged(planned, plugged, tol=1e-5):
|
|
59
76
|
uniq_col_name="{table_name}{col_name}",
|
60
77
|
table_names=("", "planned_")
|
61
78
|
)
|
79
|
+
if enforce_300 and len(rows) != 300:
|
80
|
+
for fiber_id in (set(range(1, 301)) - set(rows["fiberId"])):
|
81
|
+
rows.add_row({"fiberId": fiber_id, **unplugged_dict })
|
82
|
+
rows.sort("fiberId")
|
83
|
+
|
84
|
+
return rows
|
62
85
|
|
63
86
|
|
64
87
|
def get_headers(path, head=20_000):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|