DDFacet crashes when running in --Output-Mode=Predict with --CF-wmax set to non-zero.
Traceback
File "ClassVisServer.py", line 951, in _loadWeights_handler
uvmax_wavelengths = abs(uv[~rowflags,:]).max() * msfreqs.max() / _cc
TypeError: bad operand type for unary ~: 'NoneType'
Root cause
The bug is a chain of steps:
- Predict-only mode triggers
IgnoreWeights(), setting _ignore_vis_weights=True (this also requires --CF-wmax to be non-zero, as the code explicitly skips IgnoreWeights() when wmax==0)
- This causes
wmax_only=True to be passed to _loadWeights_handler
- Which passes
uvw_only=True to readWeights
readWeights has already computed rowflags from the FLAG column, but discards it in the uvw_only early return:
if uvw_only:
return uvw, None, None, None # rowflags is thrown away
- Back in
_loadWeights_handler, uvw is valid so the if uvw is None guard is not triggered, and the code crashes on ~rowflags
This affects any dataset with at least one unflagged row, i.e. essentially all real datasets running in Predict mode.
potential Fix?
One line change in readWeights:
if uvw_only:
return uvw, None, rowflags, None
To reproduce
Any DDF Predict run with non-zero --CF-wmax, e.g.:
DDFacet crashes when running in
--Output-Mode=Predictwith--CF-wmaxset to non-zero.Traceback
Root cause
The bug is a chain of steps:
IgnoreWeights(), setting_ignore_vis_weights=True(this also requires--CF-wmaxto be non-zero, as the code explicitly skipsIgnoreWeights()whenwmax==0)wmax_only=Trueto be passed to_loadWeights_handleruvw_only=TruetoreadWeightsreadWeightshas already computedrowflagsfrom the FLAG column, but discards it in theuvw_onlyearly return:_loadWeights_handler,uvwis valid so theif uvw is Noneguard is not triggered, and the code crashes on~rowflagsThis affects any dataset with at least one unflagged row, i.e. essentially all real datasets running in Predict mode.
potential Fix?
One line change in
readWeights:To reproduce
Any DDF Predict run with non-zero
--CF-wmax, e.g.: