Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fgcmLoadReferenceCatalog doesn't work for single band data #134

Open
AstroJacobLi opened this issue Dec 25, 2024 · 0 comments
Open

fgcmLoadReferenceCatalog doesn't work for single band data #134

AstroJacobLi opened this issue Dec 25, 2024 · 0 comments

Comments

@AstroJacobLi
Copy link

Hello! I'm trying to reduce some of the HSC data using the LSST Science Pipelines, using $DRP_PIPE_DIR/pipelines/HSC/DRP-RC2.yaml. Everything went smoothly, except for the FGCM part in Step 2cde:

WARNING 2024-12-25T00:03:47.340-05:00 py.warnings (fgcmBuildStarsTable:{instrument: 'HSC'})(warnings.py:109) - /projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/meas_algorithms/g592df8196b+7381939c19/python/lsst/meas/algorithms/sourceSelector.py:349: RuntimeWarning: divide by zero encountered in true_divide
  signalToNoise = flux/err

INFO 2024-12-25T00:03:47.341-05:00 lsst.fgcmBuildStarsTable.fgcmLoadReferenceCatalog.referenceSelector (fgcmBuildStarsTable:{instrument: 'HSC'})(sourceSelector.py:666) - Selected 18430/42177 references
WARNING 2024-12-25T00:03:47.345-05:00 py.warnings (fgcmBuildStarsTable:{instrument: 'HSC'})(warnings.py:109) - /projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/fgcmcal/g2ffcdf413f+0ec844bbf9/python/lsst/fgcmcal/fgcmLoadReferenceCatalog.py:213: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  fgcmRefCat = np.zeros(np.sum(selected), dtype=[('ra', 'f8'),

ERROR 2024-12-25T00:03:47.346-05:00 lsst.ctrl.mpexec.singleQuantumExecutor (fgcmBuildStarsTable:{instrument: 'HSC'})(singleQuantumExecutor.py:279) - Execution of task 'fgcmBuildStarsTable' on quantum {instrument: 'HSC'} failed. Exception IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
ERROR 2024-12-25T00:03:47.373-05:00 lsst.ctrl.mpexec.mpGraphExecutor ()(mpGraphExecutor.py:492) - Task <TaskDef(lsst.fgcmcal.fgcmBuildStarsTable.FgcmBuildStarsTableTask, label=fgcmBuildStarsTable) dataId={instrument: 'HSC'}> failed; processing will continue for remaining tasks.
Traceback (most recent call last):
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/ctrl_mpexec/g1d38f3a6c4+57975668de/python/lsst/ctrl/mpexec/mpGraphExecutor.py", line 462, in _executeQuantaInProcess
    self.quantumExecutor.execute(qnode.taskDef, qnode.quantum)
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/ctrl_mpexec/g1d38f3a6c4+57975668de/python/lsst/ctrl/mpexec/singleQuantumExecutor.py", line 152, in execute
    result = self._execute(taskDef, quantum)
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/ctrl_mpexec/g1d38f3a6c4+57975668de/python/lsst/ctrl/mpexec/singleQuantumExecutor.py", line 277, in _execute
    self.runQuantum(runTask, quantum, taskDef, limited_butler)
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/ctrl_mpexec/g1d38f3a6c4+57975668de/python/lsst/ctrl/mpexec/singleQuantumExecutor.py", line 559, in runQuantum
    task.runQuantum(butlerQC, inputRefs, outputRefs)
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/fgcmcal/g2ffcdf413f+0ec844bbf9/python/lsst/fgcmcal/fgcmBuildStarsTable.py", line 301, in runQuantum
    fgcmStarIdCat, fgcmStarIndicesCat, fgcmRefCat = self.fgcmMatchStars(visitCat,
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/fgcmcal/g2ffcdf413f+0ec844bbf9/python/lsst/fgcmcal/fgcmBuildStarsBase.py", line 495, in fgcmMatchStars
    fgcmMakeStars.makeReferenceMatches(self.fgcmLoadReferenceCatalog)
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/fgcm/g322c47f462/lib/python/fgcm/fgcmMakeStars.py", line 845, in makeReferenceMatches
    refCat = refLoader.getFgcmReferenceStarsSkyCircle(meanRA, meanDec, rad,
  File "/projects/HSC/LSST/stack_20220527/conda/envs/lsst-scipipe-5.1.0/share/eups/Linux64/fgcmcal/g2ffcdf413f+0ec844bbf9/python/lsst/fgcmcal/fgcmLoadReferenceCatalog.py", line 232, in getFgcmReferenceStarsSkyCircle
    fgcmRefCat['refMag'][:, :] = 99.0
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

I think the reason is very simple -- I only have one band (HSC-R2), and the following code doesn't work for 1-band situation, because len(filterList)=1:

('refMag', 'f4', len(filterList)),
.

Changing it to the following would fix the issue:

fgcmRefCat = np.zeros(np.sum(selected), dtype=[('ra', 'f8'),
                                                ('dec', 'f8'),
                                                ('refMag', 'f4', [len(filterList)]),
                                                ('refMagErr', 'f4', [len(filterList)])])

Maybe I shouldn't run FGCM for single-band data. But please let me know if you have any suggestions on bypassing this error!

Thanks!

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

No branches or pull requests

1 participant