Changeset 48153283 in sasview


Ignore:
Timestamp:
Feb 17, 2015 3:46:30 AM (9 years ago)
Author:
smk78
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:
36c5910
Parents:
920928f (diff), 5dfdfa7 (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.git

Files:
26 added
3 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • build_tools/conda/bumps/meta.yaml

    rf479ac3 rb75079b  
    1 about: {home: 'http://www.reflectometry.org/danse/software.html', license: UNKNOWN, 
    2   summary: Data fitting with bayesian uncertainty analysis} 
    3 build: 
    4   entry_points: [] 
    5   features: [] 
    6   string: '' 
    7   track_features: [] 
    8 package: {name: bumps, version: 0.7.5.3} 
     1package: 
     2  name: bumps 
     3  version: !!str 0.7.5.4 
     4 
     5source: 
     6  fn: bumps-0.7.5.4.tar.gz 
     7  url: https://pypi.python.org/packages/source/b/bumps/bumps-0.7.5.4.tar.gz 
     8  md5: a47c035fbb18afa5ca53067506a5ff1c 
     9#  patches: 
     10   # List any patch files here 
     11   # - fix.patch 
     12 
     13# build: 
     14  #preserve_egg_dir: True 
     15  #entry_points: 
     16    # Put any entry points (scripts to be generated automatically) here. The 
     17    # syntax is module:function.  For example 
     18    # 
     19    # - bumps = bumps:main 
     20    # 
     21    # Would create an entry point called bumps that calls bumps.main() 
     22 
     23 
     24  # If this is a new build for the same version, increment the build 
     25  # number. If you do not include this key, it defaults to 0. 
     26  # number: 1 
     27 
    928requirements: 
    10   build: [python, setuptools, six] 
    11   conflicts: [] 
    12   run: [python, six] 
    13 source: 
    14   fn: bumps-0.7.5.3.tar.gz 
    15   git_rev: '' 
    16   md5: f17b41412c3c8ad6432a42e42cb926d5 
    17   patches: [] 
    18   path: '' 
    19   svn_rev: '' 
    20   url: https://pypi.python.org/packages/source/b/bumps/bumps-0.7.5.3.tar.gz 
     29  build: 
     30    - python 
     31    - setuptools 
     32    - six 
     33 
     34  run: 
     35    - python 
     36    - six 
     37 
    2138test: 
    22   commands: [] 
    23   files: [] 
    24   imports: [bumps, bumps.dream, bumps.gui, bumps.gui.resources, bumps.mystic, bumps.mystic.examples, 
    25     bumps.mystic.optimizer] 
    26   requires: [] 
     39  # Python imports 
     40  imports: 
     41    - bumps 
     42    - bumps.dream 
     43    - bumps.gui 
     44    - bumps.gui.resources 
     45    - bumps.mystic 
     46    - bumps.mystic.examples 
     47    - bumps.mystic.optimizer 
     48 
     49  #commands: 
     50    # You can put test commands to be run here.  Use this to test that the 
     51    # entry points work. 
     52 
     53 
     54  # You can also put a file called run_test.py in the recipe that will be run 
     55  # at test time. 
     56 
     57  requires: 
     58   - numpy 
     59   - scipy 
     60   - matplotlib 
     61 
     62about: 
     63  home: http://www.reflectometry.org/danse/software.html 
     64  license: UNKNOWN 
     65  summary: 'Data fitting with bayesian uncertainty analysis' 
     66 
     67# See 
     68# http://docs.continuum.io/conda/build.html for 
     69# more information about meta.yaml 
  • build_tools/conda/periodictable/meta.yaml

    rf479ac3 r55bde35  
    1 about: {home: 'http://www.reflectometry.org/danse/elements.html', license: public 
    2     domain, summary: Extensible periodic table of the elements} 
    3 build: 
    4   entry_points: [] 
    5   features: [] 
    6   string: '' 
    7   track_features: [] 
    8 package: {name: periodictable, version: 1.4.1} 
    9 requirements: 
    10   build: [python, setuptools, pyparsing, numpy] 
    11   conflicts: [] 
    12   run: [python, pyparsing, numpy] 
     1package: 
     2  name: periodictable 
     3  version: !!str 1.4.1 
     4 
    135source: 
    146  fn: periodictable-1.4.1.tar.gz 
    15   git_rev: '' 
     7  url: https://pypi.python.org/packages/source/p/periodictable/periodictable-1.4.1.tar.gz 
    168  md5: 7246b63cc0b6b1be6e86b6616f9e866e 
    17   patches: [] 
    18   path: '' 
    19   svn_rev: '' 
    20   url: https://pypi.python.org/packages/source/p/periodictable/periodictable-1.4.1.tar.gz 
     9#  patches: 
     10   # List any patch files here 
     11   # - fix.patch 
     12 
     13# build: 
     14  #preserve_egg_dir: True 
     15  #entry_points: 
     16    # Put any entry points (scripts to be generated automatically) here. The 
     17    # syntax is module:function.  For example 
     18    # 
     19    # - periodictable = periodictable:main 
     20    # 
     21    # Would create an entry point called periodictable that calls periodictable.main() 
     22 
     23 
     24  # If this is a new build for the same version, increment the build 
     25  # number. If you do not include this key, it defaults to 0. 
     26  # number: 1 
     27 
     28requirements: 
     29  build: 
     30    - python 
     31    - setuptools 
     32    - pyparsing 
     33    - numpy 
     34 
     35  run: 
     36    - python 
     37    - pyparsing 
     38    - numpy 
     39 
    2140test: 
    22   commands: [] 
    23   files: [] 
    24   imports: [periodictable] 
    25   requires: [] 
     41  # Python imports 
     42  imports: 
     43    - periodictable 
     44 
     45  #commands: 
     46    # You can put test commands to be run here.  Use this to test that the 
     47    # entry points work. 
     48 
     49 
     50  # You can also put a file called run_test.py in the recipe that will be run 
     51  # at test time. 
     52 
     53  # requires: 
     54    # Put any additional test requirements here.  For example 
     55    # - nose 
     56 
     57about: 
     58  home: http://www.reflectometry.org/danse/elements.html 
     59  license: public domain 
     60  summary: 'Extensible periodic table of the elements' 
     61 
     62# See 
     63# http://docs.continuum.io/conda/build.html for 
     64# more information about meta.yaml 
  • build_tools/conda/unittest-xml-reporting/meta.yaml

    rf479ac3 r55bde35  
    1 about: {home: 'http://github.com/xmlrunner/unittest-xml-reporting/tree/master/', license: BSD 
    2     License, summary: unittest-based test runner with Ant/JUnit like XML reporting.} 
    3 build: 
    4   entry_points: [] 
    5   features: [] 
    6   string: '' 
    7   track_features: [] 
    8 package: {name: unittest-xml-reporting, version: 1.10.0} 
    9 requirements: 
    10   build: [python, setuptools, six >=1.4.0] 
    11   conflicts: [] 
    12   run: [python, six >=1.4.0] 
     1package: 
     2  name: unittest-xml-reporting 
     3  version: !!str 1.10.0 
     4 
    135source: 
    146  fn: unittest-xml-reporting-1.10.0.tar.gz 
    15   git_rev: '' 
     7  url: https://pypi.python.org/packages/source/u/unittest-xml-reporting/unittest-xml-reporting-1.10.0.tar.gz 
    168  md5: f0d04be2b9bff5b744677b576c326620 
    17   patches: [] 
    18   path: '' 
    19   svn_rev: '' 
    20   url: https://pypi.python.org/packages/source/u/unittest-xml-reporting/unittest-xml-reporting-1.10.0.tar.gz 
     9#  patches: 
     10   # List any patch files here 
     11   # - fix.patch 
     12 
     13# build: 
     14  #preserve_egg_dir: True 
     15  #entry_points: 
     16    # Put any entry points (scripts to be generated automatically) here. The 
     17    # syntax is module:function.  For example 
     18    # 
     19    # - unittest-xml-reporting = unittest-xml-reporting:main 
     20    # 
     21    # Would create an entry point called unittest-xml-reporting that calls unittest-xml-reporting.main() 
     22 
     23 
     24  # If this is a new build for the same version, increment the build 
     25  # number. If you do not include this key, it defaults to 0. 
     26  # number: 1 
     27 
     28requirements: 
     29  build: 
     30    - python 
     31    - setuptools 
     32    - six >=1.4.0 
     33 
     34  run: 
     35    - python 
     36    - six >=1.4.0 
     37 
    2138test: 
    22   commands: [] 
    23   files: [] 
    24   imports: [xmlrunner, xmlrunner.extra, xmlrunner.tests] 
    25   requires: [] 
     39  # Python imports 
     40  imports: 
     41    - xmlrunner 
     42    - xmlrunner.extra 
     43    - xmlrunner.tests 
     44 
     45  #commands: 
     46    # You can put test commands to be run here.  Use this to test that the 
     47    # entry points work. 
     48 
     49 
     50  # You can also put a file called run_test.py in the recipe that will be run 
     51  # at test time. 
     52 
     53  # requires: 
     54    # Put any additional test requirements here.  For example 
     55    # - nose 
     56 
     57about: 
     58  home: http://github.com/xmlrunner/unittest-xml-reporting/tree/master/ 
     59  license:  BSD License 
     60  summary: 'unittest-based test runner with Ant/JUnit like XML reporting.' 
     61 
     62# See 
     63# http://docs.continuum.io/conda/build.html for 
     64# more information about meta.yaml 
  • docs/sphinx-docs/build_sphinx.py

    rf620870 r296f290  
    1010import fnmatch 
    1111import shutil 
     12import imp 
    1213 
    1314from distutils.dir_util import copy_tree 
     
    1718 
    1819CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 
     20 
     21run = imp.load_source('run', os.path.join(CURRENT_SCRIPT_DIR, '..', '..', 'run.py')) 
     22run.prepare() 
    1923 
    2024SASVIEW_SRC = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "src") 
     
    108112    build() 
    109113         
    110 print "=== Done ===" 
     114    print "=== Done ===" 
  • sasview/setup_exe.py

    r3a39c2e r4172557  
    307307# 
    308308packages = [ 
    309     'matplotlib', 'scipy', 'pytz', 'encodings', 'comtypes', 
     309    'matplotlib', 'scipy', 'encodings', 'comtypes', 
    310310    'win32com', 'ho.pisa', 'bumps', 
    311311    ] 
     
    326326 
    327327# Exclude packages that are not needed but are often found on build systems 
    328 excludes = ['Tkinter', 'PyQt4', '_ssl', '_tkagg', 'sip'] 
     328excludes = ['Tkinter', 'PyQt4', '_ssl', '_tkagg', 'sip', 'pytz'] 
    329329 
    330330 
  • setup.py

    ra6d2e3b rd8c4019  
    88from distutils.command.build_ext import build_ext 
    99from distutils.core import Command 
    10  
    11 sys.path.append("docs/sphinx-docs") 
    12 import build_sphinx 
    1310 
    1411try: 
     
    158155        self.cwd = os.getcwd() 
    159156 
    160     def run(self):         
     157    def run(self): 
     158        sys.path.append("docs/sphinx-docs") 
     159        import build_sphinx 
     160 
    161161        build_sphinx.clean() 
    162162        build_sphinx.retrieve_user_docs() 
  • src/sas/data_util/nxsunit.py

    r79492222 rb3efb7d  
    128128    temperature = _build_metric_units('kelvin','K') 
    129129    temperature.update(_build_metric_units('Kelvin','K')) 
    130  
     130    temperature.update(_build_metric_units('Celcius', 'C')) 
     131    temperature.update(_build_metric_units('celcius', 'C')) 
     132     
    131133    charge = _build_metric_units('coulomb','C') 
    132134    charge.update({'microAmp*hour':0.0036}) 
     
    146148    """ 
    147149    Unit converter for NeXus style units. 
    148  
    149150    """ 
    150151    # Define the units, using both American and European spelling. 
  • src/sas/dataloader/data_info.py

    r79492222 rb3efb7d  
    338338    ## Transmission [float] [fraction] 
    339339    transmission = None 
    340     ## Temperature [float] [C] 
     340    ## Temperature [float] [No Default] 
    341341    temperature = None 
    342     temperature_unit = 'C' 
     342    temperature_unit = None 
    343343    ## Position [Vector] [mm] 
    344344    position = None 
  • src/sas/dataloader/readers/associations.py

    rfd5ac0d r5dfdfa7  
    1717import sys 
    1818import logging 
    19 from lxml import etree 
    20 # Py2exe compatibility: import _elementpath to ensure that py2exe finds it 
    21 from lxml import _elementpath 
     19import json 
    2220 
    23 ## Format version for the XML settings file 
    24 VERSION = 'sasloader/1.0' 
     21FILE_NAME = 'defaults.json' 
    2522 
    26  
    27 def read_associations(loader, settings='defaults.xml'): 
     23def read_associations(loader, settings=FILE_NAME): 
    2824    """ 
    2925    Read the specified settings file to associate 
     
    3127     
    3228    :param loader: Loader object 
    33     :param settings: path to the XML settings file [string] 
     29    :param settings: path to the json settings file [string] 
    3430    """ 
    3531    reader_dir = os.path.dirname(__file__) 
     
    4743        path = "./%s" % settings 
    4844    if os.path.isfile(path): 
    49         tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 
    50          
    51         # Check the format version number 
    52         # Specifying the namespace will take care of the file format version 
    53         root = tree.getroot() 
     45        with open(path) as fh: 
     46            json_tree = json.load(fh) 
    5447         
    5548        # Read in the file extension associations 
    56         entry_list = root.xpath('/ns:SasLoader/ns:FileType', 
    57                                  namespaces={'ns': VERSION}) 
     49        entry_list = json_tree['SasLoader']['FileType'] 
    5850 
    5951        # For each FileType entry, get the associated reader and extension 
    6052        for entry in entry_list: 
    61             reader = entry.get('reader') 
    62             ext = entry.get('extension') 
     53            reader = entry['-reader'] 
     54            ext = entry['-extension'] 
    6355             
    6456            if reader is not None and ext is not None: 
  • src/sas/dataloader/readers/cansas_reader.py

    r79492222 rb3efb7d  
    307307        if 'unit' in attr and new_current_level.get('unit') is not None: 
    308308            try: 
     309                local_unit = attr['unit'] 
    309310                if isinstance(node_value, float) is False: 
    310311                    exec("node_value = float({0})".format(node_value)) 
     
    312313                unitname = new_current_level.get("unit") 
    313314                exec "default_unit = data1d.{0}".format(unitname) 
    314                 local_unit = attr['unit'] 
    315                 if local_unit.lower() != default_unit.lower() and \ 
    316                     local_unit is not None and local_unit.lower() != "none" \ 
    317                         and default_unit is not None: 
     315                if local_unit is not None and default_unit is not None and \ 
     316                        local_unit.lower() != default_unit.lower() \ 
     317                        and local_unit.lower() != "none": 
    318318                    if HAS_CONVERTER == True: 
    319                         try: 
    320                             ## Check local units - bad units raise KeyError 
    321                             Converter(local_unit) 
    322                             data_conv_q = Converter(attr['unit']) 
    323                             value_unit = default_unit 
    324                             i_string = "node_value = data_conv_q" 
    325                             i_string += "(node_value, units=data1d.{0})" 
    326                             exec i_string.format(unitname) 
    327                         except KeyError: 
    328                             err_msg = "CanSAS reader: could not convert " 
    329                             err_msg += "{0} unit {1}; " 
    330                             err_msg = err_msg.format(tagname, local_unit) 
    331                             intermediate = "err_msg += " + \ 
    332                                         "\"expecting [{1}]  {2}\"" + \ 
    333                                         ".format(data1d.{0}, " + \ 
    334                                         "sys.exc_info()[1])" 
    335                             exec intermediate.format(unitname, "{0}", "{1}") 
    336                             self.errors.append(err_msg) 
    337                             raise ValueError(err_msg) 
    338                         except: 
    339                             err_msg = \ 
    340                                 "CanSAS reader: could not convert the units" 
    341                             self.errors.append(err_msg) 
    342                             return 
     319                        ## Check local units - bad units raise KeyError 
     320                        data_conv_q = Converter(local_unit) 
     321                        value_unit = default_unit 
     322                        i_string = "node_value = data_conv_q" 
     323                        i_string += "(node_value, units=data1d.{0})" 
     324                        exec i_string.format(unitname) 
    343325                    else: 
    344326                        value_unit = local_unit 
    345                         err_msg = "CanSAS reader: unrecognized %s unit [%s];"\ 
    346                         % (node_value, default_unit) 
    347                         err_msg += " expecting [%s]" % local_unit 
     327                        err_msg = "Unit converter is not available.\n" 
    348328                        self.errors.append(err_msg) 
    349                         raise ValueError, err_msg 
    350329                else: 
    351330                    value_unit = local_unit 
     331            except KeyError: 
     332                err_msg = "CanSAS reader: unexpected " 
     333                err_msg += "\"{0}\" unit [{1}]; " 
     334                err_msg = err_msg.format(tagname, local_unit) 
     335                intermediate = "err_msg += " + \ 
     336                            "\"expecting [{1}]\"" + \ 
     337                            ".format(data1d.{0})" 
     338                exec intermediate.format(unitname, "{0}", "{1}") 
     339                self.errors.append(err_msg) 
     340                value_unit = local_unit 
    352341            except: 
    353                 err_msg = "CanSAS reader: could not convert " 
    354                 err_msg += "Q unit [%s]; " % attr['unit'] 
    355                 intermediate = "err_msg += \"expecting [%s]\n  %s\" % " + \ 
    356                             "(data1d.{0}, sys.exc_info()[1])" 
    357                 exec intermediate.format(unitname) 
     342                print sys.exc_info() 
     343                err_msg = "CanSAS reader: unknown error converting " 
     344                err_msg += "\"{0}\" unit [{1}]" 
     345                err_msg = err_msg.format(tagname, local_unit) 
    358346                self.errors.append(err_msg) 
    359                 raise ValueError, err_msg 
     347                value_unit = local_unit 
    360348        elif 'unit' in attr: 
    361349            value_unit = attr['unit'] 
     
    488476                                                        data1d, tagname) 
    489477                    cansas_attrib = \ 
    490                     cs_values.current_level.get("attributes").get(key) 
     478                        cs_values.current_level.get("attributes").get(key) 
    491479                    attrib_variable = cansas_attrib.get("variable") 
    492480                    if key == 'unit' and unit != '': 
  • src/sas/guiframe/gui_manager.py

    rb9a5f0e r9bbb627  
    2424import logging 
    2525import httplib 
     26import webbrowser 
     27 
    2628 
    2729from sas.guiframe.events import EVT_CATEGORY 
     
    13251327    def _add_help_menu(self): 
    13261328        """ 
    1327         add help menu 
     1329        add help menu to menu bar.  Includes welcome page, about page, 
     1330        tutorial PDF and documentation pages.  
    13281331        """ 
    13291332        # Help menu 
     
    13361339                id = wx.NewId() 
    13371340                self._help_menu.Append(id, '&Welcome', '') 
    1338                 self._help_menu.AppendSeparator() 
    13391341                wx.EVT_MENU(self, id, self.show_welcome_panel) 
    13401342 
    1341         # Look for help item in plug-ins  
    1342         for item in self.plugins: 
    1343             if hasattr(item, "help"): 
    1344                 id = wx.NewId() 
    1345                 self._help_menu.Append(id,'&%s Help' % item.sub_menu, '') 
    1346                 wx.EVT_MENU(self, id, item.help) 
    1347  
    1348         # Only show new Sphinx docs link if version of wx supports displaying 
    1349         # it correctly. 
    1350         show_sphinx_docs = float(wx.__version__[:3]) >= 2.9 
    1351         if show_sphinx_docs: 
    1352             self._help_menu.AppendSeparator() 
    1353             id = wx.NewId() 
    1354             self._help_menu.Append(id, '&Sphinx Documentation', '') 
    1355             wx.EVT_MENU(self, id, self._onSphinxDocs) 
     1343        self._help_menu.AppendSeparator() 
     1344        id = wx.NewId() 
     1345        self._help_menu.Append(id, '&Documentation', '') 
     1346        wx.EVT_MENU(self, id, self._onSphinxDocs) 
    13561347 
    13571348        if config._do_tutorial and (IS_WIN or sys.platform =='darwin'): 
     
    21622153    def _onSphinxDocs(self, evt): 
    21632154        """ 
    2164         Pop up a Sphinx Documentation dialog. 
     2155        Bring up Sphinx Documentation.  If Wx 2.9 or higher is installed  
     2156        with proper HTML support then Pop up a Sphinx Documentation dialog 
     2157        locally.  If not pop up a new tab in the default system browser  
     2158        calling the documentation website. 
    21652159         
    21662160        :param evt: menu event 
     
    21682162        # Running SasView "in-place" using run.py means the docs will be in a 
    21692163        # different place than they would otherwise. 
    2170         SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
    2171         if SPHINX_DOC_ENV in os.environ: 
    2172             docs_path = os.path.join(os.environ[SPHINX_DOC_ENV], "index.html") 
     2164 
     2165        show_sphinx_docs = float(wx.__version__[:3]) >= 2.9 
     2166        if show_sphinx_docs: 
     2167            SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     2168            if SPHINX_DOC_ENV in os.environ: 
     2169                docs_path = os.path.join(os.environ[SPHINX_DOC_ENV], "index.html") 
     2170            else: 
     2171                docs_path = os.path.join(PATH_APP, "..", "..", "doc", "index.html") 
     2172 
     2173            if os.path.exists(docs_path): 
     2174                from documentation_window import DocumentationWindow 
     2175 
     2176                sphinx_doc_viewer = DocumentationWindow(None, -1, docs_path) 
     2177                sphinx_doc_viewer.Show() 
     2178            else: 
     2179                logging.error("Could not find Sphinx documentation at '%' -- has it been built?" % docs_path) 
    21732180        else: 
    2174             docs_path = os.path.join(PATH_APP, "..", "..", "doc", "index.html") 
    2175  
    2176         if os.path.exists(docs_path): 
    2177             from documentation_window import DocumentationWindow 
    2178  
    2179             sphinx_doc_viewer = DocumentationWindow(None, -1, docs_path) 
    2180             sphinx_doc_viewer.Show() 
    2181         else: 
    2182             logging.error("Could not find Sphinx documentation at '%' -- has it been built?" % docs_path) 
     2181            #For red hat and maybe others who do not have Wx 3.0 
     2182            #just send to webpage of documentation 
     2183            webbrowser.open_new_tab('http://www.sasview.org/sasview') 
    21832184 
    21842185    def set_manager(self, manager): 
  • src/sas/guiframe/gui_statusbar.py

    r79492222 rb3efb7d  
    315315        if msg == "error": 
    316316            e_msg = "Error(s) Occurred:\n" 
    317             e_msg += event.status 
     317            e_msg += "\t" + event.status + "\n\n" 
     318            e_msg += "Further information might be available in " 
     319            e_msg += "the Console log (bottom right corner)." 
    318320            wx.MessageBox(e_msg, style=wx.ICON_ERROR) 
    319321 
  • src/sas/guiframe/local_perspectives/data_loader/data_loader.py

    r7a04dbb rb3efb7d  
    171171                                  file) for file in os.listdir(path)] 
    172172    
     173    def _process_data_and_errors(self, item, p_file, output, message): 
     174        """ 
     175        Check to see if data set loaded with any errors. If so, append to 
     176            error message to be sure user knows the issue. 
     177        """ 
     178        data_error = False 
     179        for error_data in item.errors: 
     180            data_error = True 
     181            message += "\tError: {0}\n".format(error_data) 
     182        data = self.parent.create_gui_data(item, p_file) 
     183        output[data.id] = data 
     184        return output, message, data_error 
     185    
    173186    def get_data(self, path, format=None): 
    174187        """ 
     
    178191        output = {} 
    179192        any_error = False 
     193        data_error = False 
    180194        error_message = "" 
    181195        for p_file in path: 
    182196            info = "info" 
    183197            basename  = os.path.basename(p_file) 
    184             root, extension = os.path.splitext(basename) 
     198            _, extension = os.path.splitext(basename) 
    185199            if extension.lower() in EXTENSIONS: 
    186200                any_error = True 
     
    194208         
    195209            try: 
     210                message = "Loading Data... " + str(p_file) + "\n" 
     211                self.load_update(output=output, message=message, info=info) 
    196212                temp =  self.loader.load(p_file, format) 
    197213                if temp.__class__.__name__ == "list": 
    198214                    for item in temp: 
    199                         data = self.parent.create_gui_data(item, p_file) 
    200                         output[data.id] = data 
     215                        output, error_message, data_error = \ 
     216                            self._process_data_and_errors(item,  
     217                                                          p_file,  
     218                                                          output,  
     219                                                          error_message) 
    201220                else: 
    202                     data = self.parent.create_gui_data(temp, p_file) 
    203                     output[data.id] = data 
    204                 message = "Loading Data..." + str(p_file) + "\n" 
    205                 self.load_update(output=output, message=message, info=info) 
     221                    output, error_message, data_error = \ 
     222                            self._process_data_and_errors(temp,  
     223                                                          p_file,  
     224                                                          output,  
     225                                                          error_message) 
    206226            except: 
    207227                any_error = True 
    208                 if error_message == "": 
    209                      error = "Error: " + str(sys.exc_value) + "\n" 
    210                      error += "while loading Data: \n%s\n" % str(p_file) 
    211                      error_message = "The data file you selected could not be loaded.\n" 
    212                      error_message += "Make sure the content of your file" 
    213                      error_message += " is properly formatted.\n\n" 
    214                      error_message += "When contacting the DANSE team, mention the" 
    215                      error_message += " following:\n%s" % str(error) 
    216                 else: 
    217                      error_message += "%s\n"% str(p_file) 
    218                 info = "error" 
    219                 self.load_update(output=output, message=error_message,  
     228        if any_error or error_message != "": 
     229            if error_message == "": 
     230                error = "Error: " + str(sys.exc_value) + "\n" 
     231                error += "while loading Data: \n%s\n" % str(p_file) 
     232                error_message = "The data file you selected could not be loaded.\n" 
     233                error_message += "Make sure the content of your file" 
     234                error_message += " is properly formatted.\n\n" 
     235                error_message += "When contacting the DANSE team, mention the" 
     236                error_message += " following:\n%s" % str(error) 
     237            elif data_error: 
     238                base_message = "Errors occurred while loading {0}\n".format(p_file) 
     239                base_message += "The data file loaded but with errors.\n" 
     240                error_message = base_message + error_message 
     241            else: 
     242                error_message += "%s\n"% str(p_file) 
     243            info = "error" 
     244            self.load_update(output=output, message=error_message,  
    220245                                  info=info) 
    221246                 
    222         message = "Loading Data Complete! " 
     247        else: 
     248            message = "Loading Data Complete! " 
    223249        message += log_msg 
    224         if error_message != "": 
    225             info = 'error' 
    226250        self.load_complete(output=output, error_message=error_message, 
    227251                       message=message, path=path, info=info) 
  • src/sas/models/c_extension/python_wrapper/modelTemplate.txt

    rfd5ac0d r8836849  
    2626from sas.models.BaseComponent import BaseComponent 
    2727from sas.models.sas_extension.c_models import [CPYTHONCLASS] 
     28from numpy import inf 
    2829 
    2930def create_[PYTHONCLASS](): 
  • src/sas/models/include/cylinder.h

    r79492222 r8836849  
    3434 
    3535  /// Radius of the cylinder [A] 
    36   //  [DEFAULT]=radius=20.0 [A] 
     36  //  [DEFAULT]=radius=20.0 [A] 0.0 inf 
    3737  Parameter radius; 
    3838 
    3939  /// Length of the cylinder [A] 
    40   //  [DEFAULT]=length=400.0 [A] 
     40  //  [DEFAULT]=length=400.0 [A] 0.0 inf 
    4141  Parameter length; 
    4242 
  • src/sas/perspectives/fitting/fitpage.py

    rb9a5f0e r22ae2f7  
    14921492        after fitting 
    14931493        """ 
     1494 
    14941495        if self.is_mac: 
    14951496            return 
     
    15001501            for item in self.parameters: 
    15011502                if item[0].IsShown(): 
    1502                     #Skip t ifhe angle parameters if 1D data 
     1503                    #Skip the angle parameters if 1D data 
    15031504                    if self.data.__class__.__name__ != "Data2D" and \ 
    15041505                            not self.enable2D: 
     
    15191520            for item in self.fittable_param: 
    15201521                if item[0].IsShown(): 
    1521                     #Skip t ifhe angle parameters if 1D data 
     1522                    #Skip the angle parameters if 1D data 
    15221523                    if self.data.__class__.__name__ != "Data2D" and \ 
    15231524                            not self.enable2D: 
     
    20762077    
    20772078        """ 
     2079         
    20782080        # make sure stop button to fit button all the time 
    20792081        self._on_fit_complete() 
     
    21122114        i = 0 
    21132115        #Set the panel when fit result are list 
     2116 
    21142117        for item in self.param_toFit: 
    21152118            if len(item) > 5 and item != None: 
     2119 
    21162120                if item[0].IsShown(): 
    21172121                    ## reset error value to initial state 
     
    21442148                                    item[3].Show(True) 
    21452149                                    item[4].Show(True) 
     2150                                    item[4].SetForegroundColour(wx.BLACK) 
     2151                                item[4].SetValue(val_err) 
     2152                                has_error = True 
     2153                            else: 
     2154                                val_err = 'NaN' 
     2155                                if not self.is_mac: 
     2156                                    item[3].Show(True) 
     2157                                    item[4].Show(True) 
     2158                                    item[4].SetForegroundColour(wx.RED) 
    21462159                                item[4].SetValue(val_err) 
    21472160                                has_error = True 
     
    28312844            
    28322845        keys = self.model.getParamList() 
    2833         #list of dispersion paramaters 
     2846         
     2847        #list of dispersion parameters 
    28342848        self.disp_list = self.model.getDispParamList() 
    28352849 
     
    29252939        CHECK_STATE = self.cb1.GetValue() 
    29262940        for item in keys: 
     2941             
    29272942            if not item in self.disp_list and not item in \ 
    29282943                    self.model.orientation_params: 
     
    29983013                    if not self.is_mac: 
    29993014                        ctl2.Hide() 
    3000                      
     3015 
    30013016                    ix += 1 
    30023017                    ctl3 = self.ModelTextCtrl(self, -1, 
     
    30043019                                              style=wx.TE_PROCESS_ENTER, 
    30053020                                text_enter_callback=self._onparamRangeEnter) 
    3006           
     3021                    min_bound = self.model.details[item][1] 
     3022                    if min_bound is not None: 
     3023                        ctl3.SetValue(format_number(min_bound, True)) 
     3024 
    30073025                    sizer.Add(ctl3, (iy, ix), (1, 1), 
    30083026                              wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
     
    30133031                                              style=wx.TE_PROCESS_ENTER, 
    30143032                                text_enter_callback=self._onparamRangeEnter) 
     3033                    max_bound = self.model.details[item][2] 
     3034                    if max_bound is not None: 
     3035                        ctl4.SetValue(format_number(max_bound, True)) 
    30153036                    sizer.Add(ctl4, (iy, ix), (1, 1), 
    30163037                              wx.EXPAND | wx.FIXED_MINSIZE, 0) 
  • src/sas/perspectives/fitting/pagestate.py

    rb9a5f0e rd06ae30  
    472472        Get the values (strings) from __str__ for report 
    473473        """ 
    474         # Dictionary of teh report strings 
     474        # Dictionary of the report strings 
    475475        repo_time = "" 
    476476        model_name = "" 
     
    508508            if name == "value": 
    509509                param_string += value + ',' 
     510            if name == "selected": 
     511                if value == u' False': 
     512                    fixed_parameter = True 
     513                else: 
     514                    fixed_parameter = False 
    510515            if name == "error value": 
    511                 param_string += value + ',' 
     516                if fixed_parameter: 
     517                    param_string += '(fixed),' 
     518                else: 
     519                    param_string += value + ',' 
    512520            if name == "parameter unit": 
    513521                param_string += value + ':' 
  • src/sas/perspectives/fitting/report_dialog.py

    r79492222 rd06ae30  
    11""" 
    22Dialog report panel to show and summarize the results of  
    3 the invariant calculation. 
     3the fitting calculation. 
    44""" 
    55################################################################################ 
  • test/sasdataloader/test/utest_abs_reader.py

    r35ec279 rb3efb7d  
    345345        self.assertEqual(self.data.filename, filename) 
    346346        # The followed should not have been loaded 
    347         self.assertEqual(self.data.sample.thickness, None) 
     347        self.assertEqual(self.data.sample.thickness, 0.00103) 
    348348        # This one should 
    349349        self.assertEqual(self.data.sample.transmission, 0.327) 
    350350         
    351351        self.assertEqual(self.data.meta_data['loader'], "CanSAS 1D") 
    352         self.assertEqual(len(self.data.errors), 1) 
     352        print self.data.errors 
     353        self.assertEqual(len(self.data.errors), 2) 
    353354         
    354355         
  • docs/sphinx-docs/source/user/user.rst

    ref325c7 r64c8fc1  
    1212   Plotting Data/Models <guiframe/graph_help> 
    1313    
    14    Fitting Perspective <fitting/fitting_help> 
     14   Fitting Perspective <fit/fitting_help> 
    1515    
    1616   P(r) Inversion Perspective <invariant/pr_help> 
     
    3333   Generic Scattering Calculator Tool <calculator/sas_calculator_help> 
    3434    
    35    Python Shell Tool 
     35   Python Shell Tool <perspectives/calculator/python_shell_help> 
    3636    
    37    Image Viewer Tool 
     37   Image Viewer Tool <perspectives/calculator/image_viewer_help> 
  • src/sas/calculator/media/density_calculator_help.rst

    r0d66541 r920928f  
    1 ..density_calculator_help.rst 
     1.. density_calculator_help.rst 
    22 
    3 Placeholder for density calculator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Density/Volume Calculator Tool 
     7============================== 
     8 
     9Description 
     10----------- 
     11 
     12This tool is to calculate the mass density from the molar volume or vice  
     13versa. To calculate the mass density, the chemical formula and molar volume  
     14should be provided. 
     15 
     16.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     17 
     18How To 
     19------ 
     20 
     211. Molecular Formula: The chemical formula of ONE molecule or ONE atom. For  
     22mixtures, the ratio of the each molecules should be used; for example,  
     23(H2O)0.5(D2O)0.5. 
     24 
     252. Select input (molar volume or mass density) from combobox. Then type in the  
     26input value. 
     27 
     283. Click the 'Calculate' button to perform the calculation. 
     29 
     304. Outputs also include the molar mass (weight) that depends only on the  
     31chemical formula 
     32 
     33.. image:: density_tutor.gif 
  • src/sas/calculator/media/kiessig_calculator_help.rst

    r0d66541 r920928f  
    1 ..kiessig_calculator_help.rst 
     1.. kiessig_calculator_help.rst 
    22 
    3 Placeholder for Kiessig calculator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Kiessig Thickness Calculator Tool 
     7================================= 
     8 
     9Description 
     10----------- 
     11 
     12This tool is to approximately estimate the thickness of a layer or the  
     13diameter of particles from the Kiessig fringe in SAS/NR data, and using the  
     14Kiessig relation 
     15 
     16thickness = 2*Pi/fringe_width. 
     17   
     18.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     19 
     20 
     21How To 
     22------ 
     23 
     24To get a rough thickness or particle size, just type the Kiessig fringe width  
     25(in units of 1/Angstrom) and click on the 'Compute' button. Then the output  
     26value will be show up in the 'Thickness' text box. 
  • src/sas/calculator/media/resolution_calculator_help.rst

    r0d66541 r920928f  
    1 ..resolution_calculator_help.rst 
     1.. resolution_calculator_help.rst 
    22 
    3 Placeholder for resolution calculator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Q Resolution Estimator 
     7====================== 
     8 
     9Description 
     10----------- 
     11 
     12This tool is to approximately estimate the resolution of Q based on the SAS  
     13instrumental parameter values assuming that the detector is flat and vertical  
     14to the incident beam direction. 
     15 
     16.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     17 
     18How To 
     19------ 
     20 
     211. Select the source and source type (Monochromatic or TOF). Note that the  
     22computational difference between the sources is only the gravitational  
     23contribution due to the mass. 
     24 
     252. Change the default values of the instrumental parameters as desired. 
     26 
     273. The input formats of wavelength and its spread (=FWHM/wavelength) depend on  
     28the source type.For monochromatic wave, the inputs are just one values as shown  
     29with the defaults.For TOF, the min and max values should be separated by "-"  
     30to describe the wavelength band range. Optionally, the input of the wavelength  
     31(NOT of the wavelength spread) could be extended by adding "; --" where the --  
     32is the number of the bins for the numerical integration. Otherwise, the  
     33default value "10" bins will be used. The same number of bins will be used  
     34for the corresponding wavelength spread in either cases. 
     35 
     364. For TOF, the default wavelength spectrum is flat. The custom spectrum file  
     37(with 2 column text: wavelength(A) vs. intensity) can also be loaded by  
     38selecting "Add new" in the combobox. 
     39 
     405. Once set all the input values, click the compute button. Depending on  
     41computation loads the calculation time will vary. 
     42 
     436. 1D and 2D dQ will be displayed in the text-box at the bottom of the panel.  
     44Two dimensional resolution weight distribution (2D elliptical Gaussian  
     45function) will also be displayed in the plot panel even if the Q inputs are  
     46outside of the detector limit. The red lines indicate the limits of the  
     47detector (if a green lines appear (for TOF), it indicates the limits of the  
     48maximum q range for the largest wavelength due to the size of the detector).  
     49Note that the effect from the beam block is ignored, so in the small q region  
     50near the beam block  
     51 
     52[ie., q<2*pi*(beam block diameter) / (sample to detector distance) / lamda_min]  
     53 
     54the variance is slightly under estimated. 
     55 
     567. The summary can be accessed by clicking the 'light-bulb' icon at the bottom  
     57of the SasView main window. 
     58 
     59.. image:: resolution_tutor.gif 
     60 
     61.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     62 
     63Theory 
     64------ 
     65 
     66The scattering wave transfer vector is by definition 
     67 
     68.. image:: q.gif 
     69 
     70In the limit of the small angle, the variance of q in the first order  
     71approximation is 
     72 
     73.. image:: sigma_q.gif 
     74 
     75In summary, the geometric and gravitational contributions depending on the  
     76shape of each factors can be expressed as shown the table. 
     77 
     78.. image:: sigma_table.gif 
     79 
     80Finally, we use a Gaussian function to describe the 2D weighting distribution  
     81of the uncertainty in q. 
     82 
     83.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     84 
     85References 
     86---------- 
     87D.F.R. Mildner and J.M. Carpenter, J. Appl. Cryst. 17, 249-256 (1984) 
     88 
     89D.F.R. Mildner, J.M. Carpenter and D.L. Worcester, J. Appl. Cryst. 19, 311-319  
     90(1986) 
  • src/sas/calculator/media/sas_calculator_help.rst

    r0d66541 r920928f  
    1 ..sas_calculator_help.rst 
     1.. sas_calculator_help.rst 
    22 
    3 Placeholder for generic SAS calculator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6.. |beta| unicode:: U+03B2 
     7.. |gamma| unicode:: U+03B3 
     8.. |theta| unicode:: U+03B8 
     9.. |mu| unicode:: U+03BC 
     10.. |sigma| unicode:: U+03C3 
     11.. |phi| unicode:: U+03C6 
     12 
     13.. |equiv| unicode:: U+2261 
     14.. |noteql| unicode:: U+2260 
     15 
     16Generic Scattering Calculator Tool 
     17================================== 
     18 
     19Polarization and Magnetic Scattering 
     20 
     21Theory_  
     22GUI_  
     23PDB_Data_  
     24 
     25.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     26 
     27.. _Theory: 
     28 
     29Theory 
     30------ 
     31 
     32In general, a particle with a volume V can be described by an ensemble  
     33containing N 3-dimensional rectangular pixels where each pixels are much  
     34smaller than V. Assuming that all the pixel sizes are same, the elastic  
     35scattering intensity by the particle 
     36 
     37.. image:: gen_i.gif 
     38 
     39where /beta/jand rj are the scattering length density and the position of the  
     40j'th pixel respectively. And the total volume 
     41 
     42.. image:: v_j.gif 
     43 
     44for /beta/j/noteql/0 where vj is the volume of the j'th pixel (or the j'th  
     45natural atomic volume (= atomic mass/natural molar density/Avogadro number) for  
     46the atomic structures). The total volume V can be corrected by users. This  
     47correction is useful especially for an atomic structure (taken from a pdb file)  
     48to get the right normalization. Note that the /beta/j displayed in GUI may be  
     49incorrect but will not affect the scattering computation if the correction of  
     50the total volume is made. The scattering length density (SLD) of each pixel  
     51where the SLD is uniform, is a combination of the nuclear and magnetic SLDs and  
     52depends on the spin states of the neutrons as follows:For magnetic scattering,  
     53only the magnetization component, *M*perp, perpendicular to the scattering  
     54vector *Q* contributes to the the magnetic scattering length. (Figure below). 
     55 
     56.. image:: mag_vector.bmp 
     57 
     58The magnetic scattering length density is then 
     59 
     60.. image:: dm_eq.gif 
     61 
     62where /gamma/= -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0 is  
     63the classical radius of electron, and */sigma/* is the Pauli spin. 
     64 
     65For polarized neutron, the magnetic scattering is depending on the spin states. 
     66 
     67Let's consider that the incident neutrons are polarised parallel (+)/  
     68anti-parallel (-) to the x' axis (See both Figures above). The possible  
     69out-coming states then are + and - states for both incident states, where  
     70 
     71- Non-spin flips: (+ +) and (- -) 
     72- Spin flips:     (+ -) and (- +) 
     73 
     74.. image:: gen_mag_pic.bmp 
     75 
     76Now, let's assume that the angles of the *Q*  vector and the spin-axis (x')  
     77from x-axis are /phi/ and /theta/up respectively (See Figure above). Then,  
     78depending upon the polarization (spin) state of neutrons, the scattering  
     79length densities, including the nuclear scattering length density (/beta/N)  
     80are given as, for non-spin-flips 
     81 
     82.. image:: sld1.gif 
     83 
     84and for spin-flips 
     85 
     86.. image:: sld2.gif 
     87 
     88where 
     89 
     90.. image:: mxp.gif 
     91 
     92.. image:: myp.gif 
     93 
     94.. image:: mzp.gif 
     95 
     96.. image:: mqx.gif 
     97 
     98.. image:: mqy.gif 
     99 
     100Here, the M0x, M0yand M0zare the x, y and z components of the magnetisation  
     101vector given in the xyz lab frame.  
     102 
     103.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     104 
     105.. _GUI: 
     106 
     107GUI 
     108--- 
     109 
     110.. image:: gen_gui_help.bmp 
     111 
     112After the computation, the result will be listed in the 'Theory' box in the  
     113data explorer panel on the main window.The 'Up_frac_in' and 'Up_frac_out' are  
     114the ratio, (spin up) /(spin up + spin down) neutrons before the sample and at  
     115the analyzer, respectively. 
     116 
     117*Note I: The values of 'Up_frac_in' and 'Up_frac_out' must be in the range  
     118between 0 and 1. For example, both values are 0.5 for unpolarized neutrons.* 
     119 
     120*Note II: This computation is totally based on the pixel (or atomic) data  
     121fixed in the xyz coordinates. Thus no angular orientational averaging is  
     122considered.* 
     123 
     124*Note III: For the nuclear scattering length density, only the real component  
     125is taken account.* 
     126 
     127.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     128 
     129.. _PDB_Data: 
     130 
     131PDB Data 
     132-------- 
     133 
     134This Generic scattering calculator also supports some pdb files without  
     135considering polarized/magnetic scattering so that the related parameters  
     136such as Up_*** will be ignored (see the Picture below). The calculation for  
     137fixed orientation uses (the first) Equation above resulting in a 2D output,  
     138whileas the scattering calculation averaged over all the orientations uses  
     139the Debye equation providing a 1D output 
     140 
     141.. image:: gen_debye_eq.gif 
     142 
     143where vj /beta/j /equiv/ bj the scattering length of the j'th atom. The resultant outputs  
     144will be displayed in the DataExplorer for further uses. 
     145 
     146.. image:: pdb_combo.jpg 
  • src/sas/calculator/media/slit_calculator_help.rst

    r0d66541 r920928f  
    1 ..slit_calculator_help.rst 
     1.. slit_calculator_help.rst 
    22 
    3 Placeholder for slit calculator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Slit Size Calculator Tool 
     7========================= 
     8 
     9Description 
     10----------- 
     11This tool is for X-ray users to calculate the slit size (FWHM/2) for smearing  
     12based on their half beam profile data (SAXSess). 
     13 
     14.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     15 
     16How To 
     17------- 
     18To calculate the slit size (FWHM/2), just load the beam profile data using the  
     19browse button. 
     20 
     21Once a data is loaded, the slit size will be computed and show up in the text  
     22box. 
     23 
     24Because the unit is not specified in the data file, we do not convert it into  
     251/Angstrom so  users are responsible for converting the units of their data. 
     26 
     27Note: This slit size calculator only works for beam profile data produced by  
     28'SAXSess'. 
     29 
     30To see the file format, check the file, 'beam profile.DAT', in the 'test'  
     31folder of SasView. 
  • src/sas/data_util/media/data_operator_help.rst

    r0d66541 r920928f  
    1 ..data_operator_help.rst 
     1.. data_operator_help.rst 
    22 
    3 Placeholder for data operator help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Data Operations Tool 
     7==================== 
     8 
     9Description 
     10----------- 
     11This dialog panel provides arithmetic operations between two data sets (the  
     12last data set could be a number). 
     13 
     14When data1 and data2 are selected, their x (or qx and qy for 2D) value(s) 
     15must match with each other. 
     16 
     17.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     18 
     19How To 
     20------ 
     211. Type the data name resulted from an operation. 
     22 
     232) Select a data/theory in the drop down menus. When data2 is set to number,  
     24   type a number in the text control box. 
     25 
     263) Select an arithmetic operator symbol; + (for addition), - (for subtraction),  
     27   * (for multiplication), / (for division), and | (for combination of two data 
     28   sets). 
     29 
     30   If two data sets do not match, the operation will fail and the background color 
     31   of the combo box items will turn to red (WIN only). 
     32 
     334) If the operation is successful, hit the Apply button to make the new data. 
     34   Then the data name will be shown up in the data box in the data explorer. 
     35 
     36Note: Any errors and warnings will be displayed at the bottom of the SasView 
     37window. 
     38 
     39.. image:: data_oper_pic.png 
  • src/sas/fit/media/fitting_help.rst

    r0d66541 r920928f  
    1 ..fitting_help.rst 
    2  
    3 Placeholder for fitting help 
     1.. fitting_help.rst 
     2 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6.. |beta| unicode:: U+03B2 
     7.. |gamma| unicode:: U+03B3 
     8.. |mu| unicode:: U+03BC 
     9.. |sigma| unicode:: U+03C3 
     10.. |phi| unicode:: U+03C6 
     11.. |theta| unicode:: U+03B8 
     12 
     13Fitting Perspective 
     14=================== 
     15 
     16Load_a_File_ 
     17 
     18Single_Fit_ 
     19 
     20Simultaneous_Fitting_ 
     21 
     22Batch_Fitting_ 
     23 
     24Model_Selection_ 
     25 
     26Model_Category_Manager_ 
     27 
     28Model_Functions_ 
     29 
     30Custom_Model_Editor_ 
     31 
     32Polydispersity_Distributions_ 
     33 
     34Smearing_Computation_ 
     35 
     36Polarisation_Magnetic_Scattering_ 
     37 
     38Key_Combinations_ 
     39 
     40Status_Bar_Help_ 
     41 
     42.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     43 
     44..  _Load_a_File: 
     45 
     46Load a File 
     47----------- 
     48 
     49From Menu go to *Data* -> *Load Data File(or Folder)* . Select a file/folder  
     50from the menu bar and click on Open button. Data contained in the file will be  
     51displayed. To cancel the loading click on *cancel* . In case a file can not be  
     52loaded, an error message will be displayed on the statusbar. 
     53 
     54.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     55 
     56.. _Single_Fit: 
     57 
     58Single Fit 
     59---------- 
     60 
     61One of two fit-engines can be chosen from the Fitting menu bar. The Simple Fit- 
     62engine uses Scipy's leasqr and the Complex Fit-Engine is a custom optimizer  
     63that provides a better chance to find the global minimum of the chi2 but that  
     64requires longer computation time. In order to set a data to a control panel  
     65(FitPage), see the "DataLoader Help". Once a data set to the FiPage, select a  
     66model from the combo box. The default parameters of the model will be display.  
     67Set initial parameters if need. Check and uncheck parameters to fit/fix. Click  
     68the *'Fit'*  button. When the fitting is finished, the resultant parameter  
     69values will be displayed with the errors. If a error is missing, it generally  
     70means that the corresponding parameter is not very depending on the model. The  
     71chisq/Npt_fit and the plot associated with the fit operation will be also  
     72updated. 
     73 
     74.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     75 
     76..  _Simultaneous_Fitting: 
     77 
     78Simultaneous Fitting 
     79-------------------- 
     80 
     81This fitting option enables to set a number of the constraints between the  
     82parameters of fitting(s). It requires one or more FitPages with a data and a  
     83model set for the fitting, and performs multiple fittings given by the  
     84FitPage(s). The Complex (ParkMC) FitEngine will be used automatically. 
     85 
     86Simultaneous Fit without Constraint 
     87 
     88Assuming some FitPages are already set up, check the checkboxes of the  
     89model_data rows to fit. And click the 'Fit' button. The results will return to  
     90each FitPages. 
     91 
     92Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits. If  
     93one needs the chi2 value only for a page, click the 'Compute' button in the  
     94FitPage to recalculate. 
     95 
     96Simultaneous Fit with Constraint 
     97 
     98Enter constraint in the text control next to *constraint fit*  button.  
     99Constraint should be of type model1 parameter name = f(model2 parameter name)  
     100for example, M0.radius=2*M1.radius. Many constraints can be entered for a  
     101single fit. Each of them should be separated by a newline charater or ";"  
     102The easy setup can generate many constraint inputs easily when the selected  
     103two models are the same type. 
     104 
     105Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits.  
     106If one needs the chi2 value only for one fit, click the 'Compute' button in  
     107the FitPage to recalculate. 
     108 
     109.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     110 
     111..  _Batch_Fitting: 
     112 
     113Batch Fitting 
     114------------- 
     115 
     116Batch_Fit_ 
     117 
     118Batch_Window_ 
     119 
     120Edit_Grid_ 
     121 
     122Save_Grid_ 
     123 
     124Open_Batch_Results_ 
     125 
     126Plot_ 
     127 
     128View_Column_Cell_ 
     129 
     130.. _Batch_Fit: 
     131 
     132Batch Fit 
     133---------  
     134 
     135Create a *Batch Page* by selecting the *Batch* radio button on the DataExplorer 
     136(see figure below) and for a new control page select 'New FitPage' in the  
     137Fitting menubar. 
     138 
     139.. image:: batch_button_area.bmp 
     140 
     141Figure 1: MenuBar:  
     142 
     143Load Data to the DataExplorer if not already loaded. 
     144 
     145Select one or more data sets by checking the check boxes, and then make sure  
     146that "Fitting" is selected in the dropdown menu next to the "Send To" button.  
     147Once ready, click the 'Send To' button to set data to a BatchPage. If already  
     148an empty batch page exists, it will be set there. Otherwise it will create a  
     149new Batch Page. Set up the model and the parameter values as same as a single  
     150fitting (see Single Fit help) <Single_Fit_>. Then use 'Fit' button to  
     151perform the fitting. 
     152 
     153Unlike a single fit, the results of the fittings will not return to the  
     154BatchPage'. Instead, a Grid window will be provided once the fitting is  
     155completed. The Grid window is also accessible from the 'View' menu  
     156(see Figure 2). 
     157 
     158Note that only one model is used for all the data. The initial parameter  
     159values given in the control page will be used all the data fittings. If one  
     160wants the FitEngine to use the initial values from the results of the  
     161previous data fitting (if any), choose the 'Chain Fitting' option in the  
     162Fitting menubar, which will speed up the fitting especially when you have  
     163lots of, and similar, data sets. 
     164 
     165.. _Batch_Window: 
     166 
     167Batch Window 
     168------------ 
     169Batch Window provides an easy way to view the fit results, i.e., plot data,  
     170fits, and residuals. Batch window will be automatically shown after a batch  
     171fit is finished. 
     172 
     173Once closed, it can be opened anytime from the "View" menubar item (see  
     174Figure 2). 
     175 
     176.. image:: restore_batch_window.bmp 
     177 
     178Figure 2: Edit Menu:  
     179 
     180.. _Edit_Grid: 
     181 
     182Edit Grid 
     183--------- 
     184 
     185Once a batch fit is completed, all fitted and fixed model parameters are  
     186displayed to the current sheet of the batch window except the errors of the  
     187parameters. To view the errors, click on a given column then under *Edit*   
     188menubar item, and insert the desired parameter by selecting a menu item with  
     189the appropriated label. Empty column can be inserted in the same way. A  
     190column value can be customized by editing an existing empty column. 
     191 
     192To Remove column from the grid, select it, choose edit menu, and click the  
     193*'remove'*  menu item. Any removed column should reinserted whenever needed. 
     194 
     195All above options are also available when right clicking on a given column  
     196label(see Figure 3). 
     197 
     198*Note:*  A column always needs to be selected in order to remove or insert a  
     199column in the grid. 
     200 
     201.. image:: edit_menu.bmp 
     202 
     203Figure 3: Edit Menu: 
     204 
     205.. _Save_Grid: 
     206 
     207Save Grid 
     208--------- 
     209To save the current page on the batch window, select the *'File'*  menubar  
     210item(see Figure 4), then choose the *'Save as'*  menu item to save it as a  
     211.csv file. 
     212 
     213*Note:* The grid doesn't save the data array, fits, and the array residuals. 
     214As a result, the 'View (fit) Results' functionality will be lost when 
     215reloading the saved file. 
     216 
     217Warning! To ensure accuracy of saved fit results, it is recommended to save  
     218the current grid before modifying it . 
     219 
     220.. _Open_Batch_Results: 
     221 
     222Open Batch Results  
     223------------------ 
     224 
     225Any *csv*  file can be opened in the grid by selecting the *'Open'*  under  
     226the *'File'*  menu in the Grid Window(see Figure 4). All columns in the file  
     227will be displayed but insertion will not available. Insertion will be  
     228available only when at least one column will be removed from the grid. 
     229 
     230.. image:: file_menu.bmp 
     231 
     232Figure 4: MenuBar: 
     233 
     234.. _Plot: 
     235 
     236Plot 
     237---- 
     238 
     239To *plot*  a column versus another, select one column at the time, click the  
     240*'Add'*  button next to the text control of X/Y -axis *Selection Range*  to  
     241plot the value of this column on the X/Y axis. Alternatively, all available  
     242range can be selected by clicking the column letter (eg. B). Repeat the same  
     243procedure the next axis. Finally, click the *'Plot'*  button. When clicking  
     244on *Add*  button, the grid will automatically fill the axis label, but  
     245different labels and units can be entered in the correct controls before  
     246clicking on the plot button. 
     247 
     248*X/Y -Axis Selection Range* can be edited manually. These text controls 
     249allow the following types of expression (operation can be + - * /, or pow) 
     250  
     2511) if the current axis label range is a function of 1 or more columns, write  
     252this type of expression 
     253 
     254constant1  * column_name1 [minimum row index :  maximum  row index] operator  
     255constant2 * column_name2 [minimum row index :  maximum  row index]  
     256 
     257Example: radius [2 : 5] -3 * scale [2 : 5]  
     258 
     2592) if only some values of a given column are need but the range between the  
     260first row and the last row used is not continuous, write the following  
     261expression in the text control 
     262 
     263column_name1 [minimum row index1 :  maximum  row index1] , column_name1  
     264[minimum row index2 :  maximum  row index2]  
     265 
     266Example : radius [2 : 5] , radius [10 : 25]  
     267 
     268Note: Both text controls ( X and Y-axis Selection Ranges) need to be filled  
     269with valid entries for plotting to work. The dY-bar is optional (see Figure 5). 
     270 
     271.. image:: plot_button.bmp 
     272 
     273Figure 5: Plotting 
     274 
     275.. _View_Column_Cell: 
     276 
     277View Column/Cell(s) 
     278------------------- 
     279 
     280Select 1 or more cells from the same column, click the 'View Fits' button to  
     281display available curves.  
     282 
     283For example, select the cells of the  'Chi2'  column, then click the  'View Fits'   
     284button. The plots generates will represent the residuals  plots.  
     285  
     286If you select any cells of the 'Data' column and click the 'View Fits' button.  
     287It generates both  data and fits in the graph (see Figure 6).  
     288 
     289Alternatively, just click the column letter (eg. B) to choose all the  
     290available data sets, then simply click the 'View Fits' button to plot the  
     291data and fits.  
     292 
     293.. image:: view_button.bmp 
     294 
     295Figure 6: View Fits 
     296 
     297.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     298 
     299..  _Model_Selection: 
     300 
     301Model_Type_  
     302 
     303Change_Model_Parameters_ 
     304 
     305Write_your_Own_Model_ 
     306 
     307.. _Model_Type: 
     308 
     309Model Type 
     310---------- 
     311 
     312Models are grouped into three classes 
     313 
     314*  *Shapes*  
     315*  *Shape-Independent*  
     316*  *Uncategorised* 
     317*  *Customized Models*  
     318*  *Structure Factor* 
     319 
     320.. _Change_Model_Parameters: 
     321 
     322Change Model Parameters 
     323----------------------- 
     324 
     325To visualize model in a different window, from menu click on *Model*. Select  
     326a type of model and then the name of your model.A new window will appear with  
     327the plot of your model with default values. Change model's parameters on  
     328*model view*  tab and view the plotted model with its new parameters. 
     329 
     330.. _Write_your_Own_Model: 
     331 
     332Write your Own Model 
     333-------------------- 
     334 
     335The custom model editors are provided from 'Fitting' menu in the menu bar.  
     336See 'Custom model editor' in the side menu on left. Advanced users can write  
     337your own model and save it (in .py format) into *plugin_models*  directory in  
     338.sasview of your home directory (eg., username\.sasview>\plugin_models). Your  
     339plugin model will be added into "<>Customized Models" on the next model  
     340selection. 
     341 
     342.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     343 
     344..  _Model_Category_Manager: 
     345 
     346Model Category Manager 
     347---------------------- 
     348 
     349Our SAS models are, by default, classified into 5 categories; shapes,  
     350shape-independent, structure factor, and customized models, where these  
     351categories (except the customized models) can be reassigned, added, and  
     352removed using 'Category Manager'. Each models can also be enabled(shown)/ 
     353disabled(hidden) from the category that they belong. The Category Manager  
     354panel is accessible from the model category 'Modify' button in the fitting  
     355panel or the 'View/Category Manager' menu in the menu bar (Fig. 1). 
     356 
     3571) Enable/Disable models: Check/uncheck the check boxes to enable/disable the  
     358models (Fig. 2). 
     359 
     3602) Change category: Highlight a model in the list by left-clicking and click  
     361the 'Modify' button. In the 'Change Category' panel, one can create/use a  
     362category for the model, then click the 'Add' button. In order to delete a  
     363category, select a category name and click the 'Remove Selected' button  
     364(Fig. 3). 
     365 
     3663) To apply the changes made, hit the OK button. Otherwise, click the 'Cancel'  
     367button (Fig. 2). 
     368 
     369.. image:: cat_fig0.bmp 
     370 
     371Fig.1 
     372 
     373.. image:: cat_fig1.bmp 
     374 
     375Fig.2 
     376 
     377.. image:: cat_fig2.bmp 
     378 
     379Fig.3 
     380 
     381.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     382 
     383..  _Model_Functions: 
     384 
     385Model Functions 
     386--------------- 
     387 
     388Model Documentation <models/model_functions> 
     389 
     390.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     391 
     392..  _Custom_Model_Editor: 
     393 
     394Custom Model Editor 
     395------------------- 
     396 
     397Description_  
     398 
     399New_ 
     400 
     401Sum_Multi_p1_p2_ 
     402 
     403Advanced_ 
     404 
     405Delete_ 
     406 
     407.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     408 
     409.. _Description: 
     410 
     411Description 
     412----------- 
     413 
     414This menu (Fitting/Edit Custom Model in the menu bar) interface is to provide  
     415you an easy way to write your own custom models. The changes in a model  
     416function are effective after it is re-selected from the combo-box menu. 
     417 
     418.. image:: edit_model_menu.bmp 
     419 
     420.. _New: 
     421 
     422New 
     423--- 
     424 
     425This option is used to make a new model. A model code generated by this option  
     426can be viewed and further modified by the 'Advanced' option below. 
     427 
     428.. image:: new_model.bmp 
     429 
     430.. _Sum_Multi_p1_p2: 
     431 
     432Sum|Multi(p1,p2) 
     433---------------- 
     434 
     435This option create a new sum (or multiplication) model. Fill up the (sum  
     436model function) name and the description. The description will show up on  
     437details button in the application. Then select the p1 or p2 model for the  
     438sum/multi model, select an operator as necessary and click the Apply button  
     439for activation. Hit the 'Close' button when it's done. 
     440 
     441.. image:: sum_model.bmp 
     442 
     443.. _Advanced: 
     444 
     445Advanced 
     446-------- 
     447 
     448The menu option shows all the files in the plugin_models folder. You can edit,  
     449modify, and save it. It is recommended to modify only the lines with arrow  
     450(-------). In the end of edit, 'Compile' and 'Run' from the menu bar to 
     451activate or to see the model working properly. 
     452 
     453.. _Delete: 
     454 
     455Delete 
     456------ 
     457 
     458The menu option is to delete the custom models. Just select the file name to  
     459delete. 
     460 
     461.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     462 
     463..  _Polydispersity_Distributions: 
     464 
     465Polydispersity Distributions 
     466---------------------------- 
     467 
     468Calculates the form factor for a polydisperse and/or angular population of  
     469particles with uniform scattering length density. The resultant form factor  
     470is normalized by the average particle volume such that  
     471 
     472P(q) = scale*\<F*F\>/Vol + bkg 
     473 
     474where F is the scattering amplitude and the\<\>denote an average over the size  
     475distribution.  Users should use PD (polydispersity: this definition is  
     476different from the typical definition in polymer science) for a size  
     477distribution and Sigma for an angular distribution (see below). 
     478 
     479Note that this computation is very time intensive thus applying polydispersion/ 
     480angular distrubtion for more than one paramters or increasing Npts values  
     481might need extensive patience to complete the computation. Also note that  
     482even though it is time consuming, it is safer to have larger values of Npts  
     483and Nsigmas. 
     484 
     485The following five distribution functions are provided 
     486 
     487*  *Rectangular_Distribution_* 
     488*  *Array_Distribution_* 
     489*  *Gaussian_Distribution_* 
     490*  *Lognormal_Distribution_* 
     491*  *Schulz_Distribution_* 
     492 
     493.. _Rectangular_Distribution: 
     494 
     495Rectangular Distribution 
     496------------------------ 
     497 
     498.. image:: pd_image001.png 
     499 
     500The xmean is the mean of the distribution, w is the half-width, and Norm is a  
     501normalization factor which is determined during the numerical calculation.  
     502Note that the Sigma and the half width *w*  are different. 
     503 
     504The standard deviation is 
     505 
     506.. image:: pd_image002.png 
     507 
     508The PD (polydispersity) is 
     509 
     510.. image:: pd_image003.png 
     511 
     512.. image:: pd_image004.jpg 
     513 
     514.. _Array_Distribution: 
     515 
     516Array Distribution 
     517------------------ 
     518 
     519This distribution is to be given by users as a txt file where the array  
     520should be defined by two columns in the order of x and f(x) values. The f(x)  
     521will be normalized by SasView during the computation. 
     522 
     523Example of an array in the file 
     524 
     52530        0.1 
     52632        0.3 
     52735        0.4 
     52836        0.5 
     52937        0.6 
     53039        0.7 
     53141        0.9 
     532 
     533We use only these array values in the computation, therefore the mean value  
     534given in the control panel, for example ‘radius = 60’, will be ignored. 
     535 
     536.. _Gaussian_Distribution: 
     537 
     538Gaussian Distribution 
     539--------------------- 
     540 
     541.. image:: pd_image005.png 
     542 
     543The xmean is the mean of the distribution and Norm is a normalization factor  
     544which is determined during the numerical calculation. 
     545 
     546The PD (polydispersity) is 
     547 
     548.. image:: pd_image003.png 
     549 
     550.. image:: pd_image006.jpg 
     551 
     552.. _Lognormal_Distribution: 
     553 
     554Lognormal Distribution 
     555---------------------- 
     556 
     557.. image:: pd_image007.png 
     558 
     559The /mu/=ln(xmed), xmed is the median value of the distribution, and Norm is a  
     560normalization factor which will be determined during the numerical calculation.  
     561The median value is the value given in the size parameter in the control panel,  
     562for example, “radius = 60”. 
     563 
     564The PD (polydispersity) is given by /sigma/ 
     565 
     566.. image:: pd_image008.png 
     567 
     568For the angular distribution 
     569 
     570.. image:: pd_image009.png 
     571 
     572The mean value is given by xmean=exp(/mu/+p2/2). The peak value is given by  
     573xpeak=exp(/mu/-p2). 
     574 
     575.. image:: pd_image010.jpg 
     576 
     577This distribution function spreads more and the peak shifts to the left as the  
     578p increases, requiring higher values of Nsigmas and Npts. 
     579 
     580.. _Schulz_Distribution: 
     581 
     582Schulz Distribution 
     583------------------- 
     584 
     585.. image:: pd_image011.png 
     586 
     587The xmean is the mean of the distribution and Norm is a normalization factor 
     588which is determined during the numerical calculation. 
     589 
     590The z = 1/p2– 1. 
     591 
     592The PD (polydispersity) is 
     593 
     594.. image:: pd_image012.png 
     595 
     596Note that the higher PD (polydispersity) might need higher values of Npts and  
     597Nsigmas. For example, at PD = 0.7 and radisus = 60 A, Npts >= 160, and  
     598Nsigmas >= 15 at least. 
     599 
     600.. image:: pd_image013.jpg 
     601 
     602.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     603 
     604.. _Smearing_Computation: 
     605 
     606Smearing Computation 
     607-------------------- 
     608 
     609Slit_Smearing_  
     610 
     611Pinhole_Smearing_ 
     612 
     6132D_Smearing_ 
     614 
     615.. _Slit_Smearing: 
     616 
     617Slit Smearing 
     618------------- 
     619 
     620The sit smeared scattering intensity for SAS is defined by 
     621 
     622.. image:: sm_image002.gif 
     623 
     624where Norm = 
     625 
     626.. image:: sm_image003.gif 
     627 
     628Equation 1 
     629 
     630The functions .. image:: sm_image004.gif and .. image:: sm_image005.gif 
     631refer to the slit width weighting function and the slit height weighting  
     632determined at the q point, respectively. Here, we assumes that the weighting  
     633function is described by a rectangular function, i.e., 
     634 
     635.. image:: sm_image006.gif 
     636 
     637Equation 2 
     638 
     639and 
     640 
     641.. image:: sm_image007.gif 
     642 
     643Equation 3 
     644 
     645so that .. image:: sm_image008.gif .. image:: sm_image009.gif for 
     646.. image:: sm_image010.gif and u. 
     647 
     648The .. image:: sm_image011.gif and .. image:: sm_image012.gif stand for 
     649the slit height (FWHM/2) and the slit width (FWHM/2) in the q space. Now the  
     650integral of Equation 1 is simplified to 
     651 
     652.. image:: sm_image013.gif 
     653 
     654Equation 4 
     655 
     656Numerical Implementation of Equation 4 
     657-------------------------------------- 
     658 
     659Case 1 
     660------ 
     661 
     662For .. image:: sm_image012.gif = 0 and .. image:: sm_image011.gif =  
     663constant. 
     664 
     665.. image:: sm_image016.gif 
     666 
     667For discrete q values, at the q values from the data points and at the q  
     668values extended up to qN= qi + .. image:: sm_image011.gif the smeared  
     669intensity can be calculated approximately 
     670 
     671.. image:: sm_image017.gif 
     672 
     673Equation 5 
     674 
     675.. image:: sm_image018.gif = 0 for *Is* in *j* < *i* or *j* > N-1*. 
     676 
     677Case 2 
     678------ 
     679 
     680For .. image:: sm_image012.gif = constant and  
     681.. image:: sm_image011.gif = 0. 
     682 
     683Similarly to Case 1, we get 
     684 
     685.. image:: sm_image019.gif for qp= qi- .. image:: sm_image012.gif 
     686 
     687and qN= qi+ .. image:: sm_image012.gif. .. image:: sm_image018.gif = 0 
     688for *Is* in *j* < *p* or *j* > *N-1*. 
     689 
     690Case 3 
     691------ 
     692 
     693For .. image:: sm_image011.gif = constant and  
     694.. image:: sm_image011.gif = constant. 
     695 
     696In this case, the best way is to perform the integration, Equation 1,  
     697numerically for both slit height and width. However, the numerical integration  
     698is not correct enough unless given a large number of iteration, say at least  
     69910000 by 10000 for each element of the matrix, W, which will take minutes and  
     700minutes to finish the calculation for a set of typical SAS data. An  
     701alternative way which is correct for slit width << slit hight, is used in  
     702SasView. This method is a mixed method that combines method 1 with the  
     703numerical integration for the slit width. 
     704 
     705.. image:: sm_image020.gif 
     706 
     707Equation 7 
     708 
     709for qp= qi- .. image:: sm_image012.gif and 
     710qN= qi+ .. image:: sm_image012.gif. .. image:: sm_image018.gif = 0 for 
     711*Is* in *j* < *p* or *j* > *N-1*. 
     712 
     713.. _Pinhole_Smearing: 
     714 
     715Pinhole Smearing 
     716---------------- 
     717 
     718The pinhole smearing computation is done similar to the case above except  
     719that the weight function used is the Gaussian function, so that the Equation 6  
     720for this case becomes 
     721 
     722.. image:: sm_image021.gif 
     723 
     724Equation 8 
     725 
     726For all the cases above, the weighting matrix *W* is calculated when the  
     727smearing is called at the first time, and it includes the ~ 60 q values  
     728(finely binned evenly) below (\>0) and above the q range of data in order  
     729to cover all data points of the smearing computation for a given model and  
     730for a given slit size. The *Norm*  factor is found numerically with the  
     731weighting matrix, and considered on *Is* computation. 
     732 
     733.. _2D_Smearing: 
     734 
     7352D Smearing 
     736-----------  
     737 
     738The 2D smearing computation is done similar to the 1D pinhole smearing above  
     739except that the weight function used was the 2D elliptical Gaussian function 
     740 
     741.. image:: sm_image022.gif 
     742 
     743Equation 9 
     744 
     745In Equation 9, x0 = qcos/theta/ and y0 = qsin/theta/, and the primed axes  
     746are in the coordinate rotated by an angle /theta/ around the z-axis (below)  
     747so that x’0= x0cos/theta/+y0sin/theta/ and y’0= -x0sin/theta/+y0cos/theta/. 
     748 
     749Note that the rotation angle is zero for x-y symmetric elliptical Gaussian  
     750distribution. The A is a normalization factor. 
     751 
     752.. image:: sm_image023.gif 
     753 
     754Now we consider a numerical integration where each bins in /theta/ and R are  
     755*evenly* (this is to simplify the equation below) distributed by /delta//theta/  
     756and /delta/R, respectively, and it is assumed that I(x’, y’) is constant  
     757within the bins which in turn becomes 
     758 
     759.. image:: sm_image024.gif 
     760 
     761Equation 10 
     762 
     763Since we have found the weighting factor on each bin points, it is convenient  
     764to transform x’-y’ back to x-y coordinate (rotating it by -/theta/ around z  
     765axis). Then, for the polar symmetric smear 
     766 
     767.. image:: sm_image025.gif 
     768 
     769Equation 11 
     770 
     771where 
     772 
     773.. image:: sm_image026.gif 
     774 
     775while for the x-y symmetric smear 
     776 
     777.. image:: sm_image027.gif 
     778 
     779Equation 12 
     780 
     781where 
     782 
     783.. image:: sm_image028.gif 
     784 
     785Here, the current version of the SasView uses Equation 11 for 2D smearing  
     786assuming that all the Gaussian weighting functions are aligned in the polar  
     787coordinate. 
     788 
     789In the control panel, the higher accuracy indicates more and finer binnng  
     790points so that it costs more in time. 
     791 
     792.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     793 
     794.. _Polarisation_Magnetic_Scattering: 
     795 
     796Polarisation/Magnetic Scattering 
     797-------------------------------- 
     798 
     799Magnetic scattering is implemented in five (2D) models  
     800 
     801*  *SphereModel* 
     802*  *CoreShellModel* 
     803*  *CoreMultiShellModel* 
     804*  *CylinderModel* 
     805*  *ParallelepipedModel* 
     806 
     807In general, the scattering length density (SLD) in each regions where the  
     808SLD (=/beta/) is uniform, is a combination of the nuclear and magnetic SLDs and  
     809depends on the spin states of the neutrons as follows. For magnetic scattering,  
     810only the magnetization component, *M*perp, perpendicular to the scattering  
     811vector *Q* contributes to the the magnetic scattering length. 
     812 
     813.. image:: mag_vector.bmp 
     814 
     815The magnetic scattering length density is then 
     816 
     817.. image:: dm_eq.gif 
     818 
     819where /gamma/ = -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0  
     820is the classical radius of electron, and */sigma/* is the Pauli spin. For  
     821polarised neutron, the magnetic scattering is depending on the spin states.  
     822 
     823Let's consider that the incident neutrons are polarized parallel (+)/ 
     824anti-parallel (-) to the x' axis (See both Figures above). The possible  
     825out-coming states then are + and - states for both incident states 
     826 
     827Non-spin flips: (+ +) and (- -) 
     828Spin flips:     (+ -) and (- +) 
     829 
     830.. image:: M_angles_pic.bmp 
     831 
     832Now, let's assume that the angles of the *Q*  vector and the spin-axis (x')  
     833against x-axis are /phi/ and /theta/up, respectively (See Figure above). Then,  
     834depending upon the polarisation (spin) state of neutrons, the scattering length  
     835densities, including the nuclear scattering length density (/beta/N) are given  
     836as, for non-spin-flips 
     837 
     838.. image:: sld1.gif 
     839 
     840for spin-flips 
     841 
     842.. image:: sld2.gif 
     843 
     844where 
     845 
     846.. image:: mxp.gif 
     847 
     848.. image:: myp.gif 
     849 
     850.. image:: mzp.gif 
     851 
     852.. image:: mqx.gif 
     853 
     854.. image:: mqy.gif 
     855 
     856Here, the M0x, M0y and M0z are the x, y and z components of the magnetization  
     857vector given in the xyz lab frame. The angles of the magnetization, /theta/M  
     858and /phi/M as defined in the Figure (above) 
     859 
     860.. image:: m0x_eq.gif 
     861 
     862.. image:: m0y_eq.gif 
     863 
     864.. image:: m0z_eq.gif 
     865 
     866The user input parameters are M0_sld = DMM0, Up_theta = /theta/up,  
     867M_theta = /theta/M, and M_phi = /phi/M. The 'Up_frac_i' and 'Up_frac_f' are  
     868the ratio 
     869 
     870(spin up)/(spin up + spin down) 
     871 
     872neutrons before the sample and at the analyzer, respectively. 
     873 
     874*Note:* The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range 
     875between 0 and 1. 
     876 
     877.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     878 
     879.. _Key_Combinations: 
     880 
     881Key Combinations 
     882---------------- 
     883 
     884Copy_Paste_ 
     885 
     886Bookmark_ 
     887 
     888Graph_Context_Menu_ 
     889 
     890FTolerance_ 
     891 
     892.. _Copy_Paste: 
     893 
     894Copy & Paste 
     895------------ 
     896 
     897To copy the parameter values in a Fit(Model) panel to the clipboard: 
     898 
     899*Ctrl(Cmd on MAC) + Left(Mouse)Click*  on the panel. 
     900 
     901To paste the parameter values to a Fit(Model)panel from the clipboard: 
     902 
     903*Ctrl(Cmd on MAC) + Shift + Left(Mouse)Click*  on the panel. 
     904 
     905If this operation is successful, it will say so in the info line at the  
     906bottom of the SasView window. 
     907 
     908.. _Bookmark: 
     909 
     910Bookmark 
     911-------- 
     912 
     913Bookmark of a fit-panel or model-panel status: 
     914 
     915*(Mouse)Right-Click*  and select the bookmark in the popup list. 
     916 
     917.. _Graph_Context_Menu: 
     918 
     919Graph Context Menu 
     920------------------ 
     921 
     922To get the graph context menu to print, copy, save data, (2D)average, etc.: 
     923 
     924*Locate the mouse point on the plot to highlight and *(Mouse) Right Click*  
     925to bring up the full menu. 
     926 
     927.. _FTolerance:  
     928 
     929FTolerance (SciPy) 
     930------------------ 
     931 
     932To change the ftol value of the Scipy FitEngine (leastsq): 
     933 
     934First, make sure that the Fit panel has data and a model selected. 
     935 
     936*Ctrl(Cmd on MAC) + Shift + Alt + Right(Mouse)Click*  on the panel. 
     937 
     938Then, set up the value in the dialog panel. 
     939 
     940If this operation is successful, the new ftol value will be displayed in the  
     941info line at the bottom of the SV window.Note that increasing the ftol value  
     942may cause for the fitting to terminate with higher chisq. 
     943 
     944.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     945 
     946.. _Status_Bar_Help: 
     947 
     948Status Bar Help 
     949--------------- 
     950 
     951Message_Warning_Hint_  
     952 
     953Console_ 
     954 
     955.. _Message_Warning_Hint: 
     956 
     957Message/Warning/Hint 
     958-------------------- 
     959 
     960The status bar located at the bottom of the application frame, displays  
     961messages, hints, warnings and errors. 
     962 
     963.. _Console: 
     964 
     965Console 
     966------- 
     967 
     968Select *light bulb/info icon*  button in the status bar at the bottom of the  
     969application window to display available history. During a long task, the  
     970console can also help users to understand the status in progressing. 
  • src/sas/guiframe/media/data_explorer_help.rst

    r0d66541 r23a9beb  
    1 ..data_explorer_help.rst 
     1.. data_explorer_help.rst 
    22 
    3 Placeholder for data explorer help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Loading Data 
     7============ 
     8 
     9Introduction_ 
     10 
     11Load_Data_ 
     12 
     13Handy_Menu_ 
     14 
     15Activate_Data_ 
     16 
     17Remove_Data_ 
     18 
     19Append_Plot_to_Graph_ 
     20 
     21Create_New_Plot_ 
     22 
     23Freeze_Theory_ 
     24 
     25Send_Data_to_Applications_ 
     26 
     27.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     28 
     29.. _Introduction: 
     30 
     31Introduction 
     32------------ 
     33 
     34*Data Explorer* is a panel that allows the user more interactions with data.  
     35Some functionalities provided by the Data Explorer are also available through  
     36the context menu of plot panels or other menus of the applications.Under menu  
     37*View*  of the menubar, Data explorer can be toggled between Show and Hide by  
     38clicking the menu *Show/Hide Data Explorer* . 
     39 
     40*IMPORTANT!*  When Data explorer is hidden, all the data loaded will be sent  
     41directly to the current active application, if possible. When data Explorer is  
     42shown data go first to the Data Explorer for the user to handle them later. 
     43 
     44.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     45 
     46.. _Load_Data: 
     47 
     48Load Data 
     49--------- 
     50 
     51To Load data, click the button *Load Data* , then select one or more (holding  
     52Ctrl key) files to load into the application. In the list, the *Data*  will be  
     53displayed as the name of each selected file. Expending this data by clicking  
     54the *+*  symbol will display available information about the data such as data  
     55title if exists. 
     56 
     57.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     58 
     59.. _Handy_Menu: 
     60 
     61Handy Menu 
     62---------- 
     63 
     64For a quick Data-info/Save/Plot/3d-plot(2d only)/Edit-mask(2d only),  
     65high-light the data/theory, right-click, and select a proper item from the  
     66context menu. 
     67 
     68.. image:: hand_menu.png 
     69 
     70.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     71 
     72.. _Activate_Data: 
     73 
     74Activate Data 
     75------------- 
     76 
     77To interact with data, check a data label and click on a button. Checking Data  
     78make them active for the button operation. Unchecking Data labels will  
     79deactivate them. 
     80 
     81There is a combo box labeled *Selection Options*  that allows to activate or  
     82select multiple data simultaneously. 
     83 
     84.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     85 
     86.. _Remove_Data: 
     87 
     88Remove Data 
     89----------- 
     90 
     91Remove data button remove all reference of this data into the application. 
     92 
     93*WARNING!* Remove data will stop any jobs currently using the selected data. 
     94 
     95.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     96 
     97.. _Append_Plot_to_Graph: 
     98 
     99Append Plot to Graph 
     100-------------------- 
     101 
     102Click on the button *Append To*  to append selected Data to a plot panel on  
     103focus. Next to this button is a combo box containing available panels names.  
     104Selecting a name from this combo box will set the corresponding lot panel on  
     105focus. If not plot panel is available, the combo box and button will be  
     106disable. 2D Data cannot be appended to any plot panels . This operation can  
     107only be performed on 1D data and plot panels currently containing 1D data. 
     108 
     109.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     110 
     111.. _Create_New_Plot: 
     112 
     113Create New Plot 
     114--------------- 
     115 
     116Click on *New Plot*  button to create a new plot panel where selected data  
     117will be plotted. 
     118 
     119.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     120 
     121.. _Freeze_Theory: 
     122 
     123Freeze Theory 
     124------------- 
     125 
     126*Freeze Theory*  button generate Data from selected theory. This operation can  
     127only be performed when theory labels are selected. 
     128 
     129.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     130 
     131.. _Send_Data_to_Applications: 
     132 
     133Send to Application 
     134------------------- 
     135 
     136Click on the button *Send To*  to send Data to the current active control  
     137page. One of the single/batch mode can be selected only for Fitting. The batch  
     138mode provides serial (batch) fitting with one model, i.e., fitting one data by  
     139another data. Note that only the Fitting allows more that one data to be sent. 
  • src/sas/guiframe/media/graph_help.rst

    r0d66541 r23a9beb  
    1 ..graph_help.rst 
    2  
    3 Placeholder for graph help 
     1.. graph_help.rst 
     2 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Plotting Data/Models 
     7==================== 
     8 
     9Graph_Menu_ 
     10 
     112D_Data_Averaging_ 
     12 
     13Key_Combinations_ 
     14 
     15.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     16 
     17.. _Graph_Menu: 
     18 
     19Graph Menu 
     20---------- 
     21 
     22Introduction_ 
     23 
     24Reset_Graph_ 
     25 
     26Hide_Show_Delete_Graph_ 
     27 
     28Data_Info_ 
     29 
     30Save_Plot_Image_ 
     31 
     32Save_Data_ 
     33 
     34Drag_Plot_ 
     35 
     36Zoom_In_Out_ 
     37 
     38Remove_Data_ 
     39 
     40Change_Scale_ 
     41 
     42Linear_Fit_ 
     43 
     44Other_Graph_Modifications_ 
     45 
     46.. _Introduction: 
     47 
     48Introduction 
     49------------ 
     50 
     51Locating the pointer and right-clicking on a data/theory plot will bring a  
     52context menu. On the menu, select a menu item. 
     53 
     54.. _Reset_Graph: 
     55 
     56Reset Graph 
     57----------- 
     58 
     59To reset the graph's axis range, right click on the plot and the context menu  
     60pops-up. Select *Reset Graph*  and the plot will take its initial range. Also  
     61the 'home' icon in tool bar will do the same. 
     62 
     63.. _Hide_Show_Delete_Graph: 
     64 
     65Hide/Show/Delete Graph 
     66---------------------- 
     67 
     68To Hide, click the Hide (bar) button in the tool bar.To Show, select the the  
     69'Show' menu item in the 'Graph' menu in the menu bar.To Delete, click the 'x'  
     70button in the title bar. 
     71 
     72Note: If a residuals graph (in Fitting) is hidden, it will not show up after  
     73computation. 
     74 
     75.. _Data_Info: 
     76 
     77Data Info 
     78--------- 
     79 
     80From the context menu, select 'Data Info' to see the data information dialog 
     81panel. 
     82 
     83.. _Save_Plot_Image: 
     84 
     85Save Plot Image 
     86--------------- 
     87 
     88Right click on plot. Context menu will pop-up select save image [file name]. 
     89A dialog window opens and write a the name of the file to save and click on  
     90*Save Image.* 
     91 
     92.. _Save_Data: 
     93 
     94Save Data 
     95--------- 
     96 
     97From the context menu, select 'Save points as a file' for 1D, or 'Save as a  
     98file(DAT)' for 2D. Note that two formats, txt and xml, are available in 1D  
     99saving. 
     100 
     101.. _Drag_Plot: 
     102 
     103Drag Plot 
     104--------- 
     105 
     106Select the *crossed arrows*  button on the plot panel *toolbar*  to drag the  
     107plot. To disable dragging mode, unselect the same button on the toolbar. 
     108 
     109.. _Zoom_In_Out: 
     110 
     111Zoom In/Out 
     112----------- 
     113 
     114Select the *rectangle*  button on the plot panel *toolbar*  to zoom in a 
     115region of the plot. 
     116 
     117To disable zoom mode, unselect the same button on the toolbar. After zoom in 
     118a region, select *left arrow*  or *right arrow*  button on the toolbar to set 
     119the graph the the previous size. If a mouse wheel button is available, 
     120*zoom in/out*  by scrolling the mouse wheel (see Key_Combinations_ help for 
     121details). 
     122 
     123.. _Remove_Data: 
     124 
     125Remove Data from Plot 
     126--------------------- 
     127 
     128Highlight the plot and the context menu appears.Select *remove [file name]*. 
     129The plot selected will disappear. 
     130 
     131.. _Change_Scale: 
     132 
     133Change Scale 
     134------------ 
     135 
     136If the loaded data is a 1-D data changing scale or data representation will  
     137work as follows. *Right click* on the plot window. A context menu pops-up and  
     138select *Change Scale* . A dialog window titled *select the scale of the graph*  
     139will pop-up then change the *x* , the *y*  and the *view*  values as wish. 
     140 
     141The 'view' option includes the axis scale short-cuts such as Linear, Guinier,  
     142Cross-sectional (XC) Guinier, and Porod plot scale. For a proper data set,  
     143these axis scales can be used to estimate Rg, Rod diameter, or Background of  
     144neutron scattering data respectively (via 'Linear Fit'; see below). For a 2D  
     145image, *Right click*  on the image to pop-up the context menu. Select to  
     146switch from linear to log scale. The scale selected is printed on the status  
     147bar. 
     148 
     149If the loaded data is an image. *Right click*  on the image to pop-up the 
     150context menu. Select to switch from linear to log scale. The scale selected is 
     151printed on the status bar. 
     152 
     153.. _Linear_Fit: 
     154 
     155Linear Fit 
     156---------- 
     157 
     158Linear fit is to perform a line model fitting keeping the scale of the plot. 
     159Highlight data to fit. From the context menu select *Linear Fit* . A dialog 
     160window appears. Change model initial parameters, data limits and hit *fit* 
     161button. New parameters values are displayed and the line with the new 
     162parameters is added to the plot. Especially for Guinier, XC Guinier, and 
     163Porod plot scale, this 'Linear Fit' will provides Rg, Rod diameter, and 
     164background, respectively. The following figure shows an example for the 
     165Guinier scale. 
     166 
     167.. image:: guinier_fit.png 
     168 
     169.. _Other_Graph_Modifications: 
     170 
     171Other Graph Modifications 
     172------------------------- 
     173 
     174Some custom modifications of the symbols, text, axis, etc of the graph are  
     175provided. 
     176 
     177.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     178 
     179.. _2D_Data_Averaging: 
     180 
     1812D Data Averaging 
     182----------------- 
     183 
     184Description_ 
     185 
     186How_to_Average_ 
     187 
     188Available_Averagings_ 
     189 
     190Unmasked_Circular_Average_ 
     191 
     192Masked_Circular_Average_ 
     193 
     194Sector_Average_ 
     195 
     196Annular_Average_ 
     197 
     198Box_Sum_ 
     199 
     200Box_Averaging_in_Qx_ 
     201 
     202Box_Averaging_in_Qy_ 
     203 
     204.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     205 
     206.. _Description:  
     207 
     208Description 
     209----------- 
     210 
     211This feature allows you to perform different types of averages on your data,  
     212and allows you to see what regions of the detector will contribute to the  
     213average. The region to be averaged will be drown and can be modified by  
     214dragging the lines around. 
     215 
     216.. _How_to_Average: 
     217 
     218How to Average 
     219-------------- 
     220 
     221Right click on 2D data for the context menu to appear. Select one type of  
     222averages among *"sector [Q view]", "Annulus [Phi view]", "Box sum", "Box  
     223averaging in Qx ", "box averaging on Qy","Perform circular Average".* 
     224 
     225A slicer will appear except for *"Perform circular Average"*  that you can  
     226drag by clicking on a slicer 's marker. When the marker is highlighted in red,  
     227it means that the slicer can change size.You can also move some of the slicer  
     228by simply drag its side when highlighted in red. the slicer size will be reset  
     229to its previous size if the user try to select a region greater than the size  
     230of the data. 
     231 
     232The user can also select a region to average when a slicer has been selected  
     233already by *right clicking*  on the context menu and selecting *Edit Slicer  
     234Parameters* . The dialog window will appears and the user can enter values to  
     235selected a region or selected numbers of points to plot *nbins* . 
     236 
     237For *Box sum* , when the user selects this option, a new panel is created  
     238containing the result of average of the sum of every pixels contains on that  
     239data.The user can also enter values to select a region. 
     240 
     241.. _Available_Averagings: 
     242 
     243Available Averagings 
     244-------------------- 
     245 
     246Some different types of averaging are provided for. 
     247 
     248.. _Unmasked_Circular_Average: 
     249 
     250Unmasked Circular Average 
     251------------------------- 
     252 
     253This operation will perform and average in constant q-rings around the (x,y) pixel 
     254location of the beam center. 
     255 
     256.. _Masked_Circular_Average: 
     257 
     258Masked Circular Average 
     259----------------------- 
     260 
     261This operation is same as 'Masked Circular Average' except that the masked 
     262region is excluded if masked. 
     263 
     264.. _Sector_Average: 
     265 
     266Sector Average [Q View] 
     267----------------------- 
     268 
     269This operation averages in constant q-arcs. The width of the sector is specified in 
     270degrees (+/- delta phi) each side of the central angle (phi). 
     271 
     272.. _Annular_Average: 
     273 
     274Annular Average [Phi View] 
     275-------------------------- 
     276 
     277It performs an average between two q-values centered in (0,0), and averaged  
     278over a width of a specified number of pixels. The data is returned as a  
     279function of angle (phi) in degrees. Moving one circle of this slicer to  
     280radius of zero corresponding to a circular averaging on radius qmax , the  
     281outer circle. The angle zero starts from the positive x-axis direction. 
     282 
     283.. _Box_Sum: 
     284 
     285Box Sum 
     286------- 
     287 
     288Perform the sum of counts in a 2D region of interest.When editing the slicer,  
     289the user can enter the length and the width the rectangle slicer and the  
     290coordinates of the center of this rectangle. 
     291 
     292.. _Box_Averaging_in_Qx: 
     293 
     294Box Averaging in Qx 
     295------------------- 
     296 
     297Computes average I(Qx) for a region of interest. When editing the slicer, the  
     298user can control the length and the width the rectangle slicer. The averaged  
     299output is calculated from the constant bins with rectangular shape. The  
     300resultant q values are nominal values, i.e., the central values of each bins  
     301on the x-axis. 
     302 
     303.. _Box_Averaging_in_Qy: 
     304 
     305Box Averaging in Qy 
     306------------------- 
     307 
     308Computes average I(Qy) for a region of interest.When editing the slicer, the  
     309user can control the length and the width the rectangle slicer. The averaged  
     310output is calculated from the constant bins with rectangular shape. The  
     311resultant q values are nominal values, i.e., the central values of each bins  
     312on the y-axis. 
     313 
     314.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     315 
     316.. _Key_Combinations: 
     317 
     318Key Combination 
     319--------------- 
     320 
     321Floating_Panel_ 
     322 
     323Graph_Context_Menu_ 
     324 
     325Zoom_ 
     326 
     327.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     328 
     329.. _Floating_Panel: 
     330 
     331Floating Panel 
     332-------------- 
     333 
     334For a graph panel to float on the top of the SV window: 
     335 
     336Press the *Ctrl(Cmd on MAC) key*  on dragging and placing a panel. Or if you  
     337want to make all plot panels float, select 'Float' from Graph/Preperences in  
     338the menu bar. Otherwise choose 'Dock'. 
     339 
     340.. _Graph_Context_Menu: 
     341 
     342Graph Context Menu 
     343------------------ 
     344 
     345To get the graph context menu to print, copy, save data, (2D)average, etc,  
     346*locate the mouse point on the plot to highlight and *(Mouse) Right Click*  
     347to bring up the full menu. 
     348 
     349.. _Zoom: 
     350 
     351Zoom In/Out 
     352----------- 
     353 
     354To Zoom in or out the full plot, *locate the mouse point inside the graph  
     355which will be the center of the zooming, then *rotate MouseWheel*. 
     356 
     357*To Zoom in or out the plot in x or y direction, *locate (and click) the  
     358mouse point near x (or y) axis just outside of the graph and then *rotate  
     359MouseWheel* .* Note that this works only on the 1D plots. 
  • src/sas/invariant/media/invariant_help.rst

    r0d66541 r23a9beb  
    1 ..invariant_help.rst 
     1.. invariant_help.rst 
    22 
    3 Placeholder for invariant help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6Invariant Calculation Perspective 
     7================================= 
     8 
     9Scattering_Invariant_ 
     10 
     11Volume_Fraction_ 
     12 
     13Specific_Surface_Area_ 
     14 
     15Definitions_ 
     16 
     17Reference_ 
     18 
     19How_to_Use_ 
     20 
     21.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     22 
     23.. _Scattering_Invariant: 
     24 
     25Scattering Invariant 
     26-------------------- 
     27 
     28The scattering invariant (Q*) is a model-independent quantity that can be  
     29easily calculated from scattering data. 
     30 
     31For two phase systems, the scattering invariant, Q*, is defined as the  
     32integral of the square of the wave transfer (q) multiplied by the scattering  
     33cross section over the full range of q. 
     34 
     35Q* is given by the following equation 
     36 
     37.. image:: image001.gif 
     38 
     39This model independent quantity (Q*) is calculated from the scattering data  
     40that can be used to determine the volume fraction and the specific area of the  
     41sample under consideration. 
     42 
     43These quantities are useful in their own right and can be used in further  
     44analysis. With this scattering invariant module users will also be able to  
     45determine the consistency of those properties between data. There is no real  
     46data defined from zero to infinity, there usually have limited range. 
     47 
     48Q* is not really computed from zero to infinity. Our maximum q range is  
     491e-5 ~ 10 (1/Angstrom). The lower and/or higher q range than data given can be  
     50extrapolated by fitting some data nearby. 
     51 
     52The scattering invariant is computed as follows 
     53 
     54*I(q)* = *I(q)*  w/o background : If the data includes a background, user sets  
     55the value to subtract the background for the Q* computation. 
     56 
     57Reset *I(q)* = *I(q)* scaling factor* , delta *I(q) =*  delta *I(q)*scaling  
     58factor* : If non-zero scaling factor is given, it will be considered. 
     59 
     60Invariant 
     61 
     62.. image:: image001.gif 
     63 
     64where *g =q*  for the pinhole geometry and *g =qv*  (the slit height) for the  
     65slit geometry which can be given in data or as a value. 
     66 
     67Higher q-region (\>= qmax in data) 
     68 
     69Power law (w/o background term) function = C/q4will be used 
     70 
     71where the constant C(=2pi(delta(rho))Sv) is to be found by fitting part of  
     72data with the range of qN-mto qN(m\<N). 
     73 
     74Lower q-region (\<= qmin in data): 
     75 
     76Guinier function = *I0exp(-Rg2q2/3)*  where I0and Rgare obtained by fitting, 
     77 
     78similarly to the high q region above. 
     79 
     80Power law can also be used. 
     81 
     82.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     83 
     84.. _Volume_Fraction: 
     85 
     86Volume Fraction 
     87--------------- 
     88 
     89.. image:: image002.gif 
     90 
     91where delta(rho) is the SLD contrast of which value is given by users. 
     92 
     93.. image:: image003.gif 
     94 
     95Thus 
     96 
     97where 0 =\< *A*  =\<1/4 in order for these values to be physically valid. 
     98 
     99.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     100 
     101.. _Specific_Surface_Area: 
     102 
     103Specific Surface Area 
     104--------------------- 
     105 
     106.. image:: image004.gif 
     107 
     108where *A*  and *Q**  are obtained from previous sections, and the Porod  
     109constant *Cp*  is given by users. 
     110 
     111.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     112 
     113.. _Definitions: 
     114 
     115Definitions 
     116----------- 
     117 
     118Q: the magnitude of neutron (or X-ray) momentum transfer vector. 
     119 
     120I(Q): the scattering intensity as a function of the momentum transfer Q. 
     121 
     122Invariant total is the sum of the invariant calculated from datas q range and 
     123the invariant resulting from extrapolation at low q range and at high q range  
     124if considered. 
     125 
     126.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     127 
     128.. _Reference: 
     129 
     130References 
     131---------- 
     132 
     133Chapter 2 in O. Glatter and O. Kratky, "Small Angle X-Ray Scattering", Academic  
     134Press, New York, 1982 
     135 
     136http://physchem.kfunigraz.ac.at/sm/ 
     137 
     138.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     139 
     140.. _How_to_Use: 
     141 
     142How to Use 
     143---------- 
     144 
     1451. Loading data to the panel: Open the data file from File in the menu bar.  
     146Select loaded data from a plot panel by highlighting that it until its color  
     147turns yellow. Then right click on that the data and selects the option Compute  
     148Invariant. The application automatically computes the invariant value if the  
     149data loaded is valid. 
     150 
     1512. To subtract a background or/and to rescale the data, type the values in  
     152Customized Input box. 
     153 
     1543. If you want to calculate the volume fraction and the specific surface  
     155area, type the optional inputs in the customized input box, and then press  
     156'Compute' button. 
     157 
     1584. The invariant can also be calculated including the outside of the data Q  
     159range:  To include the lower Q and/or the higher Q range, check in the enable  
     160extrapolation check box in 'Extrapolation' box. If the power low is chosen, 
     161the power (exponent) can be either held or fitted by checking the  
     162corresponding radio button.  The Npts that is being used for the extrapolation  
     163can be specified. 
     164 
     1655. If the invariant calculated from the extrapolated region is too large, it  
     166will be warn in red at the top of the panel, which means that your data is not  
     167proper to calculate the invariant. 
     168 
     1696. The details of the calculation is available by clicking the 'Details' 
     170button in the middle of the panel. 
     171 
     172.. image:: image005.gif 
  • src/sas/invariant/media/pr_help.rst

    r0d66541 r23a9beb  
    1 ..pr_help.rst 
     1.. pr_help.rst 
    22 
    3 Placeholder for P(r) help 
     3.. This is a port of the original SasView html help file to ReSTructured text 
     4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6.. |pi| unicode:: U+03C0 
     7.. |chi| unicode:: U+03C7 
     8 
     9P(r) Inversion Perspective 
     10========================== 
     11 
     12The inversion approach is based on Moore, J. Appl. Cryst., (1980) 13, 168-175. 
     13 
     14P(r) is set to be equal to an expansion of base functions of the type 
     15phi_n(r) = 2 * r * sin(|pi| * n * r / D_max). 
     16 
     17The coefficient of each base function in the expansion is found by performing  
     18a least square fit with the following fit function: 
     19 
     20|chi| ^2 = sum_i[ I_meas(q_i) - I_th(q_i) ]^2 / error^2 + Reg_term 
     21 
     22where I_meas(q) is the measured scattering intensity and I_th(q) is the  
     23prediction from the Fourier transform of the P(r) expansion.  
     24 
     25The Reg_term term is a regularization term set to the second derivative  
     26d^2 P(r) / dr^2 integrated over r. It is used to produce a smooth P(r) output. 
     27 
     28The following are user inputs: 
     29 
     30*  Number of terms: the number of base functions in the P(r) expansion. 
     31    
     32*  Regularization constant: a multiplicative constant to set the size of 
     33   the regularization term. 
     34 
     35*  Maximum distance: the maximum distance between any two points in the 
     36   system. 
Note: See TracChangeset for help on using the changeset viewer.