Changeset afd45674 in sasview
- Timestamp:
- Jan 18, 2013 6:05:38 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:
- afcb052
- Parents:
- 1c6c1b7
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/gen_scatter_panel.py
rfad6056 rafd45674 580 580 self.model.set_is_avg(is_avg) 581 581 self.model.set_sld_data(self.sld_data) 582 582 583 self.draw_button.Enable(self.sld_data!=None) 583 584 wx.CallAfter(self.parent.set_sld_data, self.sld_data) 585 self._update_model_params() 584 586 if is_draw: 585 587 wx.CallAfter(self.sld_draw, False) 586 588 589 def _update_model_params(self): 590 """ 591 Update the model parameter values 592 """ 593 for list in self.parameters: 594 param_name = list[0].GetLabelText() 595 val = str(self.model.params[param_name]) 596 list[1].SetValue(val) 597 598 def set_volume_ctl_val(self, val): 599 """ 600 Set volume txtctrl value 601 """ 602 for list in self.parameters: 603 param_name = list[0].GetLabelText() 604 if param_name.lower() == 'total_volume': 605 list[1].SetValue(val) 606 list[1].Refresh() 607 break 608 587 609 def _onparamEnter(self, event): 588 610 """ … … 787 809 return 788 810 try: 789 #vol = self.parent.get_pix_volumes()790 #self.model.set_pixel_volumes(vol)791 811 self.model.set_sld_data(self.sld_data) 792 812 self.set_input_params() … … 1522 1542 nop = npts 1523 1543 self.display_npts(nop) 1544 1524 1545 ctl.Refresh() 1525 1546 return flag 1526 1547 1548 def _set_volume_ctr_val(self, npts): 1549 """ 1550 Set total volume 1551 """ 1552 total_volume = npts * self.sld_data.vol_pix[0] 1553 self.parent.set_volume_ctr_val(total_volume) 1554 1527 1555 def _onstepsize(self, event): 1528 1556 """ … … 1547 1575 s_size *= s_val 1548 1576 self.sld_data.set_pixel_volumes(s_size) 1577 if ctl.IsEnabled(): 1578 total_volume = sum(self.sld_data.vol_pix) 1579 self.parent.set_volume_ctr_val(total_volume) 1549 1580 except: 1550 1581 pass … … 1572 1603 self.npix_ctl.Refresh() 1573 1604 self.parent.set_etime() 1605 wx.CallAfter(self._set_volume_ctr_val, nop) 1574 1606 except: 1575 1607 # On Init … … 1607 1639 """ 1608 1640 def __init__(self, parent=None, title="Generic Scattering Calculator", 1609 size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1. 57), *args, **kwds):1641 size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1.65), *args, **kwds): 1610 1642 """ 1611 1643 Init … … 1835 1867 return vol 1836 1868 1869 def set_volume_ctr_val(self, val): 1870 """ 1871 Set volume txtctl value 1872 """ 1873 try: 1874 self.panel.set_volume_ctl_val(str(val)) 1875 except: 1876 print "self.panel is not initialized yet" 1877 1837 1878 def set_omfpanel_default_shap(self, shape): 1838 1879 """ -
calculatorview/src/sans/perspectives/calculator/media/gen_sans_help.html
r3657667 rafd45674 27 27 for β<sub>j</sub> ≠ 0 where v<sub>j</sub> is the volume of the j'th pixel 28 28 (or the j'th natural atomic volume (= atomic mass/natural molar density/Abogadro number) 29 for the atomic structures given by a pdb file). 29 for the atomic structures). The total volume V can be corrected by users. 30 This correction is useful especially for an atomic structure (taken from a pdb file) to get the right 31 normalization. Note that the β<sub>j</sub> displayed in GUI may be incorrect but will not 32 affect the scattering computation if the correction of the total volume is made. 30 33 <br> 31 34 The scattering length density (SLD) of each pixel where the SLD is uniform, is a combination of the nuclear and magnetic SLDs -
sanscalculator/src/sans/calculator/sans_gen.py
rcd89c6f rafd45674 61 61 self.params['background'] = 0.0 62 62 self.params['solvent_SLD'] = 0.0 63 self.params['total_volume'] = 1.0 63 64 self.params['Up_frac_in'] = 1.0 64 65 self.params['Up_frac_out'] = 1.0 … … 70 71 self.details['background'] = ['[1/cm]', None, None] 71 72 self.details['solvent_SLD'] = ['1/A^(2)', None, None] 73 self.details['total_volume'] = ['A^(3)', None, None] 72 74 self.details['Up_frac_in'] = ['[u/(u+d)]', None, None] 73 75 self.details['Up_frac_out'] = ['[u/(u+d)]', None, None] … … 113 115 114 116 mod.genicom(model, len_q, x, y, i) 115 return self.params['scale'] * i + self.params['background'] 117 vol_correction = self.data_total_volume / self.params['total_volume'] 118 return self.params['scale'] * vol_correction * i + \ 119 self.params['background'] 116 120 117 121 def set_sld_data(self, sld_data=None): … … 129 133 self.data_mz = sld_data.sld_mz 130 134 self.data_vol = sld_data.vol_pix 135 self.data_total_volume = sum(sld_data.vol_pix) 136 self.params['total_volume'] = sum(sld_data.vol_pix) 131 137 132 138 def getProfile(self):
Note: See TracChangeset
for help on using the changeset viewer.