From 37deb850b5596b5d83ef4d6052b516214f22ef5f Mon Sep 17 00:00:00 2001 From: Andy Casey Date: Thu, 14 Nov 2024 12:47:49 -0700 Subject: [PATCH] use v6_2_0 proper path, and update specFull path for v6_2 onwards --- src/astra/migrations/boss.py | 21 +++++---------------- src/astra/models/boss.py | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/astra/migrations/boss.py b/src/astra/migrations/boss.py index fdb0421..53d9be7 100644 --- a/src/astra/migrations/boss.py +++ b/src/astra/migrations/boss.py @@ -17,7 +17,7 @@ ) -def migrate_from_spall_file(run2d, queue, gzip=True, limit=1_000_000, batch_size=1000): +def migrate_from_spall_file(run2d, queue, gzip=True, limit=None, batch_size=1000): """ Migrate all new BOSS visit information (`specFull` files) stored in the spAll file, which is generated by the SDSS-V BOSS data reduction pipeline. @@ -28,21 +28,10 @@ def migrate_from_spall_file(run2d, queue, gzip=True, limit=1_000_000, batch_size from astra.models.source import Source from astra.migrations.utils import enumerate_new_spectrum_pks, upsert_many, NoQueue - #path = expand_path(f"$BOSS_SPECTRO_REDUX/{run2d}/spAll-{run2d}.fits") - #if gzip: - # path += ".gz" - #print("USING CUSTOM PATH") - path = "spAll-v6_1_3.fits" - - - - #spAll = Table.read(expand_path(path)) - #spAll.sort(["CATALOGID"]) - - #if limit is not None: - # spAll = spAll[:limit] - - + path = expand_path(f"$BOSS_SPECTRO_REDUX/{run2d}/summary/daily/spAll-{run2d}.fits") + if gzip: + path += ".gz" + from astra.migrations.sdss5db.catalogdb import ( Catalog, CatalogToGaia_DR2, diff --git a/src/astra/models/boss.py b/src/astra/models/boss.py index 269d871..a6f119c 100644 --- a/src/astra/models/boss.py +++ b/src/astra/models/boss.py @@ -171,12 +171,24 @@ class Meta: @property def path(self): - return ( - f"$SAS_BASE_DIR/" - f"sdsswork/bhm/boss/spectro/redux/" - f"{self.run2d}/spectra/full/{self.pad_fieldid}{self.isplate}/{self.mjd}/" - f"spec-{self.pad_fieldid}-{self.mjd}-{self.catalogid}.fits" - ) + if self.run2d.startswith("v6_2"): + return ( + f"$SAS_BASE_DIR/" + f"sdsswork/bhm/boss/spectro/redux/" + f"{self.run2d}/spectra/daily/full/{self.field_group}/{self.pad_fieldid}{self.isplate}/{self.mjd}/" + f"spec-{self.pad_fieldid}-{self.mjd}-{self.catalogid}.fits" + ) + else: + return ( + f"$SAS_BASE_DIR/" + f"sdsswork/bhm/boss/spectro/redux/" + f"{self.run2d}/spectra/full/{self.pad_fieldid}{self.isplate}/{self.mjd}/" + f"spec-{self.pad_fieldid}-{self.mjd}-{self.catalogid}.fits" + ) + + @property + def field_group(self): + return f"{str(int(self.fieldid) // 1000):0>3d}XXX" @property def pad_fieldid(self):