Ignore:
Timestamp:
Apr 8, 2017 3:51:45 AM (7 years ago)
Author:
wojciech
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:
d3a06ce
Parents:
6d6832e (diff), 861f1880 (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' of https://github.com/SasView/sasview into ticket-510

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

Legend:

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

    rc10d9d6c r463e7ffc  
    2727from sas.sasgui.guiframe.plugin_base import PluginBase 
    2828 
     29logger = logging.getLogger(__name__) 
     30 
    2931class Plugin(PluginBase): 
    3032    """ 
     
    4648 
    4749        # Log startup 
    48         logging.info("Invariant plug-in started") 
     50        logger.info("Invariant plug-in started") 
    4951 
    5052    def get_data(self): 
     
    280282 
    281283        except: 
    282             logging.error("invariant.set_state: %s" % sys.exc_value) 
     284            logger.error("invariant.set_state: %s" % sys.exc_value) 
    283285 
    284286    def on_set_state_helper(self, event=None): 
  • src/sas/sasgui/perspectives/invariant/invariant_panel.py

    r18b7ecb9 r463e7ffc  
    2424from sas.sasgui.guiframe.panel_base import PanelBase 
    2525from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     26 
     27logger = logging.getLogger(__name__) 
    2628 
    2729# The minimum q-value to be used when extrapolating 
     
    460462                self._manager.plot_theory(name="Low-Q extrapolation") 
    461463            except: 
    462                 logging.error(sys.exc_value) 
     464                logger.error(sys.exc_value) 
    463465 
    464466    def get_high_qstar(self, inv, high_q=False): 
     
    494496                self._manager.plot_theory(name="High-Q extrapolation") 
    495497            except: 
    496                 logging.error(sys.exc_value) 
     498                logger.error(sys.exc_value) 
    497499 
    498500    def get_qstar(self, inv): 
     
    845847            attr.SetValue(value) 
    846848        except: 
    847             logging.error("Invariant state: %s", sys.exc_value) 
     849            logger.error("Invariant state: %s", sys.exc_value) 
    848850 
    849851    def get_bookmark_by_num(self, num=None): 
     
    862864            _, _, current_state, comp_state = self.state.bookmark_list[int(num)] 
    863865        except: 
    864             logging.error(sys.exc_value) 
     866            logger.error(sys.exc_value) 
    865867            raise ValueError, "No such bookmark exists" 
    866868 
     
    957959                    self.state.clone_state() 
    958960        except: 
    959             logging.error(sys.exc_value) 
     961            logger.error(sys.exc_value) 
    960962 
    961963        self._set_undo_flag(True) 
     
    10011003                del self.state.state_list[str(i)] 
    10021004            except: 
    1003                 logging.error(sys.exc_value) 
     1005                logger.error(sys.exc_value) 
    10041006        # Enable the undo button if it was not 
    10051007        self._set_undo_flag(True) 
     
    10661068                del self.state.state_list[str(i)] 
    10671069            except: 
    1068                 logging.error(sys.exc_value) 
     1070                logger.error(sys.exc_value) 
    10691071 
    10701072        # try to add new state of the text changes in the state_list 
     
    10811083            self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 
    10821084        except: 
    1083             logging.error(sys.exc_value) 
     1085            logger.error(sys.exc_value) 
    10841086 
    10851087        self._set_undo_flag(True) 
     
    11031105            self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 
    11041106        except: 
    1105             logging.error(sys.exc_value) 
     1107            logger.error(sys.exc_value) 
    11061108 
    11071109    def _get_input_list(self): 
  • src/sas/sasgui/perspectives/invariant/invariant_state.py

    rdb5294e r463e7ffc  
    1616from sas.sasgui.guiframe.gui_style import GUIFRAME_ID 
    1717from sas.sasgui.guiframe.dataFitting import Data1D 
     18 
     19logger = logging.getLogger(__name__) 
    1820 
    1921INVNODE_NAME = 'invariant' 
     
    381383                    msg = "InvariantSate.fromXML: Could not read" 
    382384                    msg += " timestamp\n %s" % sys.exc_value 
    383                     logging.error(msg) 
     385                    logger.error(msg) 
    384386 
    385387            # Parse bookmarks 
     
    694696            msg = "XML document does not contain invariant" 
    695697            msg += " information.\n %s" % sys.exc_value 
    696             logging.info(msg) 
     698            logger.info(msg) 
    697699        return state 
    698700 
  • src/sas/sasgui/perspectives/invariant/report_dialog.py

    rd85c194 r463e7ffc  
    2020 
    2121from sas.sasgui.guiframe.report_dialog import BaseReportDialog 
     22 
     23logger = logging.getLogger(__name__) 
    2224 
    2325class ReportDialog(BaseReportDialog): 
     
    9294                    except: 
    9395                        # DO not open 
    94                         logging.error("Could not open file: %s" % sys.exc_value) 
     96                        logger.error("Could not open file: %s" % sys.exc_value) 
    9597            # delete image file 
    9698            os.remove(pic_fname) 
  • 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.