Open RichardWaiteSTFC opened 1 year ago
Adding the Reported by User label after discussions on #36852
I could see where the problems was with issue number 2, but wasn't sure how to recreate.
For the first problem, when the model is set up, if the workspace is an MDHisto
, self.export_pixel_cut_to_workspace
is set to self.export_pixel_cut_to_workspace_md
(the same as if the we type is and MDEvent). here
self.export_pixel_cut_to_workspace_md
takes and uses bin_params
which are gathered via data_view.dimensions.get_bin_params()
here. get_bin_params()
returns none
in the case that the dimensions aren't binned, which is the case for MDHisto (I think?). So there is some undefined behaviour here, I might need @RichardWaiteSTFC to have a look and let me know what should be happening.
The actual error comes from _dimension_limits()
in the model where it claims bin_params
is an optional type, but there doesn't seem to be any guarding against it being none. In the previous function _roi_binmd_parameters()
I can see a bin_params is not None
check, so it looks like that possibility needs to be considered in _dimension_limits()
too.
@zjmorgan tagging you as you also flagged this issue up so you might want to be part of this discussion.
I could see where the problems was with issue number 2, but wasn't sure how to recreate.
For the first problem, when the model is set up, if the workspace is an
MDHisto
,self.export_pixel_cut_to_workspace
is set toself.export_pixel_cut_to_workspace_md
(the same as if the we type is and MDEvent). here
self.export_pixel_cut_to_workspace_md
takes and usesbin_params
which are gathered viadata_view.dimensions.get_bin_params()
here.get_bin_params()
returnsnone
in the case that the dimensions aren't binned, which is the case for MDHisto (I think?). So there is some undefined behaviour here, I might need @RichardWaiteSTFC to have a look and let me know what should be happening.The actual error comes from
_dimension_limits()
in the model where it claimsbin_params
is an optional type, but there doesn't seem to be any guarding against it being none. In the previous function_roi_binmd_parameters()
I can see abin_params is not None
check, so it looks like that possibility needs to be considered in_dimension_limits()
too.
I haven't had a chance to look in detail, but the root of the problem at least for (2) might be that you can't call BinMD
on an MDHisto - you have to use IntegrateMDHistoWorkspace
- with different type of binning arguments?
I could see where the problems was with issue number 2, but wasn't sure how to recreate. For the first problem, when the model is set up, if the workspace is an
MDHisto
,self.export_pixel_cut_to_workspace
is set toself.export_pixel_cut_to_workspace_md
(the same as if the we type is and MDEvent). hereself.export_pixel_cut_to_workspace_md
takes and usesbin_params
which are gathered viadata_view.dimensions.get_bin_params()
here.get_bin_params()
returnsnone
in the case that the dimensions aren't binned, which is the case for MDHisto (I think?). So there is some undefined behaviour here, I might need @RichardWaiteSTFC to have a look and let me know what should be happening. The actual error comes from_dimension_limits()
in the model where it claimsbin_params
is an optional type, but there doesn't seem to be any guarding against it being none. In the previous function_roi_binmd_parameters()
I can see abin_params is not None
check, so it looks like that possibility needs to be considered in_dimension_limits()
too.I haven't had a chance to look in detail, but the root of the problem at least for (2) might be that you can't call
BinMD
on an MDHisto - you have to useIntegrateMDHistoWorkspace
- with different type of binning arguments?
As Jonathan said, the get_bin_params
returns None
value. It returns None
because one of the dimensions doesn't support dynamic rebinning (calling multiple BinMD calls on the workspace) which its logic is defined here.
In this line get_bins_params
will return None because one of the dimensions will be Dimension
widget not a DimensionNonIntegrated
widget as only DimensionNonIntegrated
defines get_bins
. The Dimension is defined DimensionNonIntegrated
if can_rebin
(the value returned by can_support_dynamic_rebinning
) is True
as you see in this line
So the solution, possibly, is either we instruct the users to do something to convert all workspace dimensions into non-integrated dimensions, or we handle the bins parameters for the generic Dimension
.
The change has been introduced in #30328
First issue has been resolved in #37271
Describe the bug Found during manual testing #36061
Two bugs in the same area:
[x] When exporting ROI cuts in MDHisto workspace:
'NoneType' object is not subscriptable
(Resolved in #37271)[ ] When exporting line cut plots for MDHisto workspace:
SliceViewerModel.export_cuts_to_workspace_mdevent() missing 1 required positional argument: 'cut'
Happens whether original MDEvent workspace exists or not.
To Reproduce (1) Make the workspace
md_3D_histo
(2) Open
md_3D_histo
in sliceviewer (3) Export cuts from line plot and rectangular selection/ROI toolsFollow steps 3 c-f here https://developer.mantidproject.org/Testing/SliceViewer/SliceViewer.html#matrixworkspace
Expected behavior Would produce workspaces corresponding to the cuts
Screenshots
Platform/Version (please complete the following information):
Additional context