Changeset 824e488 in sasview for src/sas/guiframe/local_perspectives/plotting/AzimutSlicer.py
- Timestamp:
- Mar 5, 2015 2:18:47 PM (10 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:
- b5de88e
- Parents:
- b9dbd6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/AzimutSlicer.py
r79492222 r824e488 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 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. 4 3 # 5 # TODO: NEED MAJOR REFACTOR4 # TODO: NEED MAJOR REFACTOR 6 5 # 7 8 9 # Debug printout10 6 import math 11 7 import wx 12 from copy import deepcopy13 8 from BaseInteractor import _BaseInteractor 14 9 from sas.guiframe.events import NewPlotEvent 15 from sas.guiframe.events import StatusEvent16 from sas.guiframe.events import SlicerParameterEvent17 10 from sas.guiframe.events import EVT_SLICER_PARS 18 19 11 20 12 class SectorInteractor(_BaseInteractor): … … 30 22 self.qmax = self.base.data2D.xmax 31 23 self.connect = self.base.connect 32 33 # # Number of points on the plot24 25 # # Number of points on the plot 34 26 self.nbins = 20 35 theta1 = math.pi/8 36 theta2 = math.pi/2 37 theta1 = 2 * math.pi/3 38 theta2 = -2 * math.pi/3 39 r1 = self.qmax/2.0 40 r2 = self.qmax/1.8 41 27 theta1 = 2 * math.pi / 3 28 theta2 = -2 * math.pi / 3 29 42 30 # Inner circle 43 31 from Arc import ArcInteractor 44 32 self.inner_circle = ArcInteractor(self, self.base.subplot, 45 46 r=self.qmax/2.0,47 48 33 zorder=zorder, 34 r=self.qmax / 2.0, 35 theta1=theta1, 36 theta2=theta2) 49 37 self.inner_circle.qmax = self.qmax 50 38 self.outer_circle = ArcInteractor(self, self.base.subplot, 51 zorder=zorder +1,52 r=self.qmax /1.8,39 zorder=zorder + 1, 40 r=self.qmax / 1.8, 53 41 theta1=theta1, 54 42 theta2=theta2) 55 43 self.outer_circle.qmax = self.qmax * 1.2 56 # self.outer_circle.set_cursor(self.base.qmax/1.8, 0)44 # self.outer_circle.set_cursor(self.base.qmax/1.8, 0) 57 45 from Edge import RadiusInteractor 58 self.right_edge = RadiusInteractor(self, self.base.subplot,59 zorder=zorder+1,60 61 62 63 self.left_edge = RadiusInteractor(self, self.base.subplot,64 zorder=zorder+1,65 66 67 46 self.right_edge = RadiusInteractor(self, self.base.subplot, 47 zorder=zorder + 1, 48 arc1=self.inner_circle, 49 arc2=self.outer_circle, 50 theta=theta1) 51 self.left_edge = RadiusInteractor(self, self.base.subplot, 52 zorder=zorder + 1, 53 arc1=self.inner_circle, 54 arc2=self.outer_circle, 55 theta=theta2) 68 56 self.update() 69 57 self._post_data() … … 74 62 """ 75 63 """ 76 # printEVT("AnnulusSlicer._onEVT_SLICER_PARS")64 # printEVT("AnnulusSlicer._onEVT_SLICER_PARS") 77 65 event.Skip() 78 66 if event.type == self.__class__.__name__: … … 85 73 self.layernum = n 86 74 self.update() 87 75 88 76 def clear(self): 89 77 """ … … 94 82 self.right_edge.clear() 95 83 self.left_edge.clear() 96 # self.base.connect.disconnect()84 # self.base.connect.disconnect() 97 85 self.base.parent.Unbind(EVT_SLICER_PARS) 98 86 99 87 def update(self): 100 88 """ … … 102 90 resetting the widgets. 103 91 """ 104 # Update locations 105 if self.inner_circle.has_move: 106 # print "inner circle has moved"92 # Update locations 93 if self.inner_circle.has_move: 94 # print "inner circle has moved" 107 95 self.inner_circle.update() 108 96 r1 = self.inner_circle.get_radius() … … 110 98 self.right_edge.update(r1, r2) 111 99 self.left_edge.update(r1, r2) 112 if self.outer_circle.has_move: 113 # print "outer circle has moved"100 if self.outer_circle.has_move: 101 # print "outer circle has moved" 114 102 self.outer_circle.update() 115 103 r1 = self.inner_circle.get_radius() … … 118 106 self.right_edge.update(r1, r2) 119 107 if self.right_edge.has_move: 120 # print "right edge has moved"108 # print "right edge has moved" 121 109 self.right_edge.update() 122 110 self.inner_circle.update(theta1=self.right_edge.get_angle(), … … 125 113 theta2=None) 126 114 if self.left_edge.has_move: 127 # print "left Edge has moved"115 # print "left Edge has moved" 128 116 self.left_edge.update() 129 117 self.inner_circle.update(theta1=None, … … 131 119 self.outer_circle.update(theta1=None, 132 120 theta2=self.left_edge.get_angle()) 133 121 134 122 def save(self, ev): 135 123 """ … … 142 130 self.right_edge.save(ev) 143 131 self.left_edge.save(ev) 144 132 145 133 def _post_data(self): 146 134 pass 147 148 def post_data(self, new_sector):135 136 def post_data(self, new_sector): 149 137 """ post data averaging in Q""" 150 138 if self.inner_circle.get_radius() < self.outer_circle.get_radius(): … … 159 147 else: 160 148 phimin = self.left_edge.get_angle() 161 phimax = self.right_edge.get_angle() 162 # print "phimin, phimax, rmin ,rmax",math.degrees(phimin),149 phimax = self.right_edge.get_angle() 150 # print "phimin, phimax, rmin ,rmax",math.degrees(phimin), 163 151 # math.degrees(phimax), rmin ,rmax 164 # from sas.dataloader.manipulations import SectorQ165 152 # from sas.dataloader.manipulations import SectorQ 153 166 154 sect = new_sector(r_min=rmin, r_max=rmax, 167 155 phi_min=phimin, phi_max=phimax) 168 156 sector = sect(self.base.data2D) 169 157 170 158 from sas.guiframe.dataFitting import Data1D 171 159 if hasattr(sector, "dxl"): … … 180 168 dxl=dxl, dxw=dxw) 181 169 new_plot.name = str(new_sector.__name__) + \ 182 "(" + self.base.data2D.name+")"170 "(" + self.base.data2D.name + ")" 183 171 new_plot.source = self.base.data2D.source 184 172 new_plot.interactive = True 185 # print "loader output.detector",output.source173 # print "loader output.detector",output.source 186 174 new_plot.detector = self.base.data2D.detector 187 175 # If the data file does not tell us what the axes are, just assume... … … 192 180 theory=new_plot) 193 181 wx.PostEvent(self.base.parent, 194 NewPlotEvent(plot=new_plot, title=str(new_sector.__name__)))195 182 NewPlotEvent(plot=new_plot, title=str(new_sector.__name__))) 183 196 184 def moveend(self, ev): 197 #self.base.thaw_axes() 198 199 # Post paramters 200 #event = SlicerParameterEvent() 201 #event.type = self.__class__.__name__ 202 #event.params = self.get_params() 203 #print "main moveend ", event.params 204 #wx.PostEvent(self.base.parent, event) 205 #self._post_data() 206 pass 207 185 #TODO: why is this empty? 186 pass 187 208 188 def restore(self): 209 189 """ … … 220 200 """ 221 201 pass 222 202 223 203 def set_cursor(self, x, y): 224 204 """ 225 205 """ 226 206 pass 227 207 228 208 def get_params(self): 229 209 """ … … 236 216 params["nbins"] = self.nbins 237 217 return params 238 218 239 219 def set_params(self, params): 240 220 """ 241 221 """ 242 # print "setparams on main slicer ",params243 inner = params["r_min"] 244 outer = params["r_max"] 245 phi_min = params["phi_min"]246 phi_max =params["phi_max"]222 # print "setparams on main slicer ",params 223 inner = params["r_min"] 224 outer = params["r_max"] 225 phi_min = params["phi_min"] 226 phi_max = params["phi_max"] 247 227 self.nbins = int(params["nbins"]) 248 249 self.inner_circle.set_cursor(inner, phi_min, phi_max, self.nbins)250 self.outer_circle.set_cursor(outer, 228 229 self.inner_circle.set_cursor(inner, phi_min, phi_max, self.nbins) 230 self.outer_circle.set_cursor(outer, phi_min, phi_max, self.nbins) 251 231 self.right_edge.set_cursor(inner, outer, phi_min) 252 232 self.left_edge.set_cursor(inner, outer, phi_max) 253 233 self._post_data() 254 234 255 235 def freeze_axes(self): 256 236 """ 257 237 """ 258 238 self.base.freeze_axes() 259 239 260 240 def thaw_axes(self): 261 241 """ … … 275 255 """ 276 256 SectorInteractor.__init__(self, base, axes, color=color) 277 self.base =base278 self._post_data() 279 257 self.base = base 258 self._post_data() 259 280 260 def _post_data(self): 281 261 """ 282 262 """ 283 263 from sas.dataloader.manipulations import SectorQ 284 self.post_data(SectorQ) 285 264 self.post_data(SectorQ) 265 286 266 287 267 class SectorInteractorPhi(SectorInteractor): … … 292 272 """ 293 273 SectorInteractor.__init__(self, base, axes, color=color) 294 self.base =base295 self._post_data() 296 274 self.base = base 275 self._post_data() 276 297 277 def _post_data(self): 298 278 """ 299 279 """ 300 280 from sas.dataloader.manipulations import SectorPhi 301 self.post_data(SectorPhi ) 302 303 281 self.post_data(SectorPhi) 282
Note: See TracChangeset
for help on using the changeset viewer.