desihub / desihub/LSS

no WISE_VAR_QSO secondary targets in SV2

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
22
Forks
39
PR merge metrics
No merged PRs in 30d

Description

[This line](https://github.com/desihub/LSS/blob/main/py/LSS/qso_cat_utils.py#L293) and [this line](https://github.com/desihub/LSS/blob/main/py/LSS/qso_cat_utils.py#L300) in `qso_cat_utils` will crash because there were no `WISE_VAR_QSO` secondary targets in SV2.

```
from desitarget.sv2.sv2_targetmask import scnd_mask as sv2_scnd_mask
sv2_scnd_mask.mask('WISE_VAR_QSO')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[2], line 1
----> 1 sv2_scnd_mask.mask('WISE_VAR_QSO')

File /global/common/software/desi/perlmutter/desiconda/20240425-2.2.0/code/desiutil/main/py/desiutil/bitmask.py:215, in BitMask.mask(self, name_or_num)
213 mask = 0
214 for name in name_or_num.split('|'):
--> 215 mask |= self._bits[name].mask
216 return mask

KeyError: 'WISE_VAR_QSO'
```

It's a low-priority fix, but I tripped on it because I copied the logic used here into FastSpecFit in https://github.com/desihub/fastspecfit/pull/201.

FWIW, the fix I propose is something like:
```
if 'WISE_VAR_QSO' in sv2_scnd_mask.names():
# do stuff
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.