desihub / fastspecfit

Fast spectral synthesis and emission-line fitting of DESI spectra.
https://fastspecfit.readthedocs.org
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

initial hooks to fit stacked spectra #113

Closed moustakas closed 1 year ago

moustakas commented 1 year ago

Working with @dirkscholte, this PR adds the option of fitting stacked spectra. The data model for stacked spectra still needs to be documented, but we have something basic working based on the tools (written by @biprateep and @dirkscholte) in desihub/desigal.specutils. (Writing out a proper "stacked" or average resolution matrix is still a work in progress which @dirkscholte is leading but which is independent of this PR.)

One example: to do the fitting do:

stackfit $DESI_ROOT/science/gqp/fastspecfit_stacks/test_ivar_stack_mstar_z_bins_3.fits \
  -o stackfit.fits --ntargets 2 --mp 2

And to generate the QA do:

fastspecfit-qa stackfit.fits --redrockfiles $DESI_ROOT/science/gqp/fastspecfit_stacks/test_ivar_stack_mstar_z_bins_3.fits \
  -o desi-users/ioannis/tmp
Screenshot 2023-03-30 at 5 50 53 PM

(Note that the fit is poor in the red and the blue because we're using the identity matrix as the resolution matrix at the moment.)

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 4569298872

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
py/fastspecfit/continuum.py 4 5 80.0%
py/fastspecfit/io.py 38 223 17.04%
py/fastspecfit/fastspecfit.py 13 334 3.89%
<!-- Total: 57 564 10.11% -->
Files with Coverage Reduction New Missed Lines %
py/fastspecfit/io.py 1 54.25%
py/fastspecfit/fastspecfit.py 2 13.17%
<!-- Total: 3 -->
Totals Coverage Status
Change from base Build 4492796939: -2.6%
Covered Lines: 2227
Relevant Lines: 4404

💛 - Coveralls