diff --git a/python/valis/routes/target.py b/python/valis/routes/target.py index 560b0a8..27fdb1c 100644 --- a/python/valis/routes/target.py +++ b/python/valis/routes/target.py @@ -2,13 +2,16 @@ import math import re +import os import httpx import orjson from typing import Tuple, List, Union, Optional, Annotated from pydantic import field_validator, model_validator, BaseModel, Field, model_serializer from fastapi import APIRouter, HTTPException, Query, Path, Depends from fastapi_restful.cbv import cbv +import numpy as np import astropy.units as u +from astropy.io import fits from astropy.coordinates import SkyCoord from astroquery.simbad import Simbad @@ -204,8 +207,8 @@ async def get_pipeline(self, sdss_id: int = Path(title="The sdss_id of the targe return get_target_pipeline(sdss_id, self.release, pipe) -@router.get('/spectrum_lvm_fiber/{tile_id}/{mjd}/{exposure}/{fiberid}', - summary='Experimental endpoint to extract LVM fiber spectrum') + @router.get('/spectrum_lvm_fiber/{tile_id}/{mjd}/{exposure}/{fiberid}', + summary='Experimental endpoint to extract LVM fiber spectrum') async def get_spectrum_lvm_fiber(self, tile_id: Annotated[int, Path(description="The tile_id of the LVM dither", example=1028790)], mjd: Annotated[int, Path(desciption='The MJD of the observations', example=60314)], @@ -224,10 +227,6 @@ async def get_spectrum_lvm_fiber(self, LVM_ROOT = f"/root/sas/sdsswork/lvm/spectro/redux/master/" file = LVM_ROOT + filename - import os - from astropy.io import fits - import numpy as np - # Check that file exists and return exception if not if not os.path.exists(file): raise HTTPException(status_code=404, detail=f"File {filename} does not exist.") @@ -248,7 +247,6 @@ async def get_spectrum_lvm_fiber(self, sky = hdul['SKY'].data[fiberid_in_stack, :] return dict(filename=filename, - header=dict(hdr), wave=wave.tolist(), flux=flux.tolist(), error=error.tolist(),