Changeset d620d03c in sasview for src/sas/sasgui/perspectives/calculator
- Timestamp:
- Apr 1, 2019 9:35:50 PM (6 years ago)
- Parents:
- fa307dd (diff), 0dde203 (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 Kienzle <pkienzle@…> (04/01/19 21:35:50)
- git-committer:
- GitHub <noreply@…> (04/01/19 21:35:50)
- Location:
- src/sas/sasgui/perspectives/calculator
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/data_editor.py
r5251ec6 ra5e1b6ca 19 19 _QMAX_DEFAULT = 0.13 20 20 _NPTS_DEFAULT = 50 21 #Control panel width 21 #Control panel width 22 22 if sys.platform.count("darwin") == 0: 23 23 PANEL_WIDTH = 500 … … 196 196 summary = 'No data info available...' 197 197 self.data_summary.SetValue(summary) 198 #self.summary_sizer.Add(self.data_summary, 1, wx.EXPAND|wx.ALL, 10) 198 #self.summary_sizer.Add(self.data_summary, 1, wx.EXPAND|wx.ALL, 10) 199 199 200 200 def _layout_button(self): … … 579 579 wildcard = "CanSAS 1D files(*.xml)|*.xml" 580 580 dlg = wx.FileDialog(self, "Choose a file", 581 self._default_save_location, "", wildcard , wx.SAVE) 581 self._default_save_location, "", wildcard , 582 wx.FD_SAVE) 582 583 583 584 for data in self._data: -
src/sas/sasgui/perspectives/calculator/data_operator.py
r5251ec6 r34f23c8 866 866 except: 867 867 # toolbar event 868 pos_x, pos_y = self.toolbar.GetPosition Tuple()868 pos_x, pos_y = self.toolbar.GetPosition() 869 869 pos = (pos_x, pos_y + 5) 870 870 self.PopupMenu(slicerpop, pos) -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r5251ec6 ra5e1b6ca 43 43 44 44 _BOX_WIDTH = 76 45 #Slit length panel size 45 #Slit length panel size 46 46 if sys.platform.count("win32") > 0: 47 47 PANEL_TOP = 0 … … 133 133 #kwds['style'] = wx.SUNKEN_BORDER 134 134 PanelBase.__init__(self) 135 #Font size 135 #Font size 136 136 self.SetWindowVariant(variant=FONT_VARIANT) 137 137 self.SetupScrolling() 138 #thread to read data 138 #thread to read data 139 139 self.reader = None 140 140 self.ext = None … … 218 218 iy = 0 219 219 param_title = wx.StaticText(self, -1, 'Parameter') 220 sizer.Add(param_title, (iy, ix), (1, 1), \221 220 sizer.Add(param_title, (iy, ix), (1, 1), 221 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 222 222 ix += 1 223 223 value_title = wx.StaticText(self, -1, 'Value') 224 sizer.Add(value_title, (iy, ix), (1, 1), \225 224 sizer.Add(value_title, (iy, ix), (1, 1), 225 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 226 226 ix += 1 227 227 unit_title = wx.StaticText(self, -1, 'Unit') 228 sizer.Add(unit_title, (iy, ix), (1, 1), \229 228 sizer.Add(unit_title, (iy, ix), (1, 1), 229 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 230 230 for param in sorted(params.keys()): 231 231 iy += 1 232 232 ix = 0 233 233 p_name = wx.StaticText(self, -1, param) 234 sizer.Add(p_name, (iy, ix), (1, 1), \235 234 sizer.Add(p_name, (iy, ix), (1, 1), 235 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 236 236 ## add parameter value 237 237 ix += 1 … … 239 239 ctl = InputTextCtrl(self, -1, size=(_BOX_WIDTH * 2, 20), 240 240 style=wx.TE_PROCESS_ENTER) 241 #ctl.SetToolTipString( \241 #ctl.SetToolTipString( 242 242 # "Hit 'Enter' after typing to update the plot.") 243 243 ctl.SetValue(format_number(value, True)) … … 246 246 ix += 1 247 247 unit = wx.StaticText(self, -1, details[param][0]) 248 sizer.Add(unit, (iy, ix), (1, 1), \249 248 sizer.Add(unit, (iy, ix), (1, 1), 249 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 250 250 self.parameters.append([p_name, ctl, unit]) 251 251 … … 340 340 iy = 0 341 341 name = wx.StaticText(self, -1, 'No. of Qx (Qy) bins: ') 342 sizer.Add(name, (iy, ix), (1, 1), \343 342 sizer.Add(name, (iy, ix), (1, 1), 343 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 344 344 ## add parameter value 345 345 ix += 1 346 346 self.npt_ctl = InputTextCtrl(self, -1, size=(_BOX_WIDTH * 1.5, 20), 347 style=wx.TE_PROCESS_ENTER)347 style=wx.TE_PROCESS_ENTER) 348 348 self.npt_ctl.Bind(wx.EVT_TEXT, self._onparamEnter) 349 349 self.npt_ctl.SetValue(format_number(self.npts_x, True)) … … 352 352 ix += 1 353 353 unit = wx.StaticText(self, -1, '') 354 sizer.Add(unit, (iy, ix), (1, 1), \355 354 sizer.Add(unit, (iy, ix), (1, 1), 355 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 356 356 iy += 1 357 357 ix = 0 358 358 name = wx.StaticText(self, -1, 'Qx (Qy) Max: ') 359 sizer.Add(name, (iy, ix), (1, 1), \360 359 sizer.Add(name, (iy, ix), (1, 1), 360 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 361 361 ## add parameter value 362 362 ix += 1 … … 369 369 ix += 1 370 370 unit = wx.StaticText(self, -1, '[1/A]') 371 sizer.Add(unit, (iy, ix), (1, 1), \372 371 sizer.Add(unit, (iy, ix), (1, 1), 372 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 373 373 self.qrange_sizer.Add(sizer, 0, wx.LEFT, 10) 374 374 … … 684 684 self.sld_data = self.parent.get_sld_from_omf() 685 685 output = self.sld_data 686 #frame_size = wx.Size(470, 470) 686 #frame_size = wx.Size(470, 470) 687 687 self.plot_frame = PlotFrame(self, -1, 'testView') 688 688 frame = self.plot_frame … … 703 703 panel.dimension = 3 704 704 graph_title = self._sld_plot_helper(ax, output, has_arrow) 705 # Use y, z axes (in mpl 3d) as z, y axes 705 # Use y, z axes (in mpl 3d) as z, y axes 706 706 # that consistent with our SAS detector coords. 707 ax.set_xlabel('x ($\A%s$)' % output.pos_unit) 708 ax.set_ylabel('z ($\A%s$)' % output.pos_unit) 709 ax.set_zlabel('y ($\A%s$)' % output.pos_unit) 707 # Format Angstrom units (A) as latex $\AA$ 708 units = output.pos_unit if output.pos_unit != "A" else r"$\AA$" 709 ax.set_xlabel('x (%s)' % units) 710 ax.set_ylabel('z (%s)' % units) 711 ax.set_zlabel('y (%s)' % units) 710 712 panel.subplot.figure.subplots_adjust(left=0.05, right=0.95, 711 713 bottom=0.05, top=0.96) … … 741 743 marker = 'o' 742 744 m_size = 3.5 743 sld_tot = (np.fabs(sld_mx) + np.fabs(sld_my) + \744 np.fabs(sld_mz) + np.fabs(output.sld_n))745 sld_tot = (np.fabs(sld_mx) + np.fabs(sld_my) 746 + np.fabs(sld_mz) + np.fabs(output.sld_n)) 745 747 is_nonzero = sld_tot > 0.0 746 748 is_zero = sld_tot == 0.0 … … 766 768 pos_y[chosen_color], marker, c=color, alpha=0.5, 767 769 markeredgecolor=color, markersize=m_size, label=key) 768 # III. Plot All others 770 # III. Plot All others 769 771 if np.any(other_color): 770 772 a_name = '' … … 1028 1030 self.data = Data2D() 1029 1031 qmax = self.qmax_x #/ np.sqrt(2) 1030 self.data.xaxis( '\\rm{Q_{x}}','\AA^{-1}')1031 self.data.yaxis( '\\rm{Q_{y}}','\AA^{-1}')1032 self.data.xaxis(r'\rm{Q_{x}}', r'\AA^{-1}') 1033 self.data.yaxis(r'\rm{Q_{y}}', r'\AA^{-1}') 1032 1034 self.data.is_data = False 1033 1035 self.data.id = str(self.uid) + " GenData" … … 1120 1122 new_plot.dx = data.dx 1121 1123 new_plot.dy = data.dy 1122 new_plot.xaxis( '\\rm{Q_{x}}','\AA^{-1}')1123 new_plot.yaxis( '\\rm{Intensity}', 'cm^{-1}')1124 new_plot.xaxis(r'\rm{Q_{x}}', r'\AA^{-1}') 1125 new_plot.yaxis(r'\rm{Intensity}', 'cm^{-1}') 1124 1126 new_plot.is_data = False 1125 1127 new_plot.id = str(self.uid) + " GenData1D" … … 1127 1129 new_plot.name = model.name + '1d' 1128 1130 new_plot.title = "Generic model1D " 1129 new_plot.id = str(page_id) + ': ' + self.file_name \1130 + ' #%s' % str(self.graph_num) + "_1D"1131 new_plot.group_id = str(page_id) + " Model1D" + \1132 ' #%s' % str(self.graph_num) + "_1D"1131 new_plot.id = (str(page_id) + ': ' + self.file_name 1132 + ' #%s' % str(self.graph_num) + "_1D") 1133 new_plot.group_id = (str(page_id) + " Model1D" 1134 + ' #%s' % str(self.graph_num) + "_1D") 1133 1135 new_plot.is_data = False 1134 1136 … … 1175 1177 new_plot.name = model.name + '2d' 1176 1178 new_plot.title = "Generic model 2D " 1177 new_plot.id = str(page_id) + ': ' + self.file_name \1178 + ' #%s' % str(self.graph_num) + "_2D"1179 new_plot.group_id = str(page_id) + " Model2D" \1180 + ' #%s' % str(self.graph_num) + "_2D"1179 new_plot.id = (str(page_id) + ': ' + self.file_name 1180 + ' #%s' % str(self.graph_num) + "_2D") 1181 new_plot.group_id = (str(page_id) + " Model2D" 1182 + ' #%s' % str(self.graph_num) + "_2D") 1181 1183 new_plot.detector = data.detector 1182 1184 new_plot.source = data.source … … 1243 1245 *args, **kwds) 1244 1246 PanelBase.__init__(self) 1245 #Font size 1247 #Font size 1246 1248 self.SetWindowVariant(variant=FONT_VARIANT) 1247 1249 self.SetupScrolling() … … 1446 1448 ix = 0 1447 1449 name = wx.StaticText(self, -1, key) 1448 sizer.Add(name, (iy, ix), (1, 1), \1449 1450 sizer.Add(name, (iy, ix), (1, 1), 1451 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1450 1452 ## add parameter value 1451 1453 ix += 1 … … 1459 1461 s_unit = '[' + omfdata.sld_unit + ']' 1460 1462 unit = wx.StaticText(self, -1, s_unit) 1461 sizer.Add(unit, (iy, ix), (1, 1), \1462 1463 sizer.Add(unit, (iy, ix), (1, 1), 1464 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1463 1465 self.slds.append([key, ctl, unit]) 1464 1466 self.sld_sizer.Add(sizer, 0, wx.LEFT, 10) … … 1481 1483 ix = 0 1482 1484 name = wx.StaticText(self, -1, key) 1483 sizer.Add(name, (iy, ix), (1, 1), \1484 1485 sizer.Add(name, (iy, ix), (1, 1), 1486 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1485 1487 ## add parameter value 1486 1488 ix += 1 … … 1494 1496 ix += 1 1495 1497 unit = wx.StaticText(self, -1, '') 1496 sizer.Add(unit, (iy, ix), (1, 1), \1497 1498 sizer.Add(unit, (iy, ix), (1, 1), 1499 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1498 1500 self.nodes.append([key, ctl, unit]) 1499 1501 self.node_sizer.Add(sizer, 0, wx.LEFT, 10) … … 1516 1518 ix = 0 1517 1519 name = wx.StaticText(self, -1, key) 1518 sizer.Add(name, (iy, ix), (1, 1), \1519 1520 sizer.Add(name, (iy, ix), (1, 1), 1521 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1520 1522 ## add parameter value 1521 1523 ix += 1 … … 1530 1532 p_unit = '[' + omfdata.pos_unit + ']' 1531 1533 unit = wx.StaticText(self, -1, p_unit) 1532 sizer.Add(unit, (iy, ix), (1, 1), \1533 1534 sizer.Add(unit, (iy, ix), (1, 1), 1535 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1534 1536 self.stepsize.append([key, ctl, unit]) 1535 1537 self.step_sizer.Add(sizer, 0, wx.LEFT, 10) … … 1626 1628 for ctr_list in self.slds: 1627 1629 ctr_list[1].Enable(False) 1628 #break 1630 #break 1629 1631 return 1630 1632 … … 1637 1639 max_val = np.max(sld_list[key]) 1638 1640 mean_val = np.mean(sld_list[key]) 1639 enable = ( min_val == max_val) and \1640 sld_data.pix_type == 'pixel'1641 enable = ((min_val == max_val) 1642 and sld_data.pix_type == 'pixel') 1641 1643 ctr_list[1].SetValue(format_number(mean_val, True)) 1642 1644 ctr_list[1].Enable(enable) … … 1669 1671 location, "sld_file", 1670 1672 extension, 1671 wx. SAVE)1673 wx.FD_SAVE) 1672 1674 if dlg.ShowModal() == wx.ID_OK: 1673 1675 path = dlg.GetPath() -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r5251ec6 r34f23c8 62 62 # Any other formats (tiff, jpeg, etc) are passed 63 63 # to PIL which seems to have a problem in version 64 # 1.1.7 that causes a close error which shows up in 64 # 1.1.7 that causes a close error which shows up in 65 65 # the log file. This does not seem to have any adverse 66 66 # effects. PDB --- September 17, 2017. … … 383 383 print(err_msg) 384 384 385 self. OnClose(event)385 self.EndModal(wx.ID_OK) 386 386 387 387 def convert_image(self, rgb, xmin, xmax, ymin, ymax, zscale): … … 417 417 output.ymin = ymin 418 418 output.ymax = ymax 419 output.xaxis( '\\rm{Q_{x}}','\AA^{-1}')420 output.yaxis( '\\rm{Q_{y}}','\AA^{-1}')419 output.xaxis(r'\rm{Q_{x}}', r'\AA^{-1}') 420 output.yaxis(r'\rm{Q_{y}}', r'\AA^{-1}') 421 421 # Store loading process information 422 422 output.meta_data['loader'] = self.title.split('.')[-1] + "Reader" … … 451 451 # clear event 452 452 event.Skip() 453 self.Destroy() 453 self.EndModal(wx.ID_CANCEL) 454 #self.Destroy() 454 455 455 456 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.