Changeset 4342fed0 in sasview for src/sas/sasgui/plottools
- Timestamp:
- Apr 9, 2017 8:09:12 AM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- fca1f50
- Parents:
- 5b2b04d (diff), 45dffa69 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Paul Butler <butlerpd@…> (04/09/17 08:09:12)
- git-committer:
- GitHub <noreply@…> (04/09/17 08:09:12)
- Location:
- src/sas/sasgui/plottools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/plottools/PlotPanel.py
r959eb01 r7432acb 154 154 self.selectedText = None 155 155 #User scale 156 if xtransform !=None:156 if xtransform is not None: 157 157 self.xLabel = xtransform 158 158 else: 159 159 self.xLabel = "log10(x)" 160 if ytransform !=None:160 if ytransform is not None: 161 161 self.yLabel = ytransform 162 162 else: … … 360 360 return 361 361 362 if ax !=None:362 if ax is not None: 363 363 self.xInit, self.yInit = event.xdata, event.ydata 364 364 try: … … 392 392 Set legend alpha 393 393 """ 394 if self.legend !=None:394 if self.legend is not None: 395 395 self.legend.legendPatch.set_alpha(alpha) 396 396 … … 418 418 """ 419 419 ax = event.inaxes 420 if ax ==None:420 if ax is None: 421 421 return 422 422 # Event occurred inside a plotting area … … 461 461 # User has clicked on text and is dragging 462 462 ax = event.inaxes 463 if ax !=None:463 if ax is not None: 464 464 # Only move text if mouse is within axes 465 465 self.selectedText.set_position((event.xdata, event.ydata)) … … 476 476 if self.leftdown == True and self.mousemotion == True: 477 477 ax = event.inaxes 478 if ax !=None: # the dragging is perform inside the figure478 if ax is not None: # the dragging is perform inside the figure 479 479 self.xFinal, self.yFinal = event.xdata, event.ydata 480 480 # Check whether this is the first point 481 if self.xInit ==None:481 if self.xInit is None: 482 482 self.xInit = self.xFinal 483 483 self.yInit = self.yFinal … … 576 576 step = event.step 577 577 578 if ax !=None:578 if ax is not None: 579 579 # Event occurred inside a plotting area 580 580 lo, hi = ax.get_xlim() … … 935 935 # reset postion 936 936 self.position = None 937 if self.graph.selected_plottable !=None:937 if self.graph.selected_plottable is not None: 938 938 self.graph.selected_plottable = None 939 939 … … 959 959 prop=FontProperties(size=10), 960 960 loc=self.legendLoc) 961 if self.legend !=None:961 if self.legend is not None: 962 962 self.legend.set_picker(self.legend_picker) 963 963 self.legend.set_axes(self.subplot) … … 989 989 prop=FontProperties(size=10), 990 990 loc=self.legendLoc) 991 if self.legend !=None:991 if self.legend is not None: 992 992 self.legend.set_picker(self.legend_picker) 993 993 self.legend.set_axes(self.subplot) … … 1010 1010 pos_x = 0 1011 1011 pos_y = 0 1012 if self.position !=None:1012 if self.position is not None: 1013 1013 pos_x, pos_y = self.position 1014 1014 else: … … 1035 1035 self.subplot.figure.canvas.draw_idle() 1036 1036 except: 1037 if self.parent !=None:1037 if self.parent is not None: 1038 1038 msg = "Add Text: Error. Check your property values..." 1039 1039 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 1069 1069 self.xaxis_tick = xaxis_font 1070 1070 1071 if self.data !=None:1071 if self.data is not None: 1072 1072 # 2D 1073 1073 self.xaxis(self.xaxis_label, self.xaxis_unit, \ … … 1116 1116 self.yaxis_tick = yaxis_font 1117 1117 1118 if self.data !=None:1118 if self.data is not None: 1119 1119 # 2D 1120 1120 self.yaxis(self.yaxis_label, self.yaxis_unit, \ … … 1155 1155 label_temp = textdial.getText() 1156 1156 if label_temp.count("\%s" % "\\") > 0: 1157 if self.parent !=None:1157 if self.parent is not None: 1158 1158 msg = "Add Label: Error. Can not use double '\\' " 1159 1159 msg += "characters..." … … 1162 1162 label = label_temp 1163 1163 except: 1164 if self.parent !=None:1164 if self.parent is not None: 1165 1165 msg = "Add Label: Error. Check your property values..." 1166 1166 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 1180 1180 num_text = len(self.textList) 1181 1181 if num_text < 1: 1182 if self.parent !=None:1182 if self.parent is not None: 1183 1183 msg = "Remove Text: Nothing to remove. " 1184 1184 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 1190 1190 text_remove = txt.get_text() 1191 1191 txt.remove() 1192 if self.parent !=None:1192 if self.parent is not None: 1193 1193 msg = "Removed Text: '%s'. " % text_remove 1194 1194 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1195 1195 except: 1196 if self.parent !=None:1196 if self.parent is not None: 1197 1197 msg = "Remove Text: Error occurred. " 1198 1198 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 1250 1250 prop=FontProperties(size=10), 1251 1251 loc=self.legendLoc) 1252 if self.legend !=None:1252 if self.legend is not None: 1253 1253 self.legend.set_picker(self.legend_picker) 1254 1254 self.legend.set_axes(self.subplot) … … 1279 1279 if font: 1280 1280 self.subplot.set_xlabel(label, fontproperties=font, color=color) 1281 if t_font !=None:1281 if t_font is not None: 1282 1282 for tick in self.subplot.xaxis.get_major_ticks(): 1283 1283 tick.label.set_fontproperties(t_font) … … 1300 1300 if font: 1301 1301 self.subplot.set_ylabel(label, fontproperties=font, color=color) 1302 if t_font !=None:1302 if t_font is not None: 1303 1303 for tick_label in self.subplot.get_yticklabels(): 1304 1304 tick_label.set_fontproperties(t_font) … … 1327 1327 from plottable_interactor import PointInteractor 1328 1328 p = PointInteractor(self, self.subplot, zorder=zorder, id=id) 1329 if p.markersize !=None:1329 if p.markersize is not None: 1330 1330 markersize = p.markersize 1331 1331 p.points(x, y, dx=dx, dy=dy, color=color, symbol=symbol, zorder=zorder, … … 1363 1363 1364 1364 # Convert tuple (lo,hi) to array [(x-lo),(hi-x)] 1365 if dx !=None and type(dx) == type(()):1365 if dx is not None and type(dx) == type(()): 1366 1366 dx = nx.vstack((x - dx[0], dx[1] - x)).transpose() 1367 if dy !=None and type(dy) == type(()):1367 if dy is not None and type(dy) == type(()): 1368 1368 dy = nx.vstack((y - dy[0], dy[1] - y)).transpose() 1369 if dx == None and dy ==None:1369 if dx is None and dy is None: 1370 1370 self.subplot.plot(x, y, color=self._color(color), 1371 1371 marker=self._symbol(symbol), … … 1443 1443 c = self._color(color) 1444 1444 # If we don't have any data, skip. 1445 if self.data ==None:1445 if self.data is None: 1446 1446 return 1447 1447 if self.data.ndim == 1: … … 1519 1519 self.subplot.set_axis_off() 1520 1520 1521 if cbax ==None:1521 if cbax is None: 1522 1522 ax.set_frame_on(False) 1523 1523 cb = self.subplot.figure.colorbar(im, shrink=0.8, aspect=20) … … 1541 1541 """ 1542 1542 # No qx or qy given in a vector format 1543 if self.qx_data == None or self.qy_data ==None \1543 if self.qx_data is None or self.qy_data is None \ 1544 1544 or self.qx_data.ndim != 1 or self.qy_data.ndim != 1: 1545 1545 # do we need deepcopy here? … … 1601 1601 """ 1602 1602 # No qx or qy given in a vector format 1603 if self.qx_data == None or self.qy_data ==None \1603 if self.qx_data is None or self.qy_data is None \ 1604 1604 or self.qx_data.ndim != 1 or self.qy_data.ndim != 1: 1605 1605 # do we need deepcopy here? … … 1652 1652 """ 1653 1653 # No image matrix given 1654 if image ==None or np.ndim(image) != 2 \1654 if image is None or np.ndim(image) != 2 \ 1655 1655 or np.isfinite(image).all() \ 1656 or weights ==None:1656 or weights is None: 1657 1657 return image 1658 1658 # Get bin size in y and x directions … … 1772 1772 # control axis labels from the panel itself 1773 1773 yname, yunits = item.get_yaxis() 1774 if self.yaxis_label !=None:1774 if self.yaxis_label is not None: 1775 1775 yname = self.yaxis_label 1776 1776 yunits = self.yaxis_unit … … 1779 1779 self.yaxis_unit = yunits 1780 1780 xname, xunits = item.get_xaxis() 1781 if self.xaxis_label !=None:1781 if self.xaxis_label is not None: 1782 1782 xname = self.xaxis_label 1783 1783 xunits = self.xaxis_unit … … 1940 1940 """ 1941 1941 """ 1942 if self.parent ==None:1942 if self.parent is None: 1943 1943 return 1944 1944 # get current caption -
src/sas/sasgui/plottools/TextDialog.py
r959eb01 r7432acb 41 41 style_box = wx.BoxSizer(wx.HORIZONTAL) 42 42 # tcA 43 if unit !=None:43 if unit is not None: 44 44 styles = wx.TAB_TRAVERSAL 45 45 height = -1 … … 130 130 0, wx.TOP, 5) 131 131 family_box.Add(self.font_size, 0, 0) 132 if unit_box !=None:132 if unit_box is not None: 133 133 family_box.Add((_BOX_WIDTH / 2, -1)) 134 134 family_box.Add(tick_label_text, 0, 0) … … 159 159 text_box.Add(self.text_string) 160 160 vbox.Add(text_box, 0, wx.EXPAND, 15) 161 if unit_box !=None:161 if unit_box is not None: 162 162 unit_box.Add(unit_text, 0, 0) 163 163 unit_box.Add(self.unit_ctrl, 0, 0) -
src/sas/sasgui/plottools/arrow3d.py
r959eb01 r7432acb 29 29 self.base = base 30 30 31 if base !=None:31 if base is not None: 32 32 # To turn the updating off during dragging 33 33 base.canvas.mpl_connect('button_press_event', self.on_left_down) -
src/sas/sasgui/plottools/canvas.py
r463e7ffc r7432acb 153 153 """ 154 154 self.panel.subplot.grid(self.panel.grid_on) 155 if self.panel.legend !=None and self.panel.legend_pos_loc:155 if self.panel.legend is not None and self.panel.legend_pos_loc: 156 156 self.panel.legend._loc = self.panel.legend_pos_loc 157 157 self.idletimer.Restart(5, *args, **kwargs) # Delay by 5 ms -
src/sas/sasgui/plottools/fitDialog.py
r959eb01 r7432acb 95 95 96 96 # Set default value of parameter in the dialog panel 97 if self.Avalue ==None:97 if self.Avalue is None: 98 98 self.tcA.SetValue(format_number(self.default_A)) 99 99 else: 100 100 self.tcA.SetLabel(format_number(self.Avalue)) 101 if self.Bvalue ==None:101 if self.Bvalue is None: 102 102 self.tcB.SetValue(format_number(self.default_B)) 103 103 else: 104 104 self.tcB.SetLabel(format_number(self.Bvalue)) 105 if self.ErrAvalue ==None:105 if self.ErrAvalue is None: 106 106 self.tcErrA.SetLabel(format_number(0.0)) 107 107 else: 108 108 self.tcErrA.SetLabel(format_number(self.ErrAvalue)) 109 if self.ErrBvalue ==None:109 if self.ErrBvalue is None: 110 110 self.tcErrB.SetLabel(format_number(0.0)) 111 111 else: 112 112 self.tcErrB.SetLabel(format_number(self.ErrBvalue)) 113 if self.Chivalue ==None:113 if self.Chivalue is None: 114 114 self.tcChi.SetLabel(format_number(0.0)) 115 115 else: … … 502 502 503 503 # Check that cov and out are iterable before displaying them 504 if cov ==None:504 if cov is None: 505 505 errA = 0.0 506 506 errB = 0.0 … … 508 508 errA = math.sqrt(cov[0][0]) 509 509 errB = math.sqrt(cov[1][1]) 510 if out ==None:510 if out is None: 511 511 cstA = 0.0 512 512 cstB = 0.0 … … 579 579 self.I0_tctr.SetValue(format_number(val)) 580 580 if self.Rgerr_tctr.IsShown(): 581 if rg !=None and rg != 0:581 if rg is not None and rg != 0: 582 582 value = format_number(3 * float(errA) / (2 * rg)) 583 583 else: … … 593 593 self.Diameter_tctr.SetValue(value) 594 594 if self.Diametererr_tctr.IsShown(): 595 if rg !=None and rg != 0:595 if rg is not None and rg != 0: 596 596 value = format_number(8 * float(errA) / _diam) 597 597 else: -
src/sas/sasgui/plottools/fittings.py
r959eb01 rac07a3a 25 25 self.model = model 26 26 self.name = name 27 if not value ==None:27 if value is not None: 28 28 self.model.setParam(self.name, value) 29 29 -
src/sas/sasgui/plottools/plottable_interactor.py
r959eb01 r45dffa69 50 50 l_width = markersize * 0.4 51 51 return self.step(x=x, y=y, color=color, label=label, width=l_width) 52 if not self.marker ==None:53 self.base.connect.clear([self.marker]) 54 self.color = self._color(color) 55 if self.markersize !=None:52 if self.marker is not None: 53 self.base.connect.clear([self.marker]) 54 self.color = self._color(color) 55 if self.markersize is not None: 56 56 markersize = self.markersize 57 57 # Convert tuple (lo,hi) to array [(x-lo),(hi-x)] 58 if dx !=None and type(dx) == type(()):58 if dx is not None and type(dx) == type(()): 59 59 dx = nx.vstack((x - dx[0], dx[1] - x)).transpose() 60 if dy !=None and type(dy) == type(()):60 if dy is not None and type(dy) == type(()): 61 61 dy = nx.vstack((y - dy[0], dy[1] - y)).transpose() 62 62 63 if dx == None and dy ==None:63 if dx is None and dy is None: 64 64 # zorder = 1 65 65 self.marker = self.axes.plot(x, y, color=self.color, … … 100 100 """ 101 101 """ 102 if not self.marker ==None:102 if self.marker is not None: 103 103 self.base.connect.clear([self.marker]) 104 104 self.color = self._color(color) … … 115 115 """ 116 116 """ 117 if not self.marker ==None:117 if self.marker is not None: 118 118 self.base.connect.clear([self.marker]) 119 119 self.color = self._color(color) … … 133 133 """ 134 134 """ 135 if not self.marker ==None:135 if self.marker is not None: 136 136 self.base.connect.clear([self.marker]) 137 137 self.color = self._color(color) -
src/sas/sasgui/plottools/plottables.py
r9c0f3c17 r45dffa69 229 229 if p.hidden == True: 230 230 continue 231 if not p.x ==None:231 if p.x is not None: 232 232 for x_i in p.x: 233 if min_value ==None or x_i < min_value:233 if min_value is None or x_i < min_value: 234 234 min_value = x_i 235 if max_value ==None or x_i > max_value:235 if max_value is None or x_i > max_value: 236 236 max_value = x_i 237 237 return min_value, max_value … … 562 562 Returns True if there is no data stored in the plottable 563 563 """ 564 if not self.x == None and len(self.x) == 0 \565 and not self.y == None and len(self.y) == 0:564 if (self.x is not None and len(self.x) == 0 565 and self.y is not None and len(self.y) == 0): 566 566 return True 567 567 return False … … 679 679 # Sanity check 680 680 # Do the transofrmation only when x and y are empty 681 has_err_x = not (dx ==None or len(dx) == 0)682 has_err_y = not (dy ==None or len(dy) == 0)683 684 if(x != None) and (y !=None):685 if not dx ==None and not len(dx) == 0 and not len(x) == len(dx):681 has_err_x = not (dx is None or len(dx) == 0) 682 has_err_y = not (dy is None or len(dy) == 0) 683 684 if(x is not None) and (y is not None): 685 if dx is not None and not len(dx) == 0 and not len(x) == len(dx): 686 686 msg = "Plottable.View: Given x and dx are not" 687 687 msg += " of the same length" … … 693 693 raise ValueError, msg 694 694 695 if not dy ==None and not len(dy) == 0 and not len(y) == len(dy):695 if dy is not None and not len(dy) == 0 and not len(y) == len(dy): 696 696 msg = "Plottable.View: Given y and dy are not of the same " 697 697 msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) … … 797 797 tempy = [] 798 798 tempdy = [] 799 if self.dx ==None:799 if self.dx is None: 800 800 self.dx = np.zeros(len(self.x)) 801 if self.dy ==None:801 if self.dy is None: 802 802 self.dy = np.zeros(len(self.y)) 803 803 if self.xLabel == "log10(x)": … … 827 827 tempy = [] 828 828 tempdy = [] 829 if self.dx ==None:829 if self.dx is None: 830 830 self.dx = np.zeros(len(self.x)) 831 if self.dy ==None:831 if self.dy is None: 832 832 self.dy = np.zeros(len(self.y)) 833 833 if self.yLabel == "log10(y)": … … 860 860 tempy = [] 861 861 tempdy = [] 862 if self.dx ==None:862 if self.dx is None: 863 863 self.dx = np.zeros(len(self.x)) 864 if self.dy ==None:864 if self.dy is None: 865 865 self.dy = np.zeros(len(self.y)) 866 if xmin != None and xmax !=None:866 if xmin is not None and xmax is not None: 867 867 for i in range(len(self.x)): 868 868 if self.x[i] >= xmin and self.x[i] <= xmax: … … 1206 1206 """ 1207 1207 """ 1208 if self._chisq ==None:1208 if self._chisq is None: 1209 1209 chisqTxt = r'$\chi^2=$' 1210 1210 else: -
src/sas/sasgui/plottools/transform.py
r959eb01 r7432acb 162 162 163 163 """ 164 if dx ==None:164 if dx is None: 165 165 dx = 0 166 166 return dx … … 175 175 176 176 """ 177 if dx ==None:177 if dx is None: 178 178 dx = 0 179 179 return dx … … 188 188 189 189 """ 190 if dx !=None:190 if dx is not None: 191 191 err = 2 * x * dx 192 192 return math.fabs(err) … … 204 204 """ 205 205 if x > 0: 206 if dx !=None:206 if dx is not None: 207 207 err = dx / (2 * math.sqrt(x)) 208 208 else: … … 222 222 223 223 """ 224 if dx !=None:224 if dx is not None: 225 225 err = 4 * math.pow(x, 3) * dx 226 226 return math.fabs(err) … … 238 238 """ 239 239 if x > 0: 240 if dx !=None:240 if dx is not None: 241 241 err = dx / (4 * math.pow(x, 3 / 4)) 242 242 else: … … 256 256 257 257 """ 258 if dx ==None:258 if dx is None: 259 259 dx = 0 260 260 … … 280 280 281 281 """ 282 if dx ==None:282 if dx is None: 283 283 dx = 0 284 284 … … 294 294 """ 295 295 """ 296 if dx ==None:297 dx = 0 298 if dy ==None:296 if dx is None: 297 dx = 0 298 if dy is None: 299 299 dy = 0 300 300 err = math.sqrt((2 * x * y * dx) ** 2 + ((x ** 2) * dy) ** 2) … … 314 314 raise ValueError, msg 315 315 if x != 0 and y != 0: 316 if dx ==None:316 if dx is None: 317 317 dx = 0 318 if dy ==None:318 if dy is None: 319 319 dy = 0 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 … … 337 337 raise ValueError, msg 338 338 if x > 0 and y > 0: 339 if dx ==None:339 if dx is None: 340 340 dx = 0 341 if dy ==None:341 if dy is None: 342 342 dy = 0 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 … … 353 353 """ 354 354 if x != 0: 355 if dx ==None:355 if dx is None: 356 356 dx = 0 357 357 err = dx / x ** 2 … … 367 367 """ 368 368 if x > 0: 369 if dx ==None:369 if dx is None: 370 370 dx = 0 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx … … 388 388 msg += " that are consistent with zero." 389 389 raise ValueError, msg 390 if dx ==None:391 dx = 0 392 if dy ==None:390 if dx is None: 391 dx = 0 392 if dy is None: 393 393 dy = 0 394 394 err = math.sqrt((4.0 * dx / x) ** 2 + (dy / y) ** 2) … … 406 406 # within errors 407 407 408 if dx ==None:409 dx = 0 410 if dy ==None:408 if dx is None: 409 dx = 0 410 if dy is None: 411 411 dy = 0 412 412 err = math.sqrt((dy * pow(x, 4)) ** 2 + (4 * y * dx * math.pow(x, 3)) ** 2)
Note: See TracChangeset
for help on using the changeset viewer.