Skip to content

WIP: Add host galaxy spectrum download feature#437

Draft
dhvanildesai wants to merge 2 commits into
scimma:mainfrom
dhvanildesai:dhvanil-spectra
Draft

WIP: Add host galaxy spectrum download feature#437
dhvanildesai wants to merge 2 commits into
scimma:mainfrom
dhvanildesai:dhvanil-spectra

Conversation

@dhvanildesai

@dhvanildesai dhvanildesai commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Resolves #432

Draft PR — not ready for merge. Opening for design feedback, especially on workflow placement and model structure.

Summary

Adds host galaxy spectrum download functionality to the Blast pipeline. Archival spectra are fetched from SPARCL (DESI-DR1, SDSS-DR17, BOSS-DR17) with a NED fallback, stored as FITS files via a new HostSpectrum model. The downstream goal is to feed these spectra into STARLIGHT for stellar population fitting (something like HostSpectrumFitting).

Changes

New model: HostSpectrum

  • Stores one spectrum per host galaxy as a FITS file in ObjectStore
  • Linked to Host via ForeignKey
  • Tracks source (DESI/SDSS/BOSS/NED), retrieval status, and other metadata

New pipeline: fetch_host_spectrum() (app/host/host_spectrum.py)

  • Queries SPARCL with a unified interface across DESI-DR1, SDSS-DR17, BOSS-DR17 in priority order
  • Falls back to NED if SPARCL returns no results

New task: host_spectrum_download

  • Wired into the main workflow after host_information and alongside mwebv_host, global_aperture_construction, local_aperture_photometry

Workflow placement (feedback please)

group(
    mwebv_host.si(transient_name),
    host_spectrum_download.si(transient_name),   # <-- placed here
    chain(
        global_aperture_construction.si(transient_name),
        ...
    ),
    chain(
        local_aperture_photometry.si(transient_name),
        ...
    ),
),

Not sure if this is the right place in the chain — flagging for review.

Bug Fix

TaskLock name mismatch in query_sdss() (app/host/host_utils.py)

The SDSS query lock was being acquired under one name and released under a different one.

  • Before: TaskLock.objects.release_lock('sdss_query') (lowercase)
  • After: TaskLock.objects.release_lock('SDSS_query') (matches acquire)

Next steps for me

@djones1040

Copy link
Copy Markdown
Collaborator

A couple additional to-do things we discussed today:
-> test NED download and FITS formatting. Ideally would be consistent w/ SPARCL format when saved.
-> place in workflow after host information
-> consider adding a "location" entry in the table indicating whether the spectrum is at the host center or the SN location (otherwise this could be added in the message field perhaps, with RA/dec info also)

And future feature requests to enable spectra in blast will include:
-> spectra downloadable via the API
-> allow users to upload custom spectra in some format
-> add spectral plotting, include PNG generation in the workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding host spectra download in the transient workflow

2 participants