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

Ha fitting for lowz objects #50

Closed edarragh closed 2 years ago

edarragh commented 2 years ago

A few objects at z < 0.03 with HALPHA_EW = 0 that appear to have strong Ha emission lines in the coadded spectra.

targetid, tileid, fiber 39633006721237481, 20884, 331 39632971702995257, 20738, 1696 39632976853601447, 399, 1608 39632976853601447, 20387, 2497

moustakas commented 2 years ago

Thanks for the report @edarragh!

Here is some QA output based on the healpix coadds https://data.desi.lbl.gov/desi/users/ioannis/lowz-secondary which for the record I generated with the following incantation:

fastspecfit-qa --fastspecfile /global/cfs/cdirs/desi/spectro/fastspecfit/everest/catalogs/fastspec-everest-main-bright.fits \
  --targetids 39633006721237481,39632971702995257 -o /global/cfs/cdirs/desi/users/ioannis/lowz-secondary

fastspecfit-qa --fastspecfile /global/cfs/cdirs/desi/spectro/fastspecfit/everest/catalogs/fastspec-everest-sv3-bright.fits \
  --targetids 39632976853601447 -o /global/cfs/cdirs/desi/users/ioannis/lowz-secondary

And here is a parsing of the Everest/FastSpecFit catalogs:

import fitsio
import numpy as np
from astropy.table import Table, vstack

f1 = '/global/cfs/cdirs/desi/spectro/fastspecfit/everest/catalogs/fastspec-everest-main-bright.fits'
f2 = '/global/cfs/cdirs/desi/spectro/fastspecfit/everest/catalogs/fastspec-everest-sv3-bright.fits'
I1 = np.where(np.isin(fitsio.read(f1, 'FASTSPEC', columns='TARGETID'), [39633006721237481, 39632971702995257]))[0]
I2 = np.where(np.isin(fitsio.read(f2, 'FASTSPEC', columns='TARGETID'), [39632976853601447]))[0]

cat = vstack((Table(fitsio.read(f1, rows=I1)), Table(fitsio.read(f2, rows=I2))))
cols = ['TARGETID'] + [col for col in cat.colnames if 'HALPHA' in col and not 'IVAR' in col]

cat[cols]
<Table length=3>
     TARGETID     HALPHA_AMP HALPHA_FLUX HALPHA_BOXFLUX HALPHA_VSHIFT HALPHA_SIGMA HALPHA_CONT HALPHA_EW HALPHA_FLUX_LIMIT HALPHA_EW_LIMIT HALPHA_CHI2 HALPHA_NPIX
      int64        float32     float32      float32        float32      float32      float32    float32       float32          float32       float32      int32
----------------- ---------- ----------- -------------- ------------- ------------ ----------- --------- ----------------- --------------- ----------- -----------
39633006721237481  25.718184   37.334297       46.09933     -3.116011    26.312714         0.0       0.0               0.0             0.0   3.8562257           4
39632971702995257  16.564077    22.74383      28.393354   -0.39629677    24.833889         0.0       0.0               0.0             0.0  0.49701104           4
39632976853601447  30.332623   43.505417       54.12332     3.9171119    25.934086         0.0       0.0               0.0             0.0    6.010347           4

You can see from this table and from the QA output that H-alpha is being fitted, although the reason the equivalent width isn't being estimated is because the lines are so narrow that I don't have enough pixels to estimate the local continuum (I use the line-width to select pixels which belong to the "local" continuum), and consequently the EW isn't computed.

I actually thought I had addressed this corner case during my last round of development and testing, but clearly my fix worked for some objects but not others. Here's the relevant bit of code for those that may be interested-- https://github.com/desihub/fastspecfit/blob/main/py/fastspecfit/emlines.py#L956-L978

Let's keep this ticket open and I'll use these objects when I start working on development for the Fuji release.

moustakas commented 2 years ago

I believe that this issue has been fixed in #69; please reopen if not. Also, this test sample is being worked on in https://github.com/moustakas/fastspecfit-projects/blob/main/lowz/fastspecfit-lowz with outputs going to https://data.desi.lbl.gov/desi/users/ioannis/fastspecfit/lowz/fujilupe/qa.