Changeset afd45674 in sasview for calculatorview/src/sans


Ignore:
Timestamp:
Jan 18, 2013 6:05:38 PM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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
Message:

Added total volume param in the sasgen model

Location:
calculatorview/src/sans/perspectives/calculator
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/gen_scatter_panel.py

    rfad6056 rafd45674  
    580580        self.model.set_is_avg(is_avg) 
    581581        self.model.set_sld_data(self.sld_data) 
     582         
    582583        self.draw_button.Enable(self.sld_data!=None) 
    583584        wx.CallAfter(self.parent.set_sld_data, self.sld_data) 
     585        self._update_model_params() 
    584586        if is_draw: 
    585587            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                             
    587609    def _onparamEnter(self, event): 
    588610        """ 
     
    787809            return 
    788810        try: 
    789             #vol = self.parent.get_pix_volumes() 
    790             #self.model.set_pixel_volumes(vol) 
    791811            self.model.set_sld_data(self.sld_data) 
    792812            self.set_input_params() 
     
    15221542                    nop = npts 
    15231543                self.display_npts(nop) 
     1544                 
    15241545        ctl.Refresh() 
    15251546        return flag 
    15261547     
     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                     
    15271555    def _onstepsize(self, event): 
    15281556        """ 
     
    15471575                        s_size *= s_val 
    15481576                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) 
    15491580            except: 
    15501581                pass 
     
    15721603            self.npix_ctl.Refresh() 
    15731604            self.parent.set_etime() 
     1605            wx.CallAfter(self._set_volume_ctr_val, nop) 
    15741606        except: 
    15751607            # On Init 
     
    16071639    """ 
    16081640    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): 
    16101642        """ 
    16111643        Init 
     
    18351867        return vol 
    18361868     
     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             
    18371878    def set_omfpanel_default_shap(self, shape): 
    18381879        """ 
  • calculatorview/src/sans/perspectives/calculator/media/gen_sans_help.html

    r3657667 rafd45674  
    2727for &#946;<sub>j</sub> &#8800; 0 where v<sub>j</sub> is the volume of the j'th pixel  
    2828(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.  
     30This correction is useful especially for an atomic structure (taken from a pdb file) to get the right  
     31normalization. Note that the  &#946;<sub>j</sub> displayed in GUI may be incorrect but will not  
     32affect the scattering computation if the correction of the total volume is made. 
    3033<br> 
    3134The scattering length density (SLD) of each pixel where the SLD is uniform, is a combination of the nuclear and magnetic SLDs  
Note: See TracChangeset for help on using the changeset viewer.