You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sqw/dnd functions smooth and smooth_units call smooth_dnd.
The argument parsing logic in this function means it's impossible to call with the resolution shape function without an error being raised:
if strcmp(shape,'resolution') && ~(ndim==2 && numel(width)==3)
error ('Smoothing option ''resolution'' only available for 2D data sets with three width parameters')
elseif ~(isa_size(width,[1,ndim],'double') || isa_size(width,[1,1],'double'))
error ('ERROR: argument ''width'' must be a scalar or vector with length equal to the dimensions of the dataset')
The first if requires that the data is 2d with 3 width parameters (for resolution), the second if requires that width is an array of size [1, 2], or scalar for all shape functions in the 2d case.
These are mutually exclusive requirements.
update CM:22/09/2023: confirmed that this issue continues. The test test_dnd_class/test_smooth::test_smooth_resolution_shape_arg fails due to this issue and is currently skipped. PR #1291 has been made to fix the need to replace the d2d call with a read_dnd call. With this fix the call to smooth_dnd_ (via d2d.smooth) fails as described above. smooth_dnd_ is a private function of @DnDBase and contains the above code for if strcmp(shape,'resolution') . As described above, it is called from smooth and other places. Note that the method declaration for smooth_dnd in SQWDnDBase.m (without the underscore) is not defined; only the private method with the underscore has an implementation.
For the elseif branch of the error detection above, this error is deliberately set off at L.126 of test_smooth.m in an AssertExceptionThrown. Otherwise the other tests in test_smooth, mostly hats with one gaussian, do not have either of these errors.
The failure caused by the problem described above occurs with shape=='resolution'. ndim==2 (it is a d2d) and numel(width)==3 (as is apparently required for resolution) so the first error does not occur. But as numel(width) is neither ==2 or ==1 the second error does. The problem described above is real.
My suspicion is that the second error should also be triggered if ~strcmp('resolution') (obviously there are better ways of packaging the if structure). At this point an expert on smooth and its arguments should have a look; I have assigned Toby and Alex and will @ them below.
The text was updated successfully, but these errors were encountered:
@abuts@tgperring Toby, Alex - I was charged to see if this problem still exists - it does. I have proposed a fix above, but need a smoothing expert to verify - could you both have a look please? thanks Chris
The sqw/dnd functions
smooth
andsmooth_units
callsmooth_dnd
.The argument parsing logic in this function means it's impossible to call with the
resolution
shape function without an error being raised:The first if requires that the data is 2d with 3 width parameters (for resolution), the second if requires that width is an array of size
[1, 2]
, or scalar for all shape functions in the 2d case.These are mutually exclusive requirements.
update CM:22/09/2023: confirmed that this issue continues. The test test_dnd_class/test_smooth::test_smooth_resolution_shape_arg fails due to this issue and is currently skipped. PR #1291 has been made to fix the need to replace the d2d call with a read_dnd call. With this fix the call to smooth_dnd_ (via d2d.smooth) fails as described above.
smooth_dnd_
is a private function of @DnDBase and contains the above code forif strcmp(shape,'resolution')
. As described above, it is called fromsmooth
and other places. Note that the method declaration forsmooth_dnd
inSQWDnDBase.m
(without the underscore) is not defined; only the private method with the underscore has an implementation.For the
elseif
branch of the error detection above, this error is deliberately set off at L.126 oftest_smooth.m
in an AssertExceptionThrown. Otherwise the other tests in test_smooth, mostly hats with one gaussian, do not have either of these errors.The failure caused by the problem described above occurs with shape=='resolution'. ndim==2 (it is a d2d) and numel(width)==3 (as is apparently required for resolution) so the first error does not occur. But as numel(width) is neither ==2 or ==1 the second error does. The problem described above is real.
My suspicion is that the second error should also be triggered if ~strcmp('resolution') (obviously there are better ways of packaging the if structure). At this point an expert on smooth and its arguments should have a look; I have assigned Toby and Alex and will @ them below.
The text was updated successfully, but these errors were encountered: