Skip to content

Commit 8d853cc

Browse files
committed
Update
DR18 -> DR19
1 parent 3568b4a commit 8d853cc

File tree

6 files changed

+89
-63
lines changed

6 files changed

+89
-63
lines changed

pixi.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdssv_spec_appREMOTE.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class Meta:
235235
z: float = NaN
236236
zwarn: int = -1 # ≥0
237237

238-
def __init__(self, hdu: None | FITS_rec = None) -> None:
238+
def __init__(self, hdu: None | FITS_rec = None, is_all_epoch: bool = False) -> None:
239239
if hdu is None: return
240240
if some(x := get(hdu, "DEC" )): self.lat = float(x)
241241
if some(x := get(hdu, "RA" )): self.lon = float(x)
@@ -258,6 +258,7 @@ def __init__(self, hdu: None | FITS_rec = None) -> None:
258258
if some(x := get(hdu, "ZWARNING" )): self.zwarn = int(x)
259259
#
260260
if some(a := self.lon) and some(d := self.lat): self.iau = sdss_iau(a, d)
261+
if some(x := get(hdu, "MJD")) and is_all_epoch: self.mjd = max(float(x), self.mjd)
261262

262263
@dataclass
263264
class Data:
@@ -352,7 +353,7 @@ def legend(meta: Meta, base: str = "") -> str:
352353
except Exception as e:
353354
# if str(e): print(e) if isa(e, HTTPError) else print_exc()
354355
continue
355-
meta = Meta(dat[0])
356+
meta = Meta(dat[0], True)
356357
data.append(Data(meta, wave=dat[1], flux=dat[2], errs=dat[3], name=legend(meta, f"allplate-{mjd}")))
357358
break
358359
# allFPS
@@ -363,7 +364,7 @@ def legend(meta: Meta, base: str = "") -> str:
363364
except Exception as e:
364365
# if str(e): print(e) if isa(e, HTTPError) else print_exc()
365366
continue
366-
meta = Meta(dat[0])
367+
meta = Meta(dat[0], True)
367368
data.append(Data(meta, wave=dat[1], flux=dat[2], errs=dat[3], name=legend(meta, f"allFPS-{mjd}")))
368369
break
369370
data.sort(key=lambda x: x.meta.mjd + (1e6 if x.name.startswith("all") else 0))
@@ -408,10 +409,11 @@ def legend(meta: Meta, base: str = "") -> str:
408409
print("Verification succeeded.")
409410
print("Try loading http://127.0.0.1:8050/?<sdss_id>")
410411
print(" or http://127.0.0.1:8050/?<field>-<mjd>-<catid>")
411-
print(" or http://127.0.0.1:8050/?<field>-<mjd>-<catid>&prev=<plate>-<mjd>-<fiber>@<branch>")
412+
print(" or http://127.0.0.1:8050/?<field>-<mjd>-<catid>&extra=<plate>-<mjd>-<fiber>@<branch>")
412413
print(" e.g. http://127.0.0.1:8050/?55772170")
413414
print(" or http://127.0.0.1:8050/?101126-60477-63050394846126565")
414415
print(" or http://127.0.0.1:8050/?104623-60251-63050395075696130&prev=7670-57328-0918#m=5&x=3565,10350&y=0,18&z=2.66")
416+
print(" or http://127.0.0.1:8050/?0831-52294-0228&ext=4604-55983-0870,8296-57375-0827#y=0,22&z=0.36")
415417
except:
416418
username, password = "", ""
417419
print("Verification failed.")

src/SpecViewer.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,21 @@ function sas_redux_spec(field::Symbol, mjd::Integer, obj::IntOrStr, branch::SymO
7676
end
7777
function sas_redux_spec(field::Symbol, mjd::Integer, obj::IntOrStr, v::VersionNumber, variant::String = "")::String
7878
isempty(variant) && (variant = "full")
79+
root = sas_redux(v)
7980
path = @match v begin
8081
v where v"6.1.1" v < v"6.1.2" => @match field begin
8182
:allepoch => "spectra/$variant/$field/$mjd/"
8283
end
8384
v where v"6.1.2" v < v"6.2.0" => @match field begin
8485
:allepoch => "spectra/$variant/$field/$mjd/"
85-
:allepoch_lco => "spectra/$variant/$field/$mjd/"
86+
:allepoch_lco => (root = sas_redux(:work, v); "spectra/$variant/$field/$mjd/")
8687
end
8788
v where v"6.2.0" v < v"6.3.0" => @match field begin
8889
:allepoch_apo => "spectra/allepoch/$variant/allepoch/$field/$mjd/"
8990
:allepoch_lco => "spectra/allepoch/$variant/allepoch/$field/$mjd/"
9091
end
9192
end
92-
sas_redux(v) * path * "spec-$field-$mjd-$obj.fits"
93+
root * path * "spec-$field-$mjd-$obj.fits"
9394
end
9495

9596
function sas_redux(v::VersionNumber)::String
@@ -106,7 +107,7 @@ function sas_redux(v::VersionNumber)::String
106107
v"6.1.0" => sas_redux(:work, v)
107108
v"6.1.1" => sas_redux(:work, v)
108109
v"6.1.2" => sas_redux(:work, v)
109-
v"6.1.3" => sas_redux(:work, v)
110+
v"6.1.3" => @match_fail# sas_redux(:work, v) # -> dr19
110111
v"6.2.0" => sas_redux(:work, v)
111112
v"6.2.1" => sas_redux(:work, v)
112113
#
@@ -123,11 +124,12 @@ function sas_redux(v::VersionNumber)::String
123124
v"5.13.2" => @match_fail# sas_redux(:dr17, v) # -> dr18
124125
v"5.13.2" => sas_redux(:dr18, v)
125126
v"6.0.4" => sas_redux(:dr18, v)
127+
v"6.1.3" => sas_redux(:dr19, v)
126128
end
127129
end
128130
function sas_redux(v::Integer)::String
129131
@match v begin
130-
026 || 103 || 104 => sas_redux(:dr18, v)
132+
026 || 103 || 104 => sas_redux(:dr19, v)
131133
end
132134
end
133135

test/sdss.jl

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,44 @@ end
117117
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/v5_13_2/spectra/lite/3586/" * fits
118118
@test spec(plate, mjd, fiber, b) full(plate, mjd, fiber, b)
119119

120+
b = v"6.0.4"
121+
field, mjd, catid, fits = 15143, 59205, 04544940698, "spec-15143-59205-04544940698.fits"
122+
@test full(field, mjd, catid, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/v6_0_4/spectra/full/15143p/59205/" * fits
123+
@test lite(field, mjd, catid, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/v6_0_4/spectra/lite/15143p/59205/" * fits
124+
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
125+
end
126+
127+
@testset "dr19" begin
120128
b = 26
121129
plate, mjd, fiber, fits = 0266, 51602, 0001, "spec-0266-51602-0001.fits"
122-
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/26/spectra/full/0266/" * fits
123-
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/26/spectra/lite/0266/" * fits
124-
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/26/spectra/0266/" * fits
130+
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/26/spectra/full/0266/" * fits
131+
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/26/spectra/lite/0266/" * fits
132+
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/26/spectra/0266/" * fits
125133

126134
b = 103
127135
plate, mjd, fiber, fits = 1960, 53289, 0001, "spec-1960-53289-0001.fits"
128-
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/103/spectra/full/1960/" * fits
129-
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/103/spectra/lite/1960/" * fits
130-
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/103/spectra/1960/" * fits
136+
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/103/spectra/full/1960/" * fits
137+
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/103/spectra/lite/1960/" * fits
138+
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/103/spectra/1960/" * fits
131139

132140
b = 104
133141
plate, mjd, fiber, fits = 2640, 54806, 0001, "spec-2640-54806-0001.fits"
134-
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/104/spectra/full/2640/" * fits
135-
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/104/spectra/lite/2640/" * fits
136-
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/104/spectra/2640/" * fits
142+
@test full(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/104/spectra/full/2640/" * fits
143+
@test lite(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/104/spectra/lite/2640/" * fits
144+
@test spec(plate, mjd, fiber, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/104/spectra/2640/" * fits
137145

138-
b = v"6.0.4"
139-
field, mjd, catid, fits = 15143, 59205, 04544940698, "spec-15143-59205-04544940698.fits"
140-
@test full(field, mjd, catid, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/v6_0_4/spectra/full/15143p/59205/" * fits
141-
@test lite(field, mjd, catid, b) "https://data.sdss.org/sas/dr18/spectro/sdss/redux/v6_0_4/spectra/lite/15143p/59205/" * fits
146+
b = v"6.1.3"
147+
field, mjd, catid, fits = 015000, 59146, 4375786564, "spec-015000-59146-4375786564.fits"
148+
@test full(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/full/015000/59146/" * fits
149+
@test lite(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/lite/015000/59146/" * fits
150+
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
151+
field, mjd, catid, fits = :allepoch, 60000, 27021598054114233, "spec-allepoch-60000-27021598054114233.fits"
152+
@test full(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/full/allepoch/60000/" * fits
153+
@test lite(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/lite/allepoch/60000/" * fits
154+
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
155+
field, mjd, catid, fits = :allepoch_lco, 60000, 27021598048679601, "spec-allepoch_lco-60000-27021598048679601.fits"
156+
@test full(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/full/allepoch_lco/60000/" * fits
157+
@test lite(field, mjd, catid, b) "https://data.sdss.org/sas/dr19/spectro/sdss/redux/v6_1_3/spectra/lite/allepoch_lco/60000/" * fits
142158
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
143159
end
144160

@@ -161,12 +177,12 @@ end
161177

162178
b = v"6.1.3"
163179
field, mjd, catid, fits = 015000, 59146, 4375786564, "spec-015000-59146-4375786564.fits"
164-
@test full(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/full/015000/59146/" * fits
165-
@test lite(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/lite/015000/59146/" * fits
180+
@test full(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/full/015000/59146/" * fits
181+
@test lite(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/lite/015000/59146/" * fits
166182
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
167183
field, mjd, catid, fits = :allepoch, 60000, 27021598054114233, "spec-allepoch-60000-27021598054114233.fits"
168-
@test full(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/full/allepoch/60000/" * fits
169-
@test lite(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/lite/allepoch/60000/" * fits
184+
@test full(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/full/allepoch/60000/" * fits
185+
@test lite(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/lite/allepoch/60000/" * fits
170186
@test spec(field, mjd, catid, b) full(field, mjd, catid, b) full(field, mjd, catid, version2branch(b))
171187
field, mjd, catid, fits = :allepoch_lco, 60000, 27021598048679601, "spec-allepoch_lco-60000-27021598048679601.fits"
172188
@test full(field, mjd, catid, b) "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux/v6_1_3/spectra/full/allepoch_lco/60000/" * fits

util/sdss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def file(field: str, obj: int | str) -> str:
4747
path = "https://data.sdss.org/sas/dr16/sdss/spectro/redux"
4848
case "v5_13_2" | "v6_0_4":
4949
path = "https://data.sdss.org/sas/dr18/spectro/sdss/redux"
50+
case "v6_1_3" if field != "allepoch_lco":
51+
path = "https://data.sdss.org/sas/dr19/spectro/sdss/redux"
5052
case "26" | "103" | "104":
51-
path = "https://data.sdss.org/sas/dr18/spectro/sdss/redux"
53+
path = "https://data.sdss.org/sas/dr19/spectro/sdss/redux"
5254
case _:
5355
path = "https://data.sdss5.org/sas/sdsswork/bhm/boss/spectro/redux"
5456

0 commit comments

Comments
 (0)