Changeset dbc01f2 in sasview for calculatorview
- Timestamp:
- Jan 10, 2013 5:16:51 PM (12 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:
- b1174ec
- Parents:
- 2d9c7266
- Location:
- calculatorview/src/sans/perspectives/calculator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/gen_scatter_panel.py
r3cfa760 rdbc01f2 353 353 x_in = n_qbins * n_pixs / 100000 354 354 # magic equation: not very accurate 355 etime = 0.00001 + 0.085973* x_in355 etime = 1.0 + 0.14 * x_in 356 356 return int(etime) 357 357 … … 526 526 else: 527 527 raise 528 for name, _, unit in self.parameters:529 if name.GetLabelText() == 'background':530 if is_pdbdata:531 unit.SetLabel('[A^(2)]')532 else:533 unit.SetLabel('[1/cm]')534 break535 528 self._set_sld_data_helper(True) 536 529 except: … … 575 568 Draw 3D sld profile 576 569 """ 570 color_dic = {'H':'blue', 'D':'purple', 'N': 'orange', 571 'O':'red', 'C':'green', 'Other':'k'} 577 572 graph_title = self.file_name 578 573 graph_title += " 3D SLD Profile " 574 579 575 flag = self.parent.check_omfpanel_inputs() 580 576 if not flag: … … 595 591 add_icon(self.parent, frame) 596 592 panel = frame.plotpanel 593 597 594 try: 598 595 # mpl >= 1.0.0 … … 606 603 logging.error("PlotPanel could not import Axes3D") 607 604 raise 605 608 606 marker = ',' 609 607 m_size = 2 … … 622 620 is_nonzero = sld_tot > 0.0 623 621 is_zero = sld_tot == 0.0 622 623 # Plot null points 624 624 if is_zero.any(): 625 625 ax.plot(pos_x[is_zero], pos_z[is_zero], pos_y[is_zero], marker, … … 632 632 sld_my = sld_my[is_nonzero] 633 633 sld_mz = sld_mz[is_nonzero] 634 635 ax.plot(pos_x, pos_z, pos_y, 636 marker, c="k", 637 alpha=0.5, markeredgecolor="k", markersize=m_size) 634 635 # Plot selective points in color 636 for key in color_dic.keys(): 637 chosen_color = output.pix_symbol == key 638 other_color = numpy.ones(len(output.pix_symbol), dtype='bool') 639 if chosen_color.any(): 640 other_color = other_color & (chosen_color != True) 641 color = color_dic[key] 642 ax.plot(pos_x[chosen_color], pos_z[chosen_color], 643 pos_y[chosen_color], marker, c=color, alpha=0.5, 644 markeredgecolor=color, markersize=m_size, label=key) 645 # Plot All others 646 if other_color.any(): 647 ax.plot(pos_x[other_color], pos_z[other_color], pos_y[other_color], 648 marker, c="k", alpha=0.5, markeredgecolor="k", 649 markersize=m_size, label="Other") 638 650 639 651 if has_arrow and len(pos_x) > 0: … … 643 655 draw w/arrow 644 656 """ 645 #frame.SetSize(wx.Size(650, 570))646 #event.Skip()647 657 max_mx = max(numpy.fabs(sld_mx)) 648 658 max_my = max(numpy.fabs(sld_my)) … … 679 689 mutation_scale=10, lw=1, 680 690 arrowstyle="->", alpha = 0.5) 681 ax.add_artist(arrows) 682 691 ax.add_artist(arrows) 683 692 except: 684 693 pass … … 701 710 ax.set_ylabel('z ($\A%s$)'% output.pos_unit) 702 711 ax.set_zlabel('y ($\A%s$)'% output.pos_unit) 712 if output.pix_type == 'atom': 713 ax.legend(loc='upper left', prop={'size':10}) 703 714 num_graph = str(self.graph_num) 704 715 frame.SetTitle('Graph %s: %s'% (num_graph, graph_title)) … … 743 754 return 744 755 try: 745 vol = self.parent.get_pix_volume()746 self.model.set_pixel_volume(vol)756 #vol = self.parent.get_pix_volumes() 757 #self.model.set_pixel_volumes(vol) 747 758 self.model.set_sld_data(self.sld_data) 748 759 self.set_input_params() … … 754 765 755 766 cal_out = CalcGen(input=[self.data.qx_data, 756 self.data.qy_data, i_out],767 self.data.qy_data, i_out], 757 768 completefn=self.complete, 758 769 updatefn=self._update) … … 1043 1054 return self.sld_data 1044 1055 1045 def get_pix_volume (self):1056 def get_pix_volumes(self): 1046 1057 """ 1047 1058 Get the pixel volume 1048 1059 """ 1049 val = 1 1050 if self.sld_data.pix_type == 'pixel': 1051 for lst in self.stepsize: 1052 val *= float(lst[1].GetValue()) 1053 1054 return numpy.fabs(val) 1060 vol = self.sld_data.vol_pix 1061 1062 return vol 1055 1063 1056 1064 def _get_other_val(self): … … 1270 1278 ctl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 1271 1279 style=wx.TE_PROCESS_ENTER) 1280 ctl.Bind(wx.EVT_TEXT, self._onstepsize ) 1272 1281 ctl.SetValue(format_number(value, True)) 1273 1282 ctl.Enable(not is_data) … … 1387 1396 ctr_list[1].SetValue(format_number(mean_val, True)) 1388 1397 ctr_list[1].Enable(enable) 1389 ctr_list[2].SetLabel("[" + sld_data.sld_unit + "]")1398 #ctr_list[2].SetLabel("[" + sld_data.sld_unit + "]") 1390 1399 break 1391 1400 … … 1483 1492 return flag 1484 1493 1494 def _onstepsize(self, event): 1495 """ 1496 On stepsize event 1497 """ 1498 flag = True 1499 if event != None: 1500 event.Skip() 1501 ctl = event.GetEventObject() 1502 ctl.SetBackgroundColour("white") 1503 1504 if flag and not self.sld_data.is_data:#ctl.IsEnabled(): 1505 s_size = 1.0 1506 try: 1507 for item in self.stepsize: 1508 s_val = float(item[1].GetValue()) 1509 if s_val <= 0: 1510 item[1].SetBackgroundColour("pink") 1511 ctl.Refresh() 1512 return 1513 if numpy.isfinite(s_val): 1514 s_size *= s_val 1515 self.sld_data.set_pixel_volumes(s_size) 1516 except: 1517 pass 1518 ctl.Refresh() 1519 1520 1485 1521 def set_npts_from_slddata(self): 1486 1522 """ … … 1759 1795 return n_pix 1760 1796 1761 def get_pix_volume (self):1797 def get_pix_volumes(self): 1762 1798 """ 1763 1799 Get a pixel volume 1764 1800 """ 1765 vol = self.omfpanel.get_pix_volume ()1801 vol = self.omfpanel.get_pix_volumes() 1766 1802 return vol 1767 1803 -
calculatorview/src/sans/perspectives/calculator/load_thread.py
rdbc5dc9b rdbc01f2 3 3 """ 4 4 import time 5 import wx6 5 from data_util.calcthread import CalcThread 7 6 from sans.dataloader.loader import Loader -
calculatorview/src/sans/perspectives/calculator/media/gen_sans_help.html
r54d6c3e rdbc01f2 115 115 For example, both values are 0.5 for unpolarized neutrons. 116 116 <br> 117 *Note II: The unit of intensity calculated from .sld, .omf, or .txt files is 1/cm, otherwise 118 it is Å<sup>2</sup>. (In the first equation above, the V is set to 1.) 119 <br> 120 *Note III: This computation is totally based on the pixel (or atomic) data fixed 117 *Note II: This computation is totally based on the pixel (or atomic) data fixed 121 118 in the xyz coordinates. Thus no angular orientational averaging is considered. 122 119 <br> 123 *Note IV: For the nuclear scattering length density, only the real component is taken account. 120 *Note III: For the nuclear scattering length density, only the real component is taken account. 121 <br> 124 122 </body>
Note: See TracChangeset
for help on using the changeset viewer.