[PIPE2D-1056] fitPfsFluxReference.py: type mismatch caused by 32bit mask Created: 01/Jul/22 Updated: 07/Jul/22 Resolved: 04/Jul/22 |
|
| Status: | Done |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | sogo.mineo | Assignee: | sogo.mineo |
| Resolution: | Done | Votes: | 0 |
| Labels: | flux-calibration | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | flux calibration |
| Reviewers: | price |
| Description |
|
When PfsMerged with 32bit mask is input to fitPfsFluxReference.py, the following exception is raised, because 64bit integer cannot be shortened to the 32bit mask. Traceback (most recent call last): File "/lsst_stack/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-3.0.0/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/lsst_stack/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-3.0.0/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar return list(map(*args)) File "/lsst_stack/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/pipe_base/g590c34a36e+5da9528084/python/lsst/pipe/base/cmdLineTask.py", line 433, in __call__ result = self.runTask(task, dataRef, kwargs) File "/lsst_stack/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/pipe_base/g590c34a36e+5da9528084/python/lsst/pipe/base/cmdLineTask.py", line 504, in runTask return task.runDataRef(dataRef, **kwargs) File "/pfs_pipeline/drp_stella/python/pfs/drp/stella/fitPfsFluxReference.py", line 146, in runDataRef reference = self.run(pfsConfig, merged, mergedLsf) File "/pfs_pipeline/drp_stella/python/pfs/drp/stella/fitPfsFluxReference.py", line 247, in run likelihoods = self.fitModelsToSpectra( File "/pfs_pipeline/drp_stella/python/pfs/drp/stella/fitPfsFluxReference.py", line 465, in fitModelsToSpectra obsSpectra = self.maskUninterestingRegions(obsSpectra) File "/pfs_pipeline/drp_stella/python/pfs/drp/stella/fitPfsFluxReference.py", line 735, in maskUninterestingRegions spectra.mask[...] |= np.where( TypeError: ufunc 'bitwise_or' output (typecode 'l') could not be coerced to provided output parameter (typecode 'I') according to the casting rule ''same_kind'' |
| Comments |
| Comment by sogo.mineo [ 01/Jul/22 ] |
|
Could you review this PR? |
| Comment by price [ 02/Jul/22 ] |
|
Changes look fine, but I'm concerned that we're using 64-bit masks somewhere. Everything should be 32-bit, I thought. |
| Comment by sogo.mineo [ 04/Jul/22 ] |
|
One of the origins of 64bit integers is ii at pfs/datamodel/masks.py line 61. Because ii is python's integer, value at line 63 is python's integer. self.flags[name] at line 67 and 2**self.flags[name] at line 35 are also python's integer. Therefore MaskHelper.add() returns python's integer. Because I had written "np.where(condition, 0, spectra.flags.add("EDGE"))," the array returned by this np.where had been of np.int64 type. This is why I changed np,where(...) to np,where(...).astype(lhs.dtype) |
| Comment by sogo.mineo [ 04/Jul/22 ] |
|
Merged to master. Thanks for your review. |