sdss-almanac 0.2.12__tar.gz → 0.3__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.12 → sdss_almanac-0.3}/PKG-INFO +1 -1
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/pyproject.toml +1 -1
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/__init__.py +1 -1
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/cli.py +27 -12
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/PKG-INFO +1 -1
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/LICENSE.md +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/README.md +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/setup.cfg +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/apogee.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/catalog.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/config.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/__init__.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/exposure.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/fps.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/metadata.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/plate.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/types.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/data_models/utils.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/database.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/display.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/etc/__init__.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/etc/bad_exposures.csv +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/io.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/logger.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/qa.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/stash/data_models.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/stash/plugmap_models.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/almanac/utils.py +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/SOURCES.txt +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/dependency_links.txt +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/entry_points.txt +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/not-zip-safe +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/requires.txt +0 -0
- {sdss_almanac-0.2.12 → sdss_almanac-0.3}/src/sdss_almanac.egg-info/top_level.txt +0 -0
@@ -225,23 +225,34 @@ def lookup(identifier, careful, **kwargs):
|
|
225
225
|
from rich.console import Console
|
226
226
|
from rich.live import Live
|
227
227
|
|
228
|
-
|
228
|
+
sq = (
|
229
229
|
SDSS_ID_flat
|
230
|
-
.select(
|
231
|
-
SDSS_ID_flat.catalogid,
|
232
|
-
SDSS_ID_flat.sdss_id,
|
233
|
-
)
|
230
|
+
.select(SDSS_ID_flat.sdss_id)
|
234
231
|
.where(
|
235
232
|
(SDSS_ID_flat.sdss_id == identifier)
|
236
233
|
| (SDSS_ID_flat.catalogid == identifier)
|
237
234
|
)
|
235
|
+
.alias("sq")
|
236
|
+
)
|
237
|
+
q = (
|
238
|
+
SDSS_ID_flat
|
239
|
+
.select(SDSS_ID_flat.catalogid, SDSS_ID_flat.sdss_id)
|
240
|
+
.distinct()
|
241
|
+
.join(sq, on=(SDSS_ID_flat.sdss_id == sq.c.sdss_id))
|
238
242
|
.tuples()
|
239
243
|
)
|
240
244
|
|
241
|
-
|
242
|
-
|
245
|
+
sdss_ids, catalogids = (set(), [])
|
246
|
+
for catalogid, sdss_id in q:
|
247
|
+
sdss_ids.add(sdss_id)
|
248
|
+
catalogids.append(catalogid)
|
249
|
+
|
250
|
+
if not catalogids:
|
243
251
|
raise click.ClickException(f"Identifier {identifier} not found in SDSS-V database")
|
244
252
|
|
253
|
+
if len(sdss_ids) != 1:
|
254
|
+
raise click.ClickException(f"Identifier {identifier} is ambiguous and matches multiple SDSS IDs: {', '.join(map(str, sdss_ids))}")
|
255
|
+
|
245
256
|
q = (
|
246
257
|
Target
|
247
258
|
.select(
|
@@ -255,7 +266,7 @@ def lookup(identifier, careful, **kwargs):
|
|
255
266
|
.join(Hole)
|
256
267
|
.join(Observatory)
|
257
268
|
.where(
|
258
|
-
Target.catalogid.in_(tuple(
|
269
|
+
Target.catalogid.in_(tuple(catalogids))
|
259
270
|
& (AssignmentStatus.status == 1)
|
260
271
|
)
|
261
272
|
.tuples()
|
@@ -264,23 +275,25 @@ def lookup(identifier, careful, **kwargs):
|
|
264
275
|
|
265
276
|
console = Console()
|
266
277
|
|
267
|
-
title =
|
278
|
+
title = f"SDSS ID {sdss_id}"
|
268
279
|
|
269
280
|
# Create Rich table
|
270
281
|
rich_table = RichTable(title=f"{title}", title_style="bold blue", show_header=True, header_style="bold cyan")
|
271
282
|
|
272
|
-
for field_name in ("obs", "mjd", "exposure", "field", "fiber_id", "catalogid"):
|
283
|
+
for field_name in ("#", "obs", "mjd", "exposure", "field", "fiber_id", "catalogid"):
|
273
284
|
rich_table.add_column(field_name, justify="center")
|
274
285
|
|
275
286
|
fields = {}
|
276
|
-
|
287
|
+
i = 1
|
288
|
+
with Live(rich_table, console=console, refresh_per_second=4) as live:
|
277
289
|
for exposure in chain(*starmap(get_exposures, q)):
|
278
290
|
key = (exposure.observatory, exposure.mjd)
|
279
291
|
if (key not in fields or fields[key] == exposure.field_id) or careful:
|
280
292
|
for target in exposure.targets:
|
281
|
-
if target.catalogid in
|
293
|
+
if target.catalogid in catalogids:
|
282
294
|
fields[key] = exposure.field_id
|
283
295
|
rich_table.add_row(*list(map(str, (
|
296
|
+
i,
|
284
297
|
exposure.observatory,
|
285
298
|
exposure.mjd,
|
286
299
|
exposure.exposure,
|
@@ -288,8 +301,10 @@ def lookup(identifier, careful, **kwargs):
|
|
288
301
|
target.fiber_id,
|
289
302
|
target.catalogid
|
290
303
|
))))
|
304
|
+
i += 1
|
291
305
|
break
|
292
306
|
|
307
|
+
|
293
308
|
@main.group()
|
294
309
|
def add(**kwargs):
|
295
310
|
"""Add new information to an existing Almanac file."""
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|