@@ -408,13 +408,18 @@ def update_realspace_detector(self):
408
408
)
409
409
assert detector_shape in ["Point" , "Rectangular" ], detector_shape
410
410
411
+ main_pen = {"color" : "g" , "width" : 6 }
412
+ handle_pen = {"color" : "r" , "width" : 9 }
413
+ hover_pen = {"color" : "c" , "width" : 6 }
414
+ hover_handle = {"color" : "c" , "width" : 9 }
415
+
411
416
if self .datacube is None :
412
417
x0 , y0 = 0 , 0
413
418
xr , yr = 4 , 4
414
419
else :
415
420
x , y = self .datacube .data .shape [2 :]
416
- x0 , y0 = x // 2 , y // 2
417
- xr , yr = x / 10 , y / 10
421
+ y0 , x0 = x // 2 , y // 2
422
+ xr , yr = ( np . minimum ( x , y ) / 10 ,) * 2
418
423
419
424
# Remove existing detector
420
425
if hasattr (self , "real_space_point_selector" ):
@@ -424,19 +429,27 @@ def update_realspace_detector(self):
424
429
self .real_space_widget .view .scene ().removeItem (self .real_space_rect_selector )
425
430
self .real_space_rect_selector = None
426
431
427
- # Rectangular detector
432
+ # Point detector
428
433
if detector_shape == "Point" :
429
434
self .real_space_point_selector = pg_point_roi (
430
435
self .real_space_widget .getView (),
431
436
center = (x0 - 0.5 , y0 - 0.5 ),
437
+ pen = main_pen ,
438
+ hoverPen = hover_pen ,
432
439
)
433
440
self .real_space_point_selector .sigRegionChanged .connect (
434
441
partial (self .update_diffraction_space_view , False )
435
442
)
436
443
444
+ # Rectangular detector
437
445
elif detector_shape == "Rectangular" :
438
446
self .real_space_rect_selector = pg .RectROI (
439
- [int (x0 - xr / 2 ), int (y0 - yr / 2 )], [int (xr ), int (yr )], pen = (3 , 9 )
447
+ [int (x0 - xr / 2 ), int (y0 - yr / 2 )],
448
+ [int (xr ), int (yr )],
449
+ pen = main_pen ,
450
+ handlePen = handle_pen ,
451
+ hoverPen = hover_pen ,
452
+ handleHoverPen = hover_handle ,
440
453
)
441
454
self .real_space_widget .getView ().addItem (self .real_space_rect_selector )
442
455
self .real_space_rect_selector .sigRegionChangeFinished .connect (
@@ -465,8 +478,8 @@ def update_diffraction_detector(self):
465
478
xr , yr = 4 , 4
466
479
else :
467
480
x , y = self .datacube .data .shape [2 :]
468
- x0 , y0 = x // 2 , y // 2
469
- xr , yr = x / 10 , y / 10
481
+ y0 , x0 = x // 2 , y // 2
482
+ xr , yr = ( np . minimum ( x , y ) / 10 ,) * 2
470
483
471
484
# Remove existing detector
472
485
if hasattr (self , "virtual_detector_point" ):
0 commit comments