desihub / redrock

Redshift fitting for spectroperfectionism
BSD 3-Clause "New" or "Revised" License
21 stars 13 forks source link

full-redshift fitting with archetypes #275

Open moustakas opened 5 months ago

moustakas commented 5 months ago

@sbailey @abhi0395 can we use this ticket to flesh out what changes we would need to make to Redrock to support archetype-only fitting? In other words, at the moment I believe that archetypes can only be used to refine the redshifts found via other (PCA or NMF) means. However, it should be relatively straightforward to do the full-redshift fitting with archetypes.

The computation should be pretty fast because one only needs to algebraically compute the scale factor (after redshifting, resampling, and instrumental convolution) needed to match each template to the data. For a reasonable number of archetype templates (<10^3) the math should be ~instantaneous, especially on a GPU.

sbailey commented 5 months ago

One detail is that all prior archetype work on both BOSS and DESI has found it necessary to include Legendre nuisance terms, making the problem N>>1 small linear algebra solutions rather than just solving for a single scaling factor.

Current speed limiting factor is using the BVLS solver to keep archetype coefficients positive while allowing unbounded Legendre coefficients. This could be addressed with

moustakas commented 5 months ago

Thanks @sbailey. Nevertheless, it would be useful to be able to run in a super-simple mode with archetypes and no polynomials. Is this something that you or @abhi0395 could implement relatively easily or should I take a crack?

abhi0395 commented 5 months ago

Thanks @sbailey , @moustakas We can try running archetypes without polynomial terms for all redshifts, but we still need to make some surgeries to the existing code. But before that, it would be nice to have @dylanagreen julia implementation of bvls into redrock-archetype mode to see how much gain do we achieve in runtime.