@@ -25,7 +25,7 @@ class CircleShape(Ellipse):
25
25
type = 'circle'
26
26
27
27
def __str__ (self ):
28
- return "Circle(%i)" % self .width
28
+ return f "Circle({ self .height } )"
29
29
30
30
def __init__ (self , centre , diameter , ax , aspect , ** kwargs ):
31
31
"""Create an circle on top of an image with a given aspect ratio.
@@ -45,10 +45,9 @@ def __init__(self, centre, diameter, ax, aspect, **kwargs):
45
45
Aspect ratio (width / height)
46
46
"""
47
47
48
- a = diameter * aspect
49
- b = diameter
48
+ width = diameter * aspect
50
49
self .aspect = aspect
51
- super ().__init__ (centre [::- 1 ], a , b ,
50
+ super ().__init__ (centre [::- 1 ], width , diameter ,
52
51
facecolor = 'none' , edgecolor = 'r' , lw = 1 )
53
52
54
53
def set_size (self , diameter ):
@@ -66,14 +65,14 @@ def get_angle(self):
66
65
return 0
67
66
68
67
def get_size (self ):
69
- return self .width
68
+ return self .height
70
69
71
70
class SquareShape (Rectangle ):
72
71
"""Circular Shape that supporting different aspect ratios."""
73
72
type = 'square'
74
73
75
74
def __str__ (self ):
76
- return "Square(%i)" % self .get_width ()
75
+ return f "Square({ self .get_height () } )"
77
76
78
77
def __init__ (self , centre , size , ax , aspect , angle = 0 ):
79
78
"""Create an square on top of an image with a given aspect ratio.
@@ -127,7 +126,7 @@ def set_size(self, size):
127
126
self .stale = True
128
127
129
128
def get_size (self ):
130
- return self .get_width ()
129
+ return self .get_height ()
131
130
132
131
def set_angle (self , angle ):
133
132
"""Rotate the square by a given angle."""
@@ -145,7 +144,7 @@ class MainWidget:
145
144
"""Ipython Widget version of the Calibration Class."""
146
145
147
146
def __init__ (self , raw_data , geometry = None , det = 'AGIPD' , vmin = None ,
148
- vmax = None , figsize = None , bg = None , aspect = 1 , frontview = False ,
147
+ vmax = None , figsize = None , bg = None , aspect = None , frontview = False ,
149
148
** kwargs ):
150
149
"""Display detector data and arrange panels.
151
150
@@ -188,7 +187,6 @@ def __init__(self, raw_data, geometry=None, det='AGIPD', vmin=None,
188
187
self .data = raw_data
189
188
Defaults .check_detector (det )
190
189
self .im = None
191
- self .aspect = aspect
192
190
self .vmin = vmin or np .nanmin (self .data )
193
191
self .vmax = vmax or np .nanmax (self .data )
194
192
self .raw_data = np .clip (raw_data , self .vmin , self .vmax )
@@ -207,6 +205,7 @@ def __init__(self, raw_data, geometry=None, det='AGIPD', vmin=None,
207
205
self .geom = read_geometry (det , geometry )
208
206
else :
209
207
self .geom = GeometryAssembler .wrap_extra_geom (geometry )
208
+ self .aspect = aspect or self .geom .pixel_aspect_ratio
210
209
211
210
data , _ = self .geom .position_all_modules (self .raw_data )
212
211
# Create a canvas
0 commit comments