Changeset 83f4445 in sasview for guiframe/local_perspectives
- Timestamp:
- Jun 2, 2010 9:58:41 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d955bf19
- Parents:
- 6c79243
- Location:
- guiframe/local_perspectives/plotting
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/AnnulusSlicer.py
raef2cf2 r83f4445 16 16 class AnnulusInteractor(_BaseInteractor): 17 17 """ 18 19 20 21 18 Select an annulus through a 2D plot. 19 This interactor is used to average 2D data with the region 20 defined by 2 radius. 21 this class is defined by 2 Ringinterators. 22 22 """ 23 23 def __init__(self,base,axes,color='black', zorder=3): … … 54 54 self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 55 55 56 57 58 56 def _onEVT_SLICER_PARS(self, event): 59 57 """ 60 receive an event containing parameters values to reset the slicer 61 @param event: event of type SlicerParameterEvent with params as 58 receive an event containing parameters values to reset the slicer 59 60 :param event: event of type SlicerParameterEvent with params as 62 61 attribute 62 63 63 """ 64 64 wx.PostEvent(self.base, StatusEvent(status="AnnulusSlicer._onEVT_SLICER_PARS")) … … 70 70 def set_layer(self, n): 71 71 """ 72 Allow adding plot to the same panel 73 @param n: the number of layer 72 Allow adding plot to the same panel 73 74 :param n: the number of layer 75 74 76 """ 75 77 self.layernum = n … … 78 80 def clear(self): 79 81 """ 80 82 Clear the slicer and all connected events related to this slicer 81 83 """ 82 84 self.clear_markers() … … 86 88 self.base.Unbind(EVT_SLICER_PARS) 87 89 88 89 90 def update(self): 90 91 """ 91 92 92 Respond to changes in the model by recalculating the profiles and 93 resetting the widgets. 93 94 """ 94 95 # Update locations … … 96 97 self.outer_circle.update() 97 98 98 99 99 def save(self, ev): 100 100 """ 101 102 101 Remember the roughness for this layer and the next so that we 102 can restore on Esc. 103 103 """ 104 104 self.base.freeze_axes() … … 108 108 def _post_data(self,nbins=None): 109 109 """ 110 Uses annulus parameters to plot averaged data into 1D data. 111 @param nbins: the number of points to plot 110 Uses annulus parameters to plot averaged data into 1D data. 111 112 :param nbins: the number of points to plot 113 112 114 """ 113 115 #Data to average … … 165 167 title="AnnulusPhi" )) 166 168 167 168 169 def moveend(self, ev): 169 170 """ 170 171 172 173 171 Called when any dragging motion ends. 172 Post an event (type =SlicerParameterEvent) 173 to plotter 2D with a copy slicer parameters 174 Call _post_data method 174 175 """ 175 176 self.base.thaw_axes() … … 200 201 def get_params(self): 201 202 """ 202 Store a copy of values of parameters of the slicer into a dictionary. 203 @return params: the dictionary created 203 Store a copy of values of parameters of the slicer into a dictionary. 204 205 :return params: the dictionary created 206 204 207 """ 205 208 params = {} … … 211 214 def set_params(self, params): 212 215 """ 213 Receive a dictionary and reset the slicer with values contained 214 in the values of the dictionary. 215 @param params: a dictionary containing name of slicer parameters and 216 Receive a dictionary and reset the slicer with values contained 217 in the values of the dictionary. 218 219 :param params: a dictionary containing name of slicer parameters and 216 220 values the user assigned to the slicer. 221 217 222 """ 218 223 inner = math.fabs(params["inner_radius"] ) … … 226 231 227 232 def freeze_axes(self): 233 """ 234 """ 228 235 self.base.freeze_axes() 229 236 230 237 def thaw_axes(self): 238 """ 239 """ 231 240 self.base.thaw_axes() 232 241 233 242 def draw(self): 243 """ 244 """ 234 245 self.base.draw() 235 246 … … 237 248 class RingInteractor(_BaseInteractor): 238 249 """ 239 Draw a ring Given a radius 240 @param: the color of the line that defined the ring 241 @param r: the radius of the ring 242 @param sign: the direction of motion the the marker 250 Draw a ring Given a radius 243 251 """ 244 252 def __init__(self,base,axes,color='black', zorder=5, r=1.0,sign=1): 245 253 """ 254 :param: the color of the line that defined the ring 255 :param r: the radius of the ring 256 :param sign: the direction of motion the the marker 257 258 """ 246 259 _BaseInteractor.__init__(self, base, axes, color=color) 247 260 self.markers = [] … … 292 305 def set_layer(self, n): 293 306 """ 294 Allow adding plot to the same panel 295 @param n: the number of layer 307 Allow adding plot to the same panel 308 309 :param n: the number of layer 310 296 311 """ 297 312 self.layernum = n … … 300 315 def clear(self): 301 316 """ 302 317 Clear the slicer and all connected events related to this slicer 303 318 """ 304 319 self.clear_markers() … … 311 326 del self.axes.lines[0] 312 327 313 314 315 328 def get_radius(self): 316 329 """ 317 @return self._inner_mouse_x: the current radius of the ring330 :return self._inner_mouse_x: the current radius of the ring 318 331 """ 319 332 return self._inner_mouse_x … … 321 334 def update(self): 322 335 """ 323 336 Draw the new roughness on the graph. 324 337 """ 325 338 # Plot inner circle … … 349 362 def moveend(self, ev): 350 363 """ 351 364 Called after a dragging motion 352 365 """ 353 366 self.base.moveend(ev) … … 370 383 def set_cursor(self, x, y): 371 384 """ 372 385 draw the ring given x, y value 373 386 """ 374 387 self.move(x, y, None) … … 378 391 def get_params(self): 379 392 """ 380 Store a copy of values of parameters of the slicer into a dictionary. 381 @return params: the dictionary created 393 Store a copy of values of parameters of the slicer into a dictionary. 394 395 :return params: the dictionary created 396 382 397 """ 383 398 params = {} … … 387 402 def set_params(self, params): 388 403 """ 389 Receive a dictionary and reset the slicer with values contained 390 in the values of the dictionary. 391 @param params: a dictionary containing name of slicer parameters and 404 Receive a dictionary and reset the slicer with values contained 405 in the values of the dictionary. 406 407 :param params: a dictionary containing name of slicer parameters and 392 408 values the user assigned to the slicer. 409 393 410 """ 394 411 x = params["radius"] … … 397 414 class CircularMask(_BaseInteractor): 398 415 """ 399 Draw a ring Given a radius 400 @param: the color of the line that defined the ring 401 @param r: the radius of the ring 402 @param sign: the direction of motion the the marker 416 Draw a ring Given a radius 403 417 """ 404 418 def __init__(self,base,axes,color='grey', zorder=3, side=None): 405 419 """ 420 421 :param: the color of the line that defined the ring 422 :param r: the radius of the ring 423 :param sign: the direction of motion the the marker 424 425 """ 406 426 _BaseInteractor.__init__(self, base, axes, color=color) 407 427 self.markers = [] … … 431 451 #self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 432 452 433 434 435 453 def _onEVT_SLICER_PARS(self, event): 436 454 """ 437 receive an event containing parameters values to reset the slicer 438 @param event: event of type SlicerParameterEvent with params as 455 receive an event containing parameters values to reset the slicer 456 457 :param event: event of type SlicerParameterEvent with params as 439 458 attribute 440 459 """ … … 447 466 def set_layer(self, n): 448 467 """ 449 Allow adding plot to the same panel 450 @param n: the number of layer 468 Allow adding plot to the same panel 469 470 :param n: the number of layer 471 451 472 """ 452 473 self.layernum = n … … 455 476 def clear(self): 456 477 """ 457 478 Clear the slicer and all connected events related to this slicer 458 479 """ 459 480 self.clear_markers() … … 462 483 #self.base.Unbind(EVT_SLICER_PARS) 463 484 464 465 485 def update(self): 466 486 """ 467 468 487 Respond to changes in the model by recalculating the profiles and 488 resetting the widgets. 469 489 """ 470 490 # Update locations … … 476 496 def save(self, ev): 477 497 """ 478 479 498 Remember the roughness for this layer and the next so that we 499 can restore on Esc. 480 500 """ 481 501 self.base.freeze_axes() … … 484 504 def _post_data(self): 485 505 """ 486 Uses annulus parameters to plot averaged data into 1D data. 487 @param nbins: the number of points to plot 506 Uses annulus parameters to plot averaged data into 1D data. 507 508 :param nbins: the number of points to plot 509 488 510 """ 489 511 #Data to average … … 512 534 def moveend(self, ev): 513 535 """ 514 515 516 517 536 Called when any dragging motion ends. 537 Post an event (type =SlicerParameterEvent) 538 to plotter 2D with a copy slicer parameters 539 Call _post_data method 518 540 """ 519 541 self.base.thaw_axes() … … 538 560 def get_params(self): 539 561 """ 540 Store a copy of values of parameters of the slicer into a dictionary. 541 @return params: the dictionary created 562 Store a copy of values of parameters of the slicer into a dictionary. 563 564 :return params: the dictionary created 565 542 566 """ 543 567 params = {} … … 547 571 def set_params(self, params): 548 572 """ 549 Receive a dictionary and reset the slicer with values contained 550 in the values of the dictionary. 551 @param params: a dictionary containing name of slicer parameters and 573 Receive a dictionary and reset the slicer with values contained 574 in the values of the dictionary. 575 576 :param params: a dictionary containing name of slicer parameters and 552 577 values the user assigned to the slicer. 553 578 """ -
guiframe/local_perspectives/plotting/Arc.py
r0d9dae8 r83f4445 10 10 class ArcInteractor(_BaseInteractor): 11 11 """ 12 12 Select an annulus through a 2D plot 13 13 """ 14 14 def __init__(self,base,axes,color='black', zorder=5, r=1.0,theta1=math.pi/8, … … 38 38 39 39 def set_layer(self, n): 40 """ 41 """ 40 42 self.layernum = n 41 43 self.update() 42 44 43 45 def clear(self): 46 """ 47 """ 44 48 self.clear_markers() 45 49 try: … … 51 55 del self.axes.lines[0] 52 56 53 54 55 57 def get_radius(self): 58 """ 59 """ 56 60 radius =math.sqrt(math.pow(self._mouse_x, 2)+math.pow(self._mouse_y, 2)) 57 61 return radius … … 72 76 while self.theta2 >= self.theta1+2*math.pi: self.theta2 -= 2*math.pi 73 77 74 """75 if nbins!=None:76 self.npts =nbins77 else:78 """79 78 npts = int((self.theta2 - self.theta1)/(math.pi/120)) 80 79 … … 111 110 112 111 def moveend(self, ev): 112 """ 113 """ 113 114 self.has_move= False 114 115 … … 139 140 140 141 def set_cursor(self,radius, phi_min, phi_max,nbins): 141 142 """ 143 """ 142 144 self.theta1= phi_min 143 145 self.theta2= phi_max … … 146 148 147 149 def get_params(self): 150 """ 151 """ 148 152 params = {} 149 153 params["radius"] = self.radius … … 153 157 154 158 def set_params(self, params): 155 159 """ 160 """ 156 161 x = params["radius"] 157 162 self.set_cursor(x, self._mouse_y) -
guiframe/local_perspectives/plotting/AzimutSlicer.py
r78cae5a r83f4445 19 19 class SectorInteractor(_BaseInteractor): 20 20 """ 21 21 Select an annulus through a 2D plot 22 22 """ 23 23 def __init__(self,base,axes,color='black', zorder=3): 24 24 """ 25 """ 25 26 _BaseInteractor.__init__(self, base, axes, color=color) 26 27 self.markers = [] … … 61 62 self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 62 63 63 64 64 def _onEVT_SLICER_PARS(self, event): 65 """ 66 """ 65 67 #printEVT("AnnulusSlicer._onEVT_SLICER_PARS") 66 68 event.Skip() … … 69 71 self.base.update() 70 72 71 """72 def update_and_post(self):73 self.update()74 self._post_data()75 76 """77 73 def save_data(self, path, image, x, y): 74 """ 75 """ 78 76 output = open(path, 'w') 79 77 … … 86 84 87 85 def set_layer(self, n): 86 """ 87 """ 88 88 self.layernum = n 89 89 self.update() 90 90 91 91 def clear(self): 92 """ 93 """ 92 94 self.clear_markers() 93 95 self.outer_circle.clear() … … 105 107 # Update locations 106 108 if self.inner_circle.has_move: 107 print "inner circle has moved"109 #print "inner circle has moved" 108 110 self.inner_circle.update() 109 111 r1=self.inner_circle.get_radius() … … 112 114 self.left_edge.update(r1,r2) 113 115 if self.outer_circle.has_move: 114 print "outer circle has moved"116 #print "outer circle has moved" 115 117 self.outer_circle.update() 116 118 r1=self.inner_circle.get_radius() … … 119 121 self.right_edge.update(r1,r2) 120 122 if self.right_edge.has_move: 121 print "right edge has moved"123 #print "right edge has moved" 122 124 self.right_edge.update() 123 125 self.inner_circle.update(theta1=self.right_edge.get_angle(), theta2=None) 124 126 self.outer_circle.update(theta1=self.right_edge.get_angle(), theta2=None) 125 127 if self.left_edge.has_move: 126 print "left Edge has moved"128 #print "left Edge has moved" 127 129 self.left_edge.update() 128 130 self.inner_circle.update(theta1=None, theta2=self.left_edge.get_angle()) … … 220 222 221 223 def set_cursor(self, x, y): 224 """ 225 """ 222 226 pass 223 227 224 228 def get_params(self): 229 """ 230 """ 225 231 params = {} 226 232 params["r_min"] = self.inner_circle.get_radius() … … 232 238 233 239 def set_params(self, params): 234 print "setparams on main slicer ",params 240 """ 241 """ 242 #print "setparams on main slicer ",params 235 243 inner = params["r_min"] 236 244 outer = params["r_max"] … … 239 247 self.nbins = int(params["nbins"]) 240 248 241 242 249 self.inner_circle.set_cursor(inner, phi_min, phi_max,self.nbins) 243 250 self.outer_circle.set_cursor(outer, phi_min, phi_max, self.nbins) … … 247 254 248 255 def freeze_axes(self): 256 """ 257 """ 249 258 self.base.freeze_axes() 250 259 251 260 def thaw_axes(self): 261 """ 262 """ 252 263 self.base.thaw_axes() 253 264 254 265 def draw(self): 266 """ 267 """ 255 268 self.base.draw() 256 269 257 270 class SectorInteractorQ(SectorInteractor): 271 """ 272 """ 258 273 def __init__(self,base,axes,color='black', zorder=3): 274 """ 275 """ 259 276 SectorInteractor.__init__(self, base, axes, color=color) 260 277 self.base=base 261 278 self._post_data() 279 262 280 def _post_data(self): 281 """ 282 """ 263 283 from DataLoader.manipulations import SectorQ 264 284 self.post_data(SectorQ ) … … 266 286 267 287 class SectorInteractorPhi(SectorInteractor): 288 """ 289 """ 268 290 def __init__(self,base,axes,color='black', zorder=3): 291 """ 292 """ 269 293 SectorInteractor.__init__(self, base, axes, color=color) 270 294 self.base=base 271 295 self._post_data() 296 272 297 def _post_data(self): 298 """ 299 """ 273 300 from DataLoader.manipulations import SectorPhi 274 301 self.post_data(SectorPhi ) -
guiframe/local_perspectives/plotting/BaseInteractor.py
rb06ef8c r83f4445 38 38 color - color of the interactor in non-active state 39 39 markers - list of handles for the interactor 40 40 41 """ 41 42 def __init__(self,base,axes,color='black'): 43 """ 44 """ 42 45 self.base = base 43 46 self.axes = axes … … 45 48 46 49 def clear_markers(self): 47 '''50 """ 48 51 Clear old markers and interfaces. 49 '''52 """ 50 53 for h in self.markers: h.remove() 51 54 if self.markers: self.base.connect.clear(*self.markers) … … 53 56 54 57 def save(self, ev): 58 """ 59 """ 55 60 pass 61 56 62 def restore(self, ev): 63 """ 64 """ 57 65 pass 66 58 67 def move(self, x, y, ev): 68 """ 69 """ 59 70 pass 71 60 72 def moveend(self, ev): 73 """ 74 """ 61 75 pass 62 76 … … 102 116 103 117 def onRelease(self, ev): 118 """ 119 """ 104 120 self.moveend(ev) 105 121 return True … … 120 136 121 137 def onKey(self, ev): 122 '''138 """ 123 139 Respond to keyboard events. Arrow keys move the widget. Escape 124 140 restores it to the position before the last click. 125 141 126 142 Calls move() to update the state. Calls restore() on escape. 127 '''143 """ 128 144 if ev.key == 'escape': 129 145 self.restore() … … 141 157 142 158 def dpixel(self,x,y,nudge=False): 143 '''159 """ 144 160 Return the step size in data coordinates for a small 145 161 step in screen coordinates. If nudge is False (default) 146 162 the step size is one pixel. If nudge is True, the step 147 163 size is 0.2 pixels. 148 '''164 """ 149 165 ax = self.axes 150 166 px,py = ax.transData.inverse_xy_tup((x,y)) -
guiframe/local_perspectives/plotting/binder.py
r45c1a35 r83f4445 80 80 81 81 Use clearall() to reset all connections. 82 82 83 """ 83 84 … … 162 163 if event.button == 1 and event.shift: process Shift-click 163 164 164 TODO: Only receive events with the correct modifiers (e.g., S-click, 165 TODO: or *-click for any modifiers). 166 TODO: Only receive button events for the correct button (e.g., click1 167 TODO: release3, or dclick* for any button) 168 TODO: Support virtual artist, so that and artist can be flagged as 169 TODO: having a tag list and receive the correct events 170 TODO: Support virtual events for binding to button-3 vs shift button-1 171 TODO: without changing callback code 172 TODO: Attach multiple callbacks to the same event? 173 TODO: Clean up interaction with toolbar modes 174 TODO: push/pushclear/pop context so that binding changes for the duration 175 TODO: e.g., to support ? context sensitive help 165 :TODO: Only receive events with the correct modifiers (e.g., S-click, 166 :TODO: or *-click for any modifiers). 167 :TODO: Only receive button events for the correct button (e.g., click1 168 :TODO: release3, or dclick* for any button) 169 :TODO: Support virtual artist, so that and artist can be flagged as 170 :TODO: having a tag list and receive the correct events 171 :TODO: Support virtual events for binding to button-3 vs shift button-1 172 :TODO: without changing callback code 173 :TODO: Attach multiple callbacks to the same event? 174 :TODO: Clean up interaction with toolbar modes 175 :TODO: push/pushclear/pop context so that binding changes for the duration 176 :TODO: e.g., to support ? context sensitive help 177 176 178 """ 177 179 # Check that the trigger is valid -
guiframe/local_perspectives/plotting/boxMask.py
raef2cf2 r83f4445 12 12 class BoxMask(_BaseInteractor): 13 13 """ 14 BoxMask Class: determine 2 rectangular area to find the pixel of 15 a Data inside of box. 16 Uses PointerInteractor , VerticalDoubleLine,HorizontalDoubleLine. 17 @param zorder: Artists with lower zorder values are drawn first. 18 @param x_min: the minimum value of the x coordinate 19 @param x_max: the maximum value of the x coordinate 20 @param y_min: the minimum value of the y coordinate 21 @param y_max: the maximum value of the y coordinate 14 BoxMask Class: determine 2 rectangular area to find the pixel of 15 a Data inside of box. 16 17 Uses PointerInteractor , VerticalDoubleLine,HorizontalDoubleLine. 18 19 :param zorder: Artists with lower zorder values are drawn first. 20 :param x_min: the minimum value of the x coordinate 21 :param x_max: the maximum value of the x coordinate 22 :param y_min: the minimum value of the y coordinate 23 :param y_max: the maximum value of the y coordinate 22 24 23 25 """ … … 83 85 def clear(self): 84 86 """ 85 87 Clear the slicer and all connected events related to this slicer 86 88 """ 87 89 self.clear_markers() … … 91 93 self.base.connect.clearall() 92 94 #self.base.Unbind(EVT_SLICER_PARS) 93 94 95 95 96 def update(self): 96 97 """ 97 Respond to changes in the model by recalculating the profiles and 98 resetting the widgets. 99 """ 100 98 Respond to changes in the model by recalculating the profiles and 99 resetting the widgets. 100 """ 101 101 ## check if the center point has moved and update the figure accordingly 102 102 if self.center.has_move: … … 132 132 def _post_data(self): 133 133 """ 134 135 134 Get the limits of the boxsum and compute the sum of the pixel 135 contained in that region and the error on that sum 136 136 """ 137 137 from DataLoader.manipulations import Boxcut … … 151 151 out = (mask(data)) 152 152 #self.base.data.mask=out 153 return out 153 return out 154 154 155 def moveend(self, ev): 155 156 """ 156 157 157 After a dragging motion this function is called to compute 158 the error and the sum of pixel of a given data 2D 158 159 """ 159 160 self.base.thaw_axes() … … 169 170 self.center.restore() 170 171 171 172 172 def move(self, x, y, ev): 173 173 """ … … 175 175 """ 176 176 pass 177 178 177 179 178 def set_cursor(self, x, y): 180 179 pass 181 180 182 183 181 def get_params(self): 184 182 """ 185 Store a copy of values of parameters of the slicer into a dictionary. 186 @return params: the dictionary created 183 Store a copy of values of parameters of the slicer into a dictionary. 184 185 :return params: the dictionary created 186 187 187 """ 188 188 params = {} … … 191 191 params["center_x"] = self.center.x 192 192 params["center_y"] =self.center.y 193 194 193 return params 195 194 196 197 195 def get_mask(self): 198 196 """ 199 197 return mask as a result of boxcut 200 198 """ 201 199 mask = self.mask 202 200 return mask 203 201 204 205 202 def set_params(self, params): 206 203 """ 207 Receive a dictionary and reset the slicer with values contained 208 in the values of the dictionary. 209 @param params: a dictionary containing name of slicer parameters and 210 values the user assigned to the slicer. 204 Receive a dictionary and reset the slicer with values contained 205 in the values of the dictionary. 206 207 :param params: a dictionary containing name of slicer parameters and 208 values the user assigned to the slicer. 211 209 """ 212 210 x_max = math.fabs(params["Width"] )/2 … … 226 224 self._post_data() 227 225 228 229 226 def freeze_axes(self): 230 227 self.base.freeze_axes() 231 232 228 233 229 def thaw_axes(self): -
guiframe/local_perspectives/plotting/boxSlicer.py
rddf6df3 r83f4445 1 #TODO: the line slicer should listen to all 2DREFRESH events, get the data and slice it 2 # before pushing a new 1D data update. 3 4 # 5 #TODO: NEED MAJOR REFACTOR 6 # 7 8 9 # Debug printout 10 #from config import printEVT 1 2 11 3 import wx 12 4 import copy … … 24 16 class BoxInteractor(_BaseInteractor): 25 17 """ 26 27 18 BoxInteractor define a rectangle that return data1D average of Data2D 19 in a rectangle area defined by -x, x ,y, -y 28 20 """ 29 21 def __init__(self,base,axes,color='black', zorder=3): … … 68 60 def _onEVT_SLICER_PARS(self, event): 69 61 """ 70 receive an event containing parameters values to reset the slicer 71 @param event: event of type SlicerParameterEvent with params as 62 receive an event containing parameters values to reset the slicer 63 64 :param event: event of type SlicerParameterEvent with params as 72 65 attribute 73 66 """ … … 81 74 def update_and_post(self): 82 75 """ 83 76 Update the slicer and plot the resulting data 84 77 """ 85 78 self.update() 86 79 self._post_data() 87 88 80 89 81 def set_layer(self, n): 90 82 """ 91 Allow adding plot to the same panel 92 @param n: the number of layer 83 Allow adding plot to the same panel 84 85 :param n: the number of layer 86 93 87 """ 94 88 self.layernum = n 95 89 self.update() 96 90 97 98 91 def clear(self): 99 92 """ 100 93 Clear the slicer and all connected events related to this slicer 101 94 """ 102 95 self.averager=None … … 122 115 self.vertical_lines.update() 123 116 self.horizontal_lines.update(x=self.vertical_lines.x) 124 125 117 126 118 def save(self, ev): 127 119 """ … … 136 128 pass 137 129 138 139 130 def post_data(self,new_slab=None , nbins=None, direction =None): 140 131 """ 141 post data averaging in Qx or Qy given new_slab type 142 @param new_slab: slicer that determine with direction to average 143 @param nbins: the number of points plotted when averaging 144 @param direction: the direction of averaging 132 post data averaging in Qx or Qy given new_slab type 133 134 :param new_slab: slicer that determine with direction to average 135 :param nbins: the number of points plotted when averaging 136 :param direction: the direction of averaging 137 145 138 """ 146 139 x_min= -1*math.fabs(self.vertical_lines.x) … … 197 190 wx.PostEvent(self.base.parent, NewPlotEvent(plot=new_plot, 198 191 title=str(self.averager.__name__) )) 199 200 201 192 202 193 def moveend(self, ev): 203 194 """ 204 205 206 195 Called after a dragging event. 196 Post the slicer new parameters and creates a new Data1D 197 corresponding to the new average 207 198 """ 208 199 self.base.thaw_axes() … … 215 206 self._post_data() 216 207 217 218 208 def restore(self): 219 209 """ … … 223 213 self.vertical_lines.restore() 224 214 225 226 215 def move(self, x, y, ev): 227 216 """ … … 229 218 """ 230 219 pass 231 232 220 233 221 def set_cursor(self, x, y): 234 222 pass 235 223 236 237 224 def get_params(self): 238 225 """ 239 Store a copy of values of parameters of the slicer into a dictionary. 240 @return params: the dictionary created 226 Store a copy of values of parameters of the slicer into a dictionary. 227 228 :return params: the dictionary created 229 241 230 """ 242 231 params = {} … … 248 237 def set_params(self, params): 249 238 """ 250 Receive a dictionary and reset the slicer with values contained 251 in the values of the dictionary. 252 @param params: a dictionary containing name of slicer parameters and 239 Receive a dictionary and reset the slicer with values contained 240 in the values of the dictionary. 241 242 :param params: a dictionary containing name of slicer parameters and 253 243 values the user assigned to the slicer. 254 244 """ … … 261 251 self.post_data( nbins=None) 262 252 263 264 253 def freeze_axes(self): 254 """ 255 """ 265 256 self.base.freeze_axes() 266 257 267 268 258 def thaw_axes(self): 259 """ 260 """ 269 261 self.base.thaw_axes() 270 262 271 272 263 def draw(self): 264 """ 265 """ 273 266 self.base.draw() 274 267 … … 276 269 class HorizontalLines(_BaseInteractor): 277 270 """ 278 279 271 Draw 2 Horizontal lines centered on (0,0) that can move 272 on the x- direction and in opposite direction 280 273 """ 281 274 def __init__(self,base,axes,color='black', zorder=5,x=0.5, y=0.5): … … 331 324 def set_layer(self, n): 332 325 """ 333 Allow adding plot to the same panel 334 @param n: the number of layer 326 Allow adding plot to the same panel 327 328 :param n: the number of layer 329 335 330 """ 336 331 self.layernum = n … … 340 335 def clear(self): 341 336 """ 342 337 Clear this slicer and its markers 343 338 """ 344 339 self.clear_markers() … … 355 350 def update(self,x=None,y=None): 356 351 """ 357 Draw the new roughness on the graph. 358 @param x: x-coordinates to reset current class x 359 @param y: y-coordinates to reset current class y 352 Draw the new roughness on the graph. 353 354 :param x: x-coordinates to reset current class x 355 :param y: y-coordinates to reset current class y 356 360 357 """ 361 358 ## Reset x, y- coordinates if send as parameters … … 371 368 ydata=[-self.y, -self.y]) 372 369 373 374 370 def save(self, ev): 375 371 """ … … 381 377 self.base.freeze_axes() 382 378 383 384 379 def moveend(self, ev): 385 380 """ 386 387 381 Called after a dragging this edge and set self.has_move to False 382 to specify the end of dragging motion 388 383 """ 389 384 self.has_move=False 390 385 self.base.moveend(ev) 391 392 386 393 387 def restore(self): 394 388 """ … … 398 392 self.y = self.save_y 399 393 400 401 394 def move(self, x, y, ev): 402 395 """ … … 410 403 class VerticalLines(_BaseInteractor): 411 404 """ 412 405 Select an annulus through a 2D plot 413 406 """ 414 407 def __init__(self,base,axes,color='black',zorder=5,x=0.5, y=0.5): … … 456 449 def set_layer(self, n): 457 450 """ 458 Allow adding plot to the same panel 459 @param n: the number of layer 451 Allow adding plot to the same panel 452 453 :param n: the number of layer 454 460 455 """ 461 456 self.layernum = n 462 457 self.update() 463 458 464 465 459 def clear(self): 466 460 """ 467 461 Clear this slicer and its markers 468 462 """ 469 463 self.clear_markers() … … 477 471 del self.axes.lines[0] 478 472 479 480 473 def update(self,x=None,y=None): 481 474 """ 482 Draw the new roughness on the graph. 483 @param x: x-coordinates to reset current class x 484 @param y: y-coordinates to reset current class y 475 Draw the new roughness on the graph. 476 477 :param x: x-coordinates to reset current class x 478 :param y: y-coordinates to reset current class y 479 485 480 """ 486 481 ## reset x, y -coordinates if given as parameters … … 496 491 ydata=[self.y,-self.y]) 497 492 498 499 493 def save(self, ev): 500 494 """ … … 502 496 can restore on Esc. 503 497 """ 504 self.save_x= self.x 505 self.save_y= self.y 506 498 self.save_x = self.x 499 self.save_y = self.y 507 500 self.base.freeze_axes() 508 509 501 510 502 def moveend(self, ev): 511 503 """ 512 513 504 Called after a dragging this edge and set self.has_move to False 505 to specify the end of dragging motion 514 506 """ 515 507 self.has_move=False 516 508 self.base.moveend(ev) 517 518 509 519 510 def restore(self): 520 511 """ … … 524 515 self.y = self.save_y 525 516 526 527 517 def move(self, x, y, ev): 528 518 """ … … 534 524 535 525 536 537 538 526 class BoxInteractorX(BoxInteractor): 539 527 """ 540 528 Average in Qx direction 541 529 """ 542 530 def __init__(self,base,axes,color='black', zorder=3): … … 548 536 def _post_data(self): 549 537 """ 550 538 Post data creating by averaging in Qx direction 551 539 """ 552 540 from DataLoader.manipulations import SlabX … … 556 544 class BoxInteractorY(BoxInteractor): 557 545 """ 558 546 Average in Qy direction 559 547 """ 560 548 def __init__(self,base,axes,color='black', zorder=3): … … 563 551 self._post_data() 564 552 565 566 553 def _post_data(self): 567 554 """ 568 555 Post data creating by averaging in Qy direction 569 556 """ 570 557 from DataLoader.manipulations import SlabY
Note: See TracChangeset
for help on using the changeset viewer.