Skip to content

Commit

Permalink
add hips2fits fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcardoso committed Jan 29, 2025
1 parent e0cbf98 commit f52e29a
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions app/services/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { processResponse } from './utils'

const LEGACY_RGB = 'https://www.legacysurvey.org/viewer/cutout.jpg'
// const LEGACY_RGB = 'https://checker-melted-forsythia.glitch.me/legacy.jpg'
const LEGACY_RGB_2 = 'http://alasky.cds.unistra.fr/hips-image-services/hips2fits'
const SCS_URL = 'https://bittersweet-large-ticket.glitch.me/https://datalab.noirlab.edu/scs/ls_dr10/tractor'
const MAG_R = [0, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 100]
const CF_CIRC_LINEAR = [11.50, 11.50, 6.00, 5.90, 5.30, 4.50, 3.95, 3.45, 4.20, 4.80, 7.10, 5.60, 1.50, 1.50]
Expand Down Expand Up @@ -77,17 +78,37 @@ export class LegacyStamp implements IResourceFetch {
return await queryClient.fetchQuery({
queryKey: [this.ra, this.dec, this.size, pixscale, this.layer],
queryFn: () => processResponse(
() => axios.get(LEGACY_RGB, {
responseType: 'blob',
signal: semaphore.getSignal(),
params: {
ra: this.ra,
dec: this.dec,
size: this.size,
pixscale: pixscale,
layer: this.layer
async () => {
let resp
try {
resp = await axios.get(LEGACY_RGB, {
responseType: 'blob',
signal: semaphore.getSignal(),
params: {
ra: this.ra,
dec: this.dec,
size: this.size,
pixscale: pixscale,
layer: this.layer
}
})
} catch {
resp = await axios.get(LEGACY_RGB_2, {
responseType: 'blob',
signal: semaphore.getSignal(),
params: {
hips: 'CDS/P/DESI-Legacy-Surveys/DR10/color',
ra: this.ra,
dec: this.dec,
width: this.size,
height: this.size,
fov: (pixscale / 3600) * this.size,
format: 'png',
}
})
}
})
return resp
}
)
})
}
Expand Down

0 comments on commit f52e29a

Please sign in to comment.