Ignore:
Timestamp:
Jun 16, 2017 12:51:12 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
940d034, fca1f50
Parents:
c0ef8da (diff), d9c1551 (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.
Message:

Merge branch 'master' into ticket-510

Location:
src/sas/sasgui/perspectives/invariant
Files:
1 added
5 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/invariant/invariant.py

    r463e7ffc r7432acb  
    331331        new_plot.title = self.__data.title 
    332332        # Save theory_data in a state 
    333         if data != None: 
     333        if data is not None: 
    334334            name_head = name.split('-') 
    335335            if name_head[0] == 'Low': 
     
    353353 
    354354        # Save data in a state: but seems to never happen 
    355         if new_plot != None: 
     355        if new_plot is not None: 
    356356            self.invariant_panel.state.data = copy.deepcopy(new_plot) 
    357357        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 
  • src/sas/sasgui/perspectives/invariant/invariant_panel.py

    r463e7ffc r7432acb  
    240240        """ 
    241241 
    242         if state == None and data == None: 
     242        if state is None and data is None: 
    243243            self.state = IState() 
    244         elif state == None or data == None: 
     244        elif state is None or data is None: 
    245245            return 
    246246        else: 
     
    604604        compute invariant 
    605605        """ 
    606         if self._data == None: 
     606        if self._data is None: 
    607607            msg = "\n\nData must be loaded first in order" 
    608608            msg += " to perform a compution..." 
    609609            wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    610610        # set a state for this computation for saving 
    611         elif event != None: 
     611        elif event is not None: 
    612612            self._set_compute_state(state='compute') 
    613613            self._set_bookmark_flag(True) 
     
    718718        self._set_preview_flag(True) 
    719719 
    720         if event != None: 
     720        if event is not None: 
    721721            self._set_preview_flag(True) 
    722722            self._set_save_flag(True) 
     
    792792        : param state_num: the given state number 
    793793        """ 
    794         if state_num == None: 
     794        if state_num is None: 
    795795            return 
    796796 
     
    924924        :param event: rb/cb event 
    925925        """ 
    926         if event == None: 
     926        if event is None: 
    927927            return 
    928928        obj = event.GetEventObject() 
     
    934934 
    935935        try: 
    936             if value == None or value.lstrip().rstrip() == '': 
     936            if value is None or value.lstrip().rstrip() == '': 
    937937                value = 'None' 
    938938            setattr(self.state, name, str(value)) 
     
    10131013        Used in 'set_current_data()' 
    10141014        """ 
    1015         #if data == None: return 
     1015        #if data is None: return 
    10161016        #temp_state = self.state.clone_state() 
    10171017        #copy.deepcopy(self.state.saved_state) 
     
    10221022        self.state.saved_state['state_num'] = 0 
    10231023        self.state.saved_state['compute_num'] = 0 
    1024         if self._data != None: 
     1024        if self._data is not None: 
    10251025            self.state.saved_state['file'] = str(self._data.name) 
    10261026        else: 
     
    10491049 
    10501050        """ 
    1051         if self._data == None: 
     1051        if self._data is None: 
    10521052            return 
    10531053        # check if this event is from do/undo button 
     
    10721072        # try to add new state of the text changes in the state_list 
    10731073        try: 
    1074             if value.strip() == None: 
     1074            if value.strip() is None: 
    10751075                value = '' 
    10761076            setattr(self.state, name, str(value)) 
     
    11401140        the popup menu on bookmark context menu event 
    11411141        """ 
    1142         if self._data == None: 
     1142        if self._data is None: 
    11431143            return 
    1144         if event == None: 
     1144        if event is None: 
    11451145            return 
    11461146        self.bookmark_num += 1 
     
    12061206        : event: popUpMenu event 
    12071207        """ 
    1208         if event == None: 
     1208        if event is None: 
    12091209            return 
    12101210        # get the object 
     
    12441244        # Ask the user the location of the file to write to. 
    12451245        path = None 
    1246         if self.parent != None: 
     1246        if self.parent is not None: 
    12471247            self._default_save_location = self.parent.get_save_location() 
    1248         if self._default_save_location == None: 
     1248        if self._default_save_location is None: 
    12491249            self._default_save_location = os.getcwd() 
    12501250        dlg = wx.FileDialog(self, "Choose a file", 
     
    12541254            path = dlg.GetPath() 
    12551255            self._default_save_location = os.path.dirname(path) 
    1256             if self.parent != None: 
     1256            if self.parent is not None: 
    12571257                self.parent._default_save_location = \ 
    12581258                    self._default_save_location 
     
    13931393        Enable and disable the power value editing 
    13941394        """ 
    1395         if event != None: 
     1395        if event is not None: 
    13961396            self._set_bookmark_flag(True) 
    13971397            self._set_preview_flag(False) 
     
    14111411        Disable or enable some button if the user enable low q extrapolation 
    14121412        """ 
    1413         if event != None: 
     1413        if event is not None: 
    14141414            self._set_bookmark_flag(True) 
    14151415            self._set_preview_flag(False) 
     
    14381438        Enable editing power law section at low q range 
    14391439        """ 
    1440         if event != None: 
     1440        if event is not None: 
    14411441            self._set_bookmark_flag(True) 
    14421442            self._set_preview_flag(False) 
     
    15371537        Enable and disable the power value editing 
    15381538        """ 
    1539         if event != None: 
     1539        if event is not None: 
    15401540            self._set_bookmark_flag(True) 
    15411541 
     
    15541554        Disable or enable some button if the user enable high q extrapolation 
    15551555        """ 
    1556         if event != None: 
     1556        if event is not None: 
    15571557            self._set_bookmark_flag(True) 
    15581558            self._set_preview_flag(False) 
  • src/sas/sasgui/perspectives/invariant/invariant_state.py

    r463e7ffc r7432acb  
    281281        # File name 
    282282        element = newdoc.createElement("filename") 
    283         if self.file != None and self.file != '': 
     283        if self.file is not None and self.file != '': 
    284284            element.appendChild(newdoc.createTextNode(str(self.file))) 
    285285        else: 
     
    734734                    # invstate could be None when .svs file is loaded 
    735735                    # in this case, skip appending to output 
    736                     if invstate != None: 
     736                    if invstate is not None: 
    737737                        sas_entry.meta_data['invstate'] = invstate 
    738738                        sas_entry.filename = invstate.file 
     
    787787            raise RuntimeError, msg 
    788788        # make sure title and data run is filled up. 
    789         if datainfo.title == None or datainfo.title == '': 
     789        if datainfo.title is None or datainfo.title == '': 
    790790            datainfo.title = datainfo.name 
    791         if datainfo.run_name == None or datainfo.run_name == {}: 
     791        if datainfo.run_name is None or datainfo.run_name == {}: 
    792792            datainfo.run = [str(datainfo.name)] 
    793793            datainfo.run_name[0] = datainfo.name 
  • src/sas/sasgui/perspectives/invariant/media/invariant_help.rst

    r484141c r094b9eb  
    1010----------- 
    1111 
    12 The scattering, or Porod, invariant (Q*\) is a model-independent quantity that  
     12The scattering, or Porod, invariant ($Q^*$) is a model-independent quantity that 
    1313can be easily calculated from scattering data. 
    1414 
    15 For two phase systems, the scattering invariant is defined as the integral of  
    16 the square of the wave transfer (Q) multiplied by the scattering cross section  
    17 over the full range of Q from zero to infinity, that is 
     15For two phase systems, the scattering invariant is defined as the integral of 
     16the square of the wavevector transfer ($Q$) multiplied by the scattering cross section 
     17over the full range of $Q$ from zero to infinity, that is 
    1818 
    19 .. image:: image001.gif 
     19.. math:: 
    2020 
    21 where *g = q* for pinhole geometry (SAS) and *g = q*\ :sub:`v` (the slit height) for   
    22 slit geometry (USAS). 
     21    Q^* = \int_0^\infty q^2I(q)\,dq 
    2322 
    24 The worth of Q*\  is that it can be used to determine the volume fraction and  
    25 the specific area of a sample. Whilst these quantities are useful in their own  
     23in the case of pinhole geometry. For slit geometry the invariant is given by 
     24 
     25.. math:: 
     26 
     27    Q^* = \Delta q_v \int_0^\infty qI(q)\,dq 
     28 
     29where $\Delta q_v$ is the slit height. 
     30 
     31The worth of $Q^*$  is that it can be used to determine the volume fraction and 
     32the specific area of a sample. Whilst these quantities are useful in their own 
    2633right they can also be used in further analysis. 
    2734 
    28 The difficulty with using Q*\  arises from the fact that experimental data is  
    29 never measured over the range 0 =< *Q* =< infinity. At best, combining USAS and  
    30 WAS data might cover the range 1e-5 =< *Q* =< 10 1/\ |Ang| . Thus it is usually  
    31 necessary to extrapolate the experimental data to low and high *Q*. For this 
     35The difficulty with using $Q^*$  arises from the fact that experimental data is 
     36never measured over the range $0 \le Q \le \infty$. At best, combining USAS and 
     37WAS data might cover the range $10^{-5} \le Q \le 10$ 1/\ |Ang| . Thus it is usually 
     38necessary to extrapolate the experimental data to low and high $Q$. For this 
    3239 
    33 High-*Q* region (>= *Qmax* in data) 
     40High-\ $Q$ region (>= *Qmax* in data) 
    3441 
    35 *  The power law function *C*/*Q*\ :sup:`4` is used where the constant  
    36    *C* (= 2.\ |pi|\ .(\ |bigdelta|\ |rho|\ ).\ *Sv*\ ) is to be found by fitting part of data  
    37    within the range *Q*\ :sub:`N-m` to *Q*\ :sub:`N` (where m < N). 
     42*  The power law function $C/Q^4$ is used where the constant 
     43   $C = 2 \pi \Delta\rho S_v$ is to be found by fitting part of data 
     44   within the range $Q_{N-m}$ to $Q_N$ (where $m < N$). 
    3845 
    39 Low-*Q* region (<= *Qmin* in data) 
     46Low-\ $Q$ region (<= *Qmin* in data) 
    4047 
    41 *  The Guinier function *I0.exp(-Rg*\ :sup:`2`\ *Q*\ :sup:`2`\ */3)* where *I0*  
    42    and *Rg* are obtained by fitting as for the high-*Q* region above.  
     48*  The Guinier function $I_0 exp(-R_g^2 Q^2/3)$ where $I_0$ 
     49   and $R_g$ are obtained by fitting as for the high-\ $Q$ region above. 
    4350   Alternatively a power law can be used. 
    4451 
     
    52592) Load some data with the *Data Explorer*. 
    5360 
    54 3) Select a dataset and use the *Send To* button on the *Data Explorer* to load  
     613) Select a dataset and use the *Send To* button on the *Data Explorer* to load 
    5562   the dataset into the *Invariant* panel. 
    5663 
    57 4) Use the *Customised Input* boxes on the *Invariant* panel to subtract  
    58    any background, specify the contrast (i.e. difference in SLDs - this must be  
    59    specified for the eventual value of Q*\  to be on an absolute scale), or to  
     644) Use the *Customised Input* boxes on the *Invariant* panel to subtract 
     65   any background, specify the contrast (i.e. difference in SLDs - this must be 
     66   specified for the eventual value of $Q^*$  to be on an absolute scale), or to 
    6067   rescale the data. 
    6168 
    62 5) Adjust the extrapolation range as necessary. In most cases the default  
     695) Adjust the extrapolation range as necessary. In most cases the default 
    6370   values will suffice. 
    6471 
    65726) Click the *Compute* button. 
    6673 
    67 7) To include a lower and/or higher Q range, check the relevant *Enable  
     747) To include a lower and/or higher $Q$ range, check the relevant *Enable 
    6875   Extrapolate* check boxes. 
    69     
    70    If power law extrapolations are chosen, the exponent can be either held  
    71    fixed or fitted. The number of points, Npts, to be used for the basis of the  
     76 
     77   If power law extrapolations are chosen, the exponent can be either held 
     78   fixed or fitted. The number of points, Npts, to be used for the basis of the 
    7279   extrapolation can also be specified. 
    7380 
    74 8) If the value of Q*\  calculated with the extrapolated regions is invalid, a  
     818) If the value of $Q^*$  calculated with the extrapolated regions is invalid, a 
    7582   red warning will appear at the top of the *Invariant* panel. 
    7683 
    77    The details of the calculation are available by clicking the *Details*  
     84   The details of the calculation are available by clicking the *Details* 
    7885   button in the middle of the panel. 
    7986 
    80 .. image:: image005.gif 
     87.. image:: image005.png 
    8188 
    8289.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    8895^^^^^^^^^^^^^^^ 
    8996 
    90 The volume fraction |phi| is related to Q*\  by 
     97The volume fraction $\phi$ is related to $Q^*$  by 
    9198 
    92 .. image:: image002.gif 
     99.. math:: 
    93100 
    94 where |bigdelta|\ |rho| is the SLD contrast. 
     101    \phi(1 - \phi) = \frac{Q^*}{2\pi^2(\Delta\rho)^2} \equiv A 
    95102 
    96 .. image:: image003.gif 
     103where $\Delta\rho$ is the SLD contrast. 
     104 
     105.. math:: 
     106 
     107    \phi = \frac{1 \pm \sqrt{1 - 4A}}{2} 
    97108 
    98109.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    101112^^^^^^^^^^^^^^^^^^^^^ 
    102113 
    103 The specific surface area *Sv* is related to Q*\  by 
     114The specific surface area $S_v$ is related to $Q^*$  by 
    104115 
    105 .. image:: image004.gif 
     116.. math:: 
    106117 
    107 where *Cp* is the Porod constant. 
     118    S_v = \frac{2\pi\phi(1-\phi)C_p}{Q^*} = \frac{2\pi A C_p}{Q^*} 
     119 
     120where $C_p$ is the Porod constant. 
    108121 
    109122.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
Note: See TracChangeset for help on using the changeset viewer.