Changeset 10a483f in sasview


Ignore:
Timestamp:
Feb 14, 2015 9:19:06 AM (9 years ago)
Author:
krzywon
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:
30d7fb5
Parents:
b3efb7d (diff), 61f32d2b (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

Files:
44 added
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r8c9ffde raeb018d  
    3232src/sas/models/c_extension/c_models/c_models.cpp 
    3333src/sas/models/c_extension/python_wrapper/generated/ 
     34src/sas/models/media/.idea/ 
     35 
     36default_categories.json 
  • docs/sphinx-docs/build_sphinx.py

    r3a39c2e rf620870  
    6565            print "Found docs folder at \"%s\"." % docs 
    6666 
    67             dest_dir_name = os.path.basename(os.path.dirname(docs)) 
    68             dest_dir = os.path.join(SPHINX_SOURCE, "user", dest_dir_name) 
     67            dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC)) 
     68            if os.sep in dest_dir_part: 
     69                dest_dir_part = dest_dir_part[dest_dir_part.index(os.sep) + 1:] 
     70            dest_dir = os.path.join(SPHINX_SOURCE, "user", dest_dir_part) 
    6971 
    7072            copy_tree(docs, dest_dir) 
     
    105107    apidoc() 
    106108    build() 
     109         
     110print "=== Done ===" 
  • docs/sphinx-docs/source/user/user.rst

    r9dfb1f9 ref325c7  
    55   :maxdepth: 1 
    66 
    7    Models <models/model_functions> 
     7   Model Documentation <models/model_functions> 
     8    
     9    
     10   Loading Data <guiframe/data_explorer_help> 
     11    
     12   Plotting Data/Models <guiframe/graph_help> 
     13    
     14   Fitting Perspective <fitting/fitting_help> 
     15    
     16   P(r) Inversion Perspective <invariant/pr_help> 
     17    
     18   Invariant Calculation Perspective <invariant/invariant_help> 
     19    
     20   
     21   Data Operations Tool <data_util/data_operator_help> 
     22    
     23   SLD Calculator Tool <calculator/sld_calculator_help> 
     24    
     25   Density/Volume Calculator Tool <calculator/density_calculator_help> 
     26    
     27   Slit Size Calculator Tool <calculator/slit_calculator_help> 
     28    
     29   Kiessig Thickness Calculator Tool <calculator/kiessig_calculator_help> 
     30    
     31   SANS Resolution Estimator Tool <calculator/resolution_calculator_help> 
     32    
     33   Generic Scattering Calculator Tool <calculator/sas_calculator_help> 
     34    
     35   Python Shell Tool 
     36    
     37   Image Viewer Tool 
  • 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

    r7a04dbb ra6d2e3b  
    336336            os.path.join(smear_dir, "smearer2d_helper_module.cpp"), 
    337337            os.path.join(smear_dir, "smearer2d_helper.cpp"), 
     338            os.path.join(igordir, "winFuncs.c"), 
    338339        ], 
    339340        include_dirs=[smear_dir, numpy_incl_path], 
     
    346347            os.path.join(c_model_dir, "libfunc.c"), 
    347348            os.path.join(c_model_dir, "librefl.c"), 
     349            os.path.join(igordir, "winFuncs.c"), 
    348350        ], 
    349351        include_dirs=[gen_dir, includedir,  c_model_dir, numpy_incl_path], 
  • src/sas/guiframe/gui_manager.py

    rb9a5f0e rad8872e  
    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/models/c_extension/c_models/librefl.c

    r79492222 ra6d2e3b  
    88#include <stdlib.h> 
    99#if defined(_MSC_VER) 
    10 #include "winFuncs.h" 
     10#include "../libigor/winFuncs.h" 
    1111#endif 
    1212 
  • src/sas/models/media/readme.txt

    r79492222 rae00b6f  
    22file from html to restructured text. 
    33 
    4 model_functions.html is the help file distributed with SasView v2.2.1. 
     4model_functions_v0.html (if present) is the help file distributed with SasView v2.2.1. 
    55 
    66model_functions-2.html (if present) is the current html generated from the  
     
    88 
    99NIST_IGOR_SANS_Model_Docs_v4.10.pdf should be used as the primary reference  
    10 for queries about the model descriptions, NOT model_functions.html. 
     10for queries about the model descriptions, NOT model_functions_v0.html. 
    1111 
    1212Steve King 
    13 Apr 2014 
     13Feb 2015 
  • 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################################################################################ 
  • 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/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_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) 
  • 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         
Note: See TracChangeset for help on using the changeset viewer.