@@ -70,11 +70,11 @@ def __init__(self, ws):
70
70
if WorkspaceInfo .get_ws_type (self ._get_ws ()) == WS_TYPE .MDE :
71
71
self .export_roi_to_workspace = self .export_roi_to_workspace_mdevent
72
72
self .export_cuts_to_workspace = self .export_cuts_to_workspace_mdevent
73
- self .export_pixel_cut_to_workspace = self .export_pixel_cut_to_workspace_md
73
+ self .export_pixel_cut_to_workspace = self .export_pixel_cut_to_workspace_mdevent
74
74
elif ws_type == WS_TYPE .MDH :
75
75
self .export_roi_to_workspace = self .export_roi_to_workspace_mdhisto
76
76
self .export_cuts_to_workspace = self .export_cuts_to_workspace_mdhisto
77
- self .export_pixel_cut_to_workspace = self .export_pixel_cut_to_workspace_md
77
+ self .export_pixel_cut_to_workspace = self .export_pixel_cut_to_workspace_mdhisto
78
78
else :
79
79
self .export_roi_to_workspace = self .export_roi_to_workspace_matrix
80
80
self .export_cuts_to_workspace = self .export_cuts_to_workspace_matrix
@@ -269,6 +269,7 @@ def export_cuts_to_workspace_mdevent(
269
269
:param limits: An optional ND sequence containing limits for plotting dimensions. If
270
270
not provided the full extent of each dimension is used
271
271
:param transpose: If true then the limits are transposed w.r.t to the data
272
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
272
273
:param cut: A string denoting which type to export. Options=s,c,x,y.
273
274
"""
274
275
workspace = self ._get_ws ()
@@ -356,6 +357,7 @@ def export_roi_to_workspace_mdhisto(
356
357
:param limits: An optional ND sequence containing limits for plotting dimensions. If
357
358
not provided the full extent of each dimension is used
358
359
:param transpose: If true then the limits are transposed w.r.t to the data
360
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
359
361
"""
360
362
workspace = self ._get_ws ()
361
363
dim_limits = _dimension_limits (workspace , slicepoint , bin_params , dimension_indices , limits )
@@ -391,6 +393,7 @@ def export_cuts_to_workspace_mdhisto(
391
393
:param limits: An optional ND sequence containing limits for plotting dimensions. If
392
394
not provided the full extent of each dimension is used
393
395
:param transpose: If true then the limits are transposed w.r.t to the data
396
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
394
397
:param cut: A string denoting which type to export. Options=c,x,y.
395
398
"""
396
399
workspace = self ._get_ws ()
@@ -426,6 +429,7 @@ def export_cuts_to_workspace_matrix(
426
429
:param limits: An optional ND sequence containing limits for plotting dimensions. If
427
430
not provided the full extent of each dimension is used
428
431
:param transpose: If true then the limits are transposed .w.r.t. the data
432
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
429
433
:param cut: A string denoting which cut to export. Options=c,x,y.
430
434
"""
431
435
workspace = self ._get_ws ()
@@ -452,35 +456,65 @@ def export_roi_to_workspace_matrix(self, slicepoint, bin_params, limits: tuple,
452
456
:param limits: An ND sequence containing limits for plotting dimensions. If
453
457
not provided the full extent of each dimension is used
454
458
:param transpose: If true then the limits are transposed .w.r.t. the data
459
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
455
460
"""
456
461
if transpose :
457
462
# swap back to model order
458
463
limits = limits [1 ], limits [0 ]
459
464
extract_roi_matrix (self ._get_ws (), * limits [0 ], * limits [1 ], transpose , self ._roi_name )
460
465
return f"ROI created: { self ._roi_name } "
461
466
462
- def export_pixel_cut_to_workspace_md (self , slicepoint , bin_params , pos : tuple , transpose : bool , axis : str ):
467
+ def export_pixel_cut_to_workspace_mdhisto (
468
+ self , slicepoint , bin_params , pos : tuple , transpose : bool , dimension_indices : Sequence [int ], axis : str
469
+ ):
463
470
"""
464
471
Export a single row/column as a workspace. Signature matches other export functions
465
472
slicepoint, bin_params are unused
466
473
:param pos: A 2-tuple containing the position of the pixel whose row/column should be exported
467
474
:param transpose: If true then the limits are transposed .w.r.t. the data
475
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
468
476
:param axis: A string 'x' or 'y' identifying the axis to cut along
469
477
"""
470
478
# Form single pixel limits for a cut
471
479
xindex , yindex = WorkspaceInfo .display_indices (slicepoint , transpose )
472
480
workspace = self ._get_ws ()
473
481
deltax , deltay = workspace .getDimension (xindex ).getBinWidth (), workspace .getDimension (yindex ).getBinWidth ()
474
482
xpos , ypos = pos
483
+ if transpose :
484
+ xpos , ypos = ypos , xpos
475
485
limits = (xpos - 0.5 * deltax , xpos + 0.5 * deltax ), (ypos - 0.5 * deltay , ypos + 0.5 * deltay )
476
- return self .export_cuts_to_workspace_mdevent (slicepoint , bin_params , limits , transpose , axis )
486
+ return self .export_cuts_to_workspace_mdhisto (slicepoint , bin_params , limits , transpose , dimension_indices , axis )
477
487
478
- def export_pixel_cut_to_workspace_matrix (self , slicepoint , bin_params , pos : tuple , transpose : bool , axis : str ):
488
+ def export_pixel_cut_to_workspace_mdevent (
489
+ self , slicepoint , bin_params , pos : tuple , transpose : bool , dimension_indices : Sequence [int ], axis : str
490
+ ):
479
491
"""
480
492
Export a single row/column as a workspace. Signature matches other export functions
481
493
slicepoint, bin_params are unused
482
494
:param pos: A 2-tuple containing the position of the pixel whose row/column should be exported
483
495
:param transpose: If true then the limits are transposed .w.r.t. the data
496
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
497
+ :param axis: A string 'x' or 'y' identifying the axis to cut along
498
+ """
499
+ # Form single pixel limits for a cut
500
+ xindex , yindex = WorkspaceInfo .display_indices (slicepoint , transpose )
501
+ workspace = self ._get_ws ()
502
+ deltax , deltay = workspace .getDimension (xindex ).getBinWidth (), workspace .getDimension (yindex ).getBinWidth ()
503
+ xpos , ypos = pos
504
+ if transpose :
505
+ xpos , ypos = ypos , xpos
506
+ limits = (xpos - 0.5 * deltax , xpos + 0.5 * deltax ), (ypos - 0.5 * deltay , ypos + 0.5 * deltay )
507
+ return self .export_cuts_to_workspace_mdevent (slicepoint , bin_params , limits , transpose , dimension_indices , axis )
508
+
509
+ def export_pixel_cut_to_workspace_matrix (
510
+ self , slicepoint , bin_params , pos : tuple , transpose : bool , dimension_indices : Sequence [int ], axis : str
511
+ ):
512
+ """
513
+ Export a single row/column as a workspace. Signature matches other export functions
514
+ slicepoint, bin_params are unused
515
+ :param pos: A 2-tuple containing the position of the pixel whose row/column should be exported
516
+ :param transpose: If true then the limits are transposed .w.r.t. the data
517
+ :param dimension_indices: A list where the value (None, 0, or 1) at index i denotes the index of the axis
484
518
:param axis: A string 'x' or 'y' identifying the axis to cut along
485
519
"""
486
520
workspace = self ._get_ws ()
0 commit comments