Skip to content

Commit

Permalink
Minor bugfix on indent and commenting header to field conversion (unc…
Browse files Browse the repository at this point in the history
…lear bug)
  • Loading branch information
ivan-katkov committed May 27, 2024
1 parent c7af815 commit ea48133
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions python/valis/routes/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)],
Expand All @@ -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.")
Expand All @@ -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(),
Expand Down

0 comments on commit ea48133

Please sign in to comment.