Changeset 7a28ba7 in sasview
- Timestamp:
- Feb 6, 2009 2:05:31 PM (16 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:
- 53087f2
- Parents:
- 216efab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/SectorSlicer.py
rd468daa r7a28ba7 115 115 self.right_line.update( delta = self.main_line.get_radius(),mline= self.main_line) 116 116 self.left_line.update( delta = self.main_line.get_radius() ,mline= self.main_line) 117 print "Main line has moved ---> phi right",math.degrees(self.main_line.get_radius()+self.right_line.theta)118 print "Main line has moved ---> phi left",math.degrees(self.left_line.theta+self.main_line.get_radius())117 #print "Main line has moved ---> phi right",math.degrees(self.main_line.get_radius()+self.right_line.theta) 118 #print "Main line has moved ---> phi left",math.degrees(self.left_line.theta+self.main_line.get_radius()) 119 119 if self.left_line.has_move: 120 print "left line has moved --->"120 #print "left line has moved --->" 121 121 self.main_line.update() 122 122 self.left_line.update(phi=None,delta=None, mline=self.main_line,side=True, left=True) 123 123 #self.right_line.update(-1*delta,linem=self.main_line,linel=self.left_line) 124 self.right_line.update(phi=-1*self.left_line.phi,delta=None, mline=self.main_line,side=True, left=True) 124 self.right_line.update(phi=self.left_line.phi,delta=None, mline=self.main_line,side=True,left=False, right=True) 125 125 126 if self.right_line.has_move: 126 print "right line has moved --->" 127 127 128 128 self.main_line.update() 129 self.right_line.update(phi=None,delta=None, mline=self.main_line,side=True, right=True)130 # self.right_line.update(-1*delta,linem=self.main_line,linel=self.left_line)131 self.left_line.update(phi= -1*self.right_line.phi,delta=None, mline=self.main_line,side=True, left=True)129 self.right_line.update(phi=None,delta=None, mline=self.main_line,side=True, left=False,right=True) 130 #print "right line has moved --->",self.right_line.phi 131 self.left_line.update(phi=self.right_line.phi,delta=None, mline=self.main_line,side=True, left=False) 132 132 133 133 134 134 135 135 … … 155 155 phimin = self.right_line.theta+math.pi 156 156 phimax = self.left_line.theta+math.pi 157 print "sector Q", radius 157 #phimin = min(self.right_line.theta+math.pi,self.left_line.theta+math.pi) 158 #phimax = max(self.right_line.theta+math.pi,self.left_line.theta+math.pi) 159 print "sector Q",phimin,phimax 158 160 sect = SectorQ(r_min=0.0, r_max= radius , phi_min=phimin, phi_max=phimax) 159 161 #sect = SectorQ(r_min=-1*radius , r_max= radius , phi_min=phimin, phi_max=phimax) … … 227 229 raise ValueError,"Phi left and phi right are different %f, %f"%(self.left_line.phi, self.right_line.phi) 228 230 params["left_phi"] = math.fabs(self.left_line.phi) 231 params["right_phi"] = math.fabs(self.right_line.phi) 229 232 params["nbins"] = self.nbins 230 233 return params … … 233 236 234 237 main = params["main_phi"] 235 phi = params["left_phi"]238 phi = math.fabs(params["left_phi"] ) 236 239 self.nbins = int(params["nbins"]) 237 240 self.main_line.theta= main 238 241 239 242 self.main_line.update() 240 self.right_line.update(phi= -1*phi,delta=None, mline=self.main_line,side=True)243 self.right_line.update(phi=phi,delta=None, mline=self.main_line,side=True,right=True) 241 244 self.left_line.update(phi=phi,delta=None, mline=self.main_line,side=True) 242 245 … … 269 272 self.phi = phi 270 273 self.scale = 10.0 271 #print "init for line side theta2, phi, theta",math.degrees(theta2),math.degrees(phi),math.degrees(self.theta) 272 #raise "Version error", message 273 274 # Inner circle 274 # Inner circle 275 275 x1= self.radius*math.cos(self.theta) 276 276 y1= self.radius*math.sin(self.theta) 277 277 x2= -1*self.radius*math.cos(self.theta) 278 278 y2= -1*self.radius*math.sin(self.theta) 279 280 try: 281 # Inner circle marker 282 self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 283 marker='s', markersize=10, 284 color=self.color, alpha=0.6, 285 pickradius=5, label="pick", 286 zorder=zorder, # Prefer this to other lines 287 visible=True)[0] 288 except: 289 self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 290 marker='s', markersize=10, 291 color=self.color, alpha=0.6, 292 label="pick", 293 visible=True)[0] 294 message = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 295 message += "Get the SVN version that is at least as recent as June 1, 2007" 296 297 298 279 299 280 300 self.line = self.axes.plot([x1,x2],[y1,y2], … … 282 302 color=self.color, 283 303 visible=True)[0] 284 304 self.left_moving=False 305 285 306 self.npts = 20 286 307 self.has_move=False 287 self.connect_markers([self. line])308 self.connect_markers([self.inner_marker, self.line]) 288 309 #self.update() 289 310 … … 295 316 self.clear_markers() 296 317 try: 297 298 318 self.line.remove() 319 self.inner_marker.remove() 299 320 except: 300 321 # Old version of matplotlib … … 313 334 """ 314 335 #print "update left or right ", self.has_move 315 336 self.left_moving=left 316 337 if phi !=None: 317 self.phi = phi 338 self.phi= phi 339 if right: 340 self.phi = -1*math.fabs(self.phi) 341 else: 342 self.phi =math.fabs(self.phi) 318 343 if delta==None: 319 344 delta = 0 320 345 if side: 321 346 self.theta= mline.theta + self.phi 322 347 348 323 349 324 350 if mline!=None: … … 334 360 y2= -1*self.radius*math.sin(self.theta + delta) 335 361 336 362 self.inner_marker.set(xdata=[x1/2],ydata=[y1/2]) 337 363 self.line.set(xdata=[x1,x2], ydata=[y1,y2]) 338 364 … … 365 391 366 392 self.theta= math.atan2(y,x) 367 393 self.has_move=True 394 if not self.left_moving: 395 if self.theta >= self.theta2: 396 print "my theta", self.theta 397 self.restore() 398 return 399 elif self.theta <= self.theta2 -math.pi/2: 400 print "self theta encore" 401 self.restore() 402 return 403 else: 404 print "left move" 405 if self.theta <= self.theta2: 406 print "my theta", self.theta 407 self.restore() 408 return 409 elif self.theta >= self.theta2 +math.pi/2: 410 print "self theta encore" 411 self.restore() 412 return 368 413 self.phi= math.fabs(self.theta2 - self.theta) 369 414 370 print "move left or right phi ---theta--thetaM", self.phi, self.theta, self.theta2 371 self.has_move=True 415 print "move , self.phi, self.theta,", self.theta,self.theta2 -math.pi/2 416 417 418 372 419 self.base.base.update() 373 420 … … 388 435 self.set_cursor(x, self._inner_mouse_y) 389 436 390 391 392 437 393 438 394 439 class LineInteractor(_BaseInteractor): … … 412 457 413 458 # Inner circle 414 415 416 459 x1= self.radius*math.cos(self.theta) 417 460 y1= self.radius*math.sin(self.theta) 418 461 x2= -1*self.radius*math.cos(self.theta) 419 462 y2= -1*self.radius*math.sin(self.theta) 463 try: 464 # Inner circle marker 465 self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 466 marker='s', markersize=10, 467 color=self.color, alpha=0.6, 468 pickradius=5, label="pick", 469 zorder=zorder, # Prefer this to other lines 470 visible=True)[0] 471 except: 472 self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 473 marker='s', markersize=10, 474 color=self.color, alpha=0.6, 475 label="pick", 476 visible=True)[0] 477 message = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 478 message += "Get the SVN version that is at least as recent as June 1, 2007" 479 420 480 421 481 self.line = self.axes.plot([x1,x2],[y1,y2], … … 426 486 self.npts = 20 427 487 self.has_move=False 428 self.connect_markers([self. line])488 self.connect_markers([self.inner_marker, self.line]) 429 489 self.update() 430 490 … … 436 496 self.clear_markers() 437 497 try: 438 498 self.inner_marker.remove() 439 499 self.line.remove() 440 500 except: … … 460 520 x2= -1*self.radius*math.cos(self.theta) 461 521 y2= -1*self.radius*math.sin(self.theta) 462 522 523 self.inner_marker.set(xdata=[x1/2],ydata=[y1/2]) 463 524 self.line.set(xdata=[x1,x2], ydata=[y1,y2]) 464 525
Note: See TracChangeset
for help on using the changeset viewer.