Changes in / [e89aed5:1dbdb83] in sasview


Ignore:
Files:
68 added
22 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    re04f87b rdf332d8  
    88# generated. 
    99# 
    10 # Feel free to add more stuff to this as and when it becomes an issue.  
     10# Feel free to add more stuff to this as and when it becomes an issue. 
    1111 
    1212.project 
     
    5050/test/sasdataloader/test/plugins.zip 
    5151/test/sasdataloader/test/test_log.txt 
     52/test/sasdataloader/test/isis_1_0_write_test.xml 
     53/test/sasdataloader/test/isis_1_1_write_test.xml 
     54/test/sasdataloader/test/write_test.xml 
    5255 
    5356# autogenerated scripts 
    5457/sasview/installer.iss 
    55  
  • build_tools/requirements.txt

    r785cc657 rbe4cb41  
    1111bumps==0.7.5.9 
    1212# numpy==1.6.1 
    13 # scipy==0.10.1 
     13scipy>=0.18.0 
    1414# wx==2.8.12.1 
    1515# matplotlib==1.1.0 
  • docs/sphinx-docs/build_sphinx.py

    r8096b446 r578a11d  
    3535#/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 
    3636SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 
     37SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans") 
    3738SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 
    3839SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") 
     
    7172SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
    7273SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 
     74SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user") 
    7375 
    7476BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", 
     
    190192                    shutil.copy(fromhere,tohere) 
    191193 
     194    if os.path.exists(SASMODELS_SOURCE_SESANS): 
     195        print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS 
     196        if os.path.exists(SPHINX_SOURCE_USER): 
     197            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER 
     198            print "Copying sasmodels sesans files..." 
     199            for files in os.listdir(SASMODELS_SOURCE_SESANS): 
     200                if files.endswith(".rst"): 
     201                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files) 
     202                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
     203                    shutil.copy(fromhere,tohere) 
     204 
    192205    if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 
    193206        print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM 
  • docs/sphinx-docs/source/user/analysis.rst

    r8f46df7 rec860a8f  
     1.. _analysis: 
     2 
    13Types of Analysis 
    24================= 
     
    68.. toctree:: 
    79   :maxdepth: 1 
    8     
     10 
    911   Model Fitting <sasgui/perspectives/fitting/fitting> 
    10     
     12 
    1113   P(r) Inversion <sasgui/perspectives/pr/pr_help> 
    12     
     14 
    1315   Invariant Calculation <sasgui/perspectives/invariant/invariant_help> 
     16 
     17   Correlation Function <sasgui/perspectives/corfunc/corfunc_help> 
  • docs/sphinx-docs/source/user/tools.rst

    r8f46df7 rec860a8f  
     1.. _tools: 
     2 
    13Tools 
    24===== 
     
    810 
    911   Data Operations Utility <sasgui/perspectives/calculator/data_operator_help> 
    10        
     12 
    1113   Density/Volume Calculator <sasgui/perspectives/calculator/density_calculator_help> 
    12     
     14 
    1315   Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 
    14     
     16 
    1517   Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 
    16     
     18 
    1719   Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 
    18     
     20 
    1921   SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 
    20     
     22 
    2123   Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 
    22     
     24 
    2325   Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 
    24     
     26 
    2527   Python Shell <sasgui/perspectives/calculator/python_shell_help> 
    26     
     28 
     29   File Converter <sasgui/perspectives/file_converter/file_converter_help> 
  • docs/sphinx-docs/source/user/tutorial.rst

    r13161ac rec860a8f  
    11.. tutorial.rst 
     2 
     3.. _tutorial: 
    24 
    35Tutorial 
  • docs/sphinx-docs/source/user/working.rst

    rc43953ef r578a11d  
    1919   Computations with a GPU <gpu_computations> 
    2020    
     21   Converting SANS to SESANS <sans_to_sesans> 
     22    
  • run.py

    r832fea2 r18e7309  
    7272    platform = '%s-%s'%(get_platform(),sys.version[:3]) 
    7373    build_path = joinpath(root, 'build','lib.'+platform) 
    74      
    75     # Notify the help menu that the Sphinx documentation is in a different  
     74 
     75    # Notify the help menu that the Sphinx documentation is in a different 
    7676    # place than it otherwise would be. 
    7777    os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") 
     
    123123    # Compiled modules need to be pulled from the build directory. 
    124124    # Some packages are not where they are needed, so load them explicitly. 
     125    import sas.sascalc.file_converter 
     126    sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 
     127                                  joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))                     
     128 
     129    # Compiled modules need to be pulled from the build directory. 
     130    # Some packages are not where they are needed, so load them explicitly. 
    125131    import sas.sascalc.calculator 
    126132    sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
  • sasview/local_config.py

    rc1fdf84 rc1fdf84  
    9595GUIFRAME_WIDTH = 1150 
    9696GUIFRAME_HEIGHT = 840 
    97 PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv'] 
     97PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv', '.cor'] 
    9898PLUGINS_WLIST = ['Fitting files (*.fitv)|*.fitv', 
    9999                 'Invariant files (*.inv)|*.inv', 
    100                  'P(r) files (*.prv)|*.prv'] 
     100                 'P(r) files (*.prv)|*.prv', 
     101                 'Corfunc files (*.cor)|*.cor'] 
    101102PLOPANEL_WIDTH = 415 
    102103PLOPANEL_HEIGTH = 370 
  • sasview/sasview.py

    rcde6e52 rcde6e52  
    148148            logging.error(traceback.format_exc()) 
    149149 
     150        # Corfunc perspective 
     151        try: 
     152            import sas.sasgui.perspectives.corfunc as module 
     153            corfunc_plug = module.Plugin() 
     154            self.gui.add_perspective(corfunc_plug) 
     155        except: 
     156            logging.error("Unable to load corfunc module") 
     157 
    150158        #Calculator perspective 
    151159        try: 
     
    155163        except: 
    156164            logging.error("%s: could not find Calculator plug-in module"% \ 
     165                                                        APP_NAME) 
     166            logging.error(traceback.format_exc()) 
     167 
     168        # File converter tool 
     169        try: 
     170            import sas.sasgui.perspectives.file_converter as module 
     171            converter_plug = module.Plugin() 
     172            self.gui.add_perspective(converter_plug) 
     173        except: 
     174            logging.error("%s: could not find File Converter plug-in module"% \ 
    157175                                                        APP_NAME) 
    158176            logging.error(traceback.format_exc()) 
  • sasview/test/README.txt

    rd4c88e24 r850a498  
    1 Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data, 2D data, SASVIEW saved states, and data in formats that are not yet implemented but are in the works for future versions. 
    2 1D data sets have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis. 2D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and meta data may also be available. 
     1Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data (ie, I(Q)), 2D data (ie, I(Qx,Qy)), coordinate data (eg, PDB files), image data (eg, TIFF files), SasView saved states, SESANS data, and data in formats that are not yet implemented but which are in the works for future releases. 
     2 
     31D data sets EITHER a) have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis, OR b) have I and Q in separate files. Data in the latter format need to be converted to a single file format with the File Converter tool before SasView will analyse them. 
     4 
     52D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and metadata may also be available. 
     6 
     7Coordinate data sets are designed to be read by the Generic Scattering Calculator tool. 
     8 
     9Image data sets are designed to be read by the Image Viewer tool. 
     10 
    311Save states are projects and analyses saved by the SASVIEW program. A single analysis file contains the data and parameters for a single fit (.fit), p(r) inversion (.pr), or invariant calculation (.inv). A project file (.svs) contains the results for every active analysis. 
     12 
     13SESANS data sets primarily contain the neutron polarisation as a function of the spin-echo length. 
  • setup.py

    rdb74ee8 r18e7309  
    99from distutils.command.build_ext import build_ext 
    1010from distutils.core import Command 
     11import numpy 
    1112 
    1213# Manage version number ###################################### 
     
    5455        print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 
    5556        shutil.rmtree(SASVIEW_BUILD) 
    56                      
     57 
    5758# 'sys.maxsize' and 64bit: Not supported for python2.5 
    5859is_64bits = False 
    5960if sys.version_info >= (2, 6): 
    6061    is_64bits = sys.maxsize > 2**32 
    61      
     62 
    6263enable_openmp = False 
    6364 
     
    118119        c = self.compiler.compiler_type 
    119120        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
    120          
     121 
    121122        # OpenMP build options 
    122123        if enable_openmp: 
     
    127128                for e in self.extensions: 
    128129                    e.extra_link_args = lopt[ c ] 
    129                      
     130 
    130131        # Platform-specific build options 
    131132        if platform_lopt.has_key(c): 
     
    205206) 
    206207 
    207      
     208 
    208209# sas.sascalc.pr 
    209210srcdir  = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 
     
    217218                              include_dirs=[], 
    218219                              ) ) 
    219          
     220 
     221# sas.sascalc.file_converter 
     222mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 
     223package_dir["sas.sascalc.file_converter.core"] = mydir 
     224package_dir["sas.sascalc.file_converter"] = os.path.join("src","sas", "sascalc", "file_converter") 
     225packages.extend(["sas.sascalc.file_converter","sas.sascalc.file_converter.core"]) 
     226ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 
     227                              sources = [os.path.join(mydir, "bsl_loader.c")], 
     228                              include_dirs=[numpy.get_include()], 
     229                              ) ) 
     230 
    220231# sas.sascalc.fit 
    221232package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") 
     
    239250packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 
    240251package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 
    241      
     252 
    242253# Data util 
    243254package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 
     
    294305                               'test/2d_data/*', 
    295306                               'test/save_states/*', 
    296                                'test/upcoming_formats/*',  
     307                               'test/upcoming_formats/*', 
    297308                                 'default_categories.json'] 
    298309packages.append("sas.sasview") 
     
    316327    required.extend(['pillow']) 
    317328 
    318 # Set up SasView     
     329# Set up SasView 
    319330setup( 
    320331    name="sasview", 
     
    341352                'docs': BuildSphinxCommand, 
    342353                'disable_openmp': DisableOpenMPCommand} 
    343     )    
     354    ) 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r654e8e0 r654e8e0  
    11771177            written = written | self.write_node(pix, "z", item.pixel_size.z, 
    11781178                                                {"unit": item.pixel_size_unit}) 
    1179             written = written | self.write_node(det, "slit_length", 
    1180                                                 item.slit_length, 
    1181                                                 {"unit": item.slit_length_unit}) 
    11821179            if written == True: 
    11831180                self.append(pix, det) 
     1181            self.write_node(det, "slit_length", item.slit_length, 
     1182                {"unit": item.slit_length_unit}) 
     1183 
    11841184 
    11851185    def _write_process_notes(self, datainfo, entry_node): 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r479799c r5e906207  
    2323 
    2424    Any number of SASdata sets may be present in a SASentry and the data within can be either 1D I(Q) or 2D I(Qx, Qy). 
     25 
     26    Also supports reading NXcanSAS formatted HDF5 files 
    2527 
    2628    :Dependencies: 
     
    7678                ## Add the last data set to the list of outputs 
    7779                self.add_data_set() 
     80                ## Close the data file 
     81                self.raw_data.close() 
    7882        ## Return data set(s) 
    7983        return self.output 
     
    183187                    elif key == u'run': 
    184188                        self.current_datainfo.run.append(data_point) 
     189                        try: 
     190                            run_name = value.attrs['name'] 
     191                            run_dict = {data_point: run_name} 
     192                            self.current_datainfo.run_name = run_dict 
     193                        except: 
     194                            pass 
    185195                    elif key == u'title': 
    186196                        self.current_datainfo.title = data_point 
     
    189199 
    190200                    ## Sample Information 
    191                     elif key == u'Title' and self.parent_class == u'SASsample': 
     201                    elif key == u'Title' and self.parent_class == u'SASsample': # CanSAS 2.0 format 
     202                        self.current_datainfo.sample.name = data_point 
     203                    elif key == u'ID' and self.parent_class == u'SASsample': # NXcanSAS format 
    192204                        self.current_datainfo.sample.name = data_point 
    193205                    elif key == u'thickness' and self.parent_class == u'SASsample': 
     
    195207                    elif key == u'temperature' and self.parent_class == u'SASsample': 
    196208                        self.current_datainfo.sample.temperature = data_point 
     209                    elif key == u'transmission' and self.parent_class == u'SASsample': 
     210                        self.current_datainfo.sample.transmission = data_point 
     211                    elif key == u'x_position' and self.parent_class == u'SASsample': 
     212                        self.current_datainfo.sample.position.x = data_point 
     213                    elif key == u'y_position' and self.parent_class == u'SASsample': 
     214                        self.current_datainfo.sample.position.y = data_point 
     215                    elif key == u'polar_angle' and self.parent_class == u'SASsample': 
     216                        self.current_datainfo.sample.orientation.x = data_point 
     217                    elif key == u'azimuthal_angle' and self.parent_class == u'SASsample': 
     218                        self.current_datainfo.sample.orientation.z = data_point 
     219                    elif key == u'details' and self.parent_class == u'SASsample': 
     220                        self.current_datainfo.sample.details.append(data_point) 
    197221 
    198222                    ## Instrumental Information 
     
    204228                        self.detector.distance = float(data_point) 
    205229                        self.detector.distance_unit = unit 
     230                    elif key == u'slit_length' and self.parent_class == u'SASdetector': 
     231                        self.detector.slit_length = float(data_point) 
     232                        self.detector.slit_length_unit = unit 
     233                    elif key == u'x_position' and self.parent_class == u'SASdetector': 
     234                        self.detector.offset.x = float(data_point) 
     235                        self.detector.offset_unit = unit 
     236                    elif key == u'y_position' and self.parent_class == u'SASdetector': 
     237                        self.detector.offset.y = float(data_point) 
     238                        self.detector.offset_unit = unit 
     239                    elif key == u'polar_angle' and self.parent_class == u'SASdetector': 
     240                        self.detector.orientation.x = float(data_point) 
     241                        self.detector.orientation_unit = unit 
     242                    elif key == u'azimuthal_angle' and self.parent_class == u'SASdetector': 
     243                        self.detector.orientation.z = float(data_point) 
     244                        self.detector.orientation_unit = unit 
     245                    elif key == u'beam_center_x' and self.parent_class == u'SASdetector': 
     246                        self.detector.beam_center.x = float(data_point) 
     247                        self.detector.beam_center_unit = unit 
     248                    elif key == u'beam_center_y' and self.parent_class == u'SASdetector': 
     249                        self.detector.beam_center.y = float(data_point) 
     250                        self.detector.beam_center_unit = unit 
     251                    elif key == u'x_pixel_size' and self.parent_class == u'SASdetector': 
     252                        self.detector.pixel_size.x = float(data_point) 
     253                        self.detector.pixel_size_unit = unit 
     254                    elif key == u'y_pixel_size' and self.parent_class == u'SASdetector': 
     255                        self.detector.pixel_size.y = float(data_point) 
     256                        self.detector.pixel_size_unit = unit 
    206257                    elif key == u'SSD' and self.parent_class == u'SAScollimation': 
    207258                        self.collimation.length = data_point 
     
    213264                    elif key == u'name' and self.parent_class == u'SASprocess': 
    214265                        self.process.name = data_point 
    215                     elif key == u'Title' and self.parent_class == u'SASprocess': 
     266                    elif key == u'Title' and self.parent_class == u'SASprocess': # CanSAS 2.0 format 
     267                        self.process.name = data_point 
     268                    elif key == u'name' and self.parent_class == u'SASprocess': # NXcanSAS format 
    216269                        self.process.name = data_point 
    217270                    elif key == u'description' and self.parent_class == u'SASprocess': 
     
    230283                        self.trans_spectrum.wavelength.append(data_point) 
    231284 
    232                     ## Other Information 
     285                    ## Source 
    233286                    elif key == u'wavelength' and self.parent_class == u'SASdata': 
    234287                        self.current_datainfo.source.wavelength = data_point 
    235                         self.current_datainfo.source.wavelength.unit = unit 
     288                        self.current_datainfo.source.wavelength_unit = unit 
     289                    elif key == u'incident_wavelength' and self.parent_class == u'SASsource': 
     290                        self.current_datainfo.source.wavelength = data_point 
     291                        self.current_datainfo.source.wavelength_unit = unit 
     292                    elif key == u'wavelength_max' and self.parent_class == u'SASsource': 
     293                        self.current_datainfo.source.wavelength_max = data_point 
     294                        self.current_datainfo.source.wavelength_max_unit = unit 
     295                    elif key == u'wavelength_min' and self.parent_class == u'SASsource': 
     296                        self.current_datainfo.source.wavelength_min = data_point 
     297                        self.current_datainfo.source.wavelength_min_unit = unit 
     298                    elif key == u'wavelength_spread' and self.parent_class == u'SASsource': 
     299                        self.current_datainfo.source.wavelength_spread = data_point 
     300                        self.current_datainfo.source.wavelength_spread_unit = unit 
     301                    elif key == u'beam_size_x' and self.parent_class == u'SASsource': 
     302                        self.current_datainfo.source.beam_size.x = data_point 
     303                        self.current_datainfo.source.beam_size_unit = unit 
     304                    elif key == u'beam_size_y' and self.parent_class == u'SASsource': 
     305                        self.current_datainfo.source.beam_size.y = data_point 
     306                        self.current_datainfo.source.beam_size_unit = unit 
     307                    elif key == u'beam_shape' and self.parent_class == u'SASsource': 
     308                        self.current_datainfo.source.beam_shape = data_point 
    236309                    elif key == u'radiation' and self.parent_class == u'SASsource': 
    237310                        self.current_datainfo.source.radiation = data_point 
     
    376449        self.current_datainfo = DataInfo() 
    377450 
     451 
    378452    def _initialize_new_data_set(self, parent_list = None): 
    379453        """ 
  • src/sas/sasgui/guiframe/events.py

    rd85c194 r6ffa0dd  
    88# plot Qrange 
    99(PlotQrangeEvent, EVT_PLOT_QRANGE) = wx.lib.newevent.NewEvent() 
     10# set plot limits 
     11(PlotLimitEvent, EVT_PLOT_LIM) = wx.lib.newevent.NewEvent() 
    1012# print the messages on statusbar 
    1113(StatusEvent,  EVT_STATUS)   = wx.lib.newevent.NewEvent() 
    12 #create a panel slicer  
     14#create a panel slicer 
    1315(SlicerPanelEvent, EVT_SLICER_PANEL)   = wx.lib.newevent.NewEvent() 
    14 #print update paramaters for panel slicer  
     16#print update paramaters for panel slicer 
    1517(SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE)   = wx.lib.newevent.NewEvent() 
    16 #update the slicer from the panel  
     18#update the slicer from the panel 
    1719(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent() 
    1820#slicer event 
  • src/sas/sasgui/guiframe/gui_statusbar.py

    rd85c194 r3a22ce7  
    66import sys 
    77import logging 
     8import datetime 
    89from wx import StatusBar as wxStatusB 
    910from wx.lib import newevent 
     
    4647 
    4748        self.msg_txt.SetEditable(False) 
    48         self.msg_txt.SetValue('No message available') 
     49        timestamp = datetime.datetime.now() 
     50        status = '{:%Y-%m-%d %H:%M:%S} : No message available'.format(timestamp) 
     51        self.msg_txt.SetValue(status) 
    4952        self.sizer.Add(self.msg_txt, 1, wx.EXPAND|wx.ALL, 10) 
    5053        self.SetSizer(self.sizer) 
     
    6063        if status.strip() == "": 
    6164            return 
     65        # Add timestamp 
     66        timestamp = datetime.datetime.now() 
     67        status = '{:%Y-%m-%d %H:%M:%S} : '.format(timestamp) + status 
    6268        color = (0, 0, 0) #black 
    6369        icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r895c9cb r245ae18  
    9595        self.parent.SetFocus() 
    9696 
     97        # If true, there are 3 qrange bars 
     98        self.is_corfunc = False 
     99 
    97100 
    98101    def get_symbol_label(self): 
     
    214217        if active_ctrl == None: 
    215218            return 
     219        if hasattr(event, 'is_corfunc'): 
     220            self.is_corfunc = event.is_corfunc 
    216221        if event.id in self.plots.keys(): 
    217222            ctrl = event.ctrl 
     
    222227            values = [max(x_data.min(), float(ctrl[0].GetValue())), 
    223228                      min(x_data.max(), float(ctrl[1].GetValue()))] 
     229            if len(ctrl) == 3: 
     230                colors.append('purple') 
     231                values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 
    224232            if self.ly == None: 
    225233                self.ly = [] 
     
    232240                xval = float(active_ctrl.GetValue()) 
    233241                position = self.get_data_xy_vals(xval) 
    234                 if position != None: 
     242                if position != None and not self.is_corfunc: 
    235243                    wx.PostEvent(self.parent, StatusEvent(status=position)) 
    236244            except: 
     
    293301        ly0x = ly[0].get_xdata() 
    294302        ly1x = ly[1].get_xdata() 
     303        ly2x = None 
     304        if self.is_corfunc: ly2x = ly[2].get_xdata() 
    295305        self.q_ctrl[0].SetBackgroundColour('white') 
    296306        self.q_ctrl[1].SetBackgroundColour('white') 
     
    306316                self.q_ctrl[0].SetValue(str(pos_x)) 
    307317                self.q_ctrl[1].SetBackgroundColour('pink') 
     318        elif ly2x is not None and ly1x >= ly2x: 
     319            if self.vl_ind == 1: 
     320                ly[2].set_xdata(posx) 
     321                ly[2].set_zorder(nop) 
     322                self.q_ctrl[2].SetValue(str(pos_x)) 
     323            elif self.vl_ind == 2: 
     324                ly[1].set_xdata(posx) 
     325                ly[1].set_zorder(nop) 
     326                self.q_ctrl[1].SetValue(str(pos_x)) 
     327 
    308328 
    309329    def _get_cusor_lines(self, event): 
     
    325345            dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 
    326346            dqmax = math.fabs(event.xdata - self.ly[1].get_xdata()) 
    327             is_qmax = dqmin > dqmax 
    328             if is_qmax: 
    329                 self.vl_ind = 1 
     347            if not self.is_corfunc: 
     348                is_qmax = dqmin > dqmax 
     349                if is_qmax: 
     350                    self.vl_ind = 1 
     351                else: 
     352                    self.vl_ind = 0 
    330353            else: 
    331                 self.vl_ind = 0 
     354                dqmax2 = math.fabs(event.xdata - self.ly[2].get_xdata()) 
     355                closest = min(dqmin, dqmax, dqmax2) 
     356                self.vl_ind = { dqmin: 0, dqmax: 1, dqmax2: 2 }.get(closest) 
    332357 
    333358    def cusor_line(self, event): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py

    rd85c194 r6ffa0dd  
    1616from sas.sasgui.guiframe.events import EVT_NEW_PLOT 
    1717from sas.sasgui.guiframe.events import EVT_PLOT_QRANGE 
     18from sas.sasgui.guiframe.events import EVT_PLOT_LIM 
    1819from sas.sasgui.guiframe.events import DeletePlotPanelEvent 
    1920from sas.sasgui.guiframe.plugin_base import PluginBase 
     
    7980        self.parent.Bind(EVT_NEW_PLOT, self._on_plot_event) 
    8081        self.parent.Bind(EVT_PLOT_QRANGE, self._on_plot_qrange) 
     82        self.parent.Bind(EVT_PLOT_LIM, self._on_plot_lim) 
    8183        # We have no initial panels for this plug-in 
    8284        return [] 
     
    9597            return 
    9698        panel.on_plot_qrange(event) 
     99 
     100    def _on_plot_lim(self, event=None): 
     101        if event == None: 
     102            return 
     103        if event.id in self.plot_panels.keys(): 
     104            panel = self.plot_panels[event.id] 
     105        elif event.group_id in self.plot_panels.keys(): 
     106            panel = self.plot_panels[event.group_id] 
     107        else: 
     108            return 
     109        if hasattr(event, 'xlim'): 
     110            panel.subplot.set_xlim(event.xlim) 
     111        if hasattr(event, 'ylim'): 
     112            panel.subplot.set_ylim(event.ylim) 
     113 
    97114 
    98115    def _on_show_panel(self, event): 
     
    312329                new_panel = self.create_2d_panel(data, group_id) 
    313330            self.create_panel_helper(new_panel, data, group_id, title) 
     331            if hasattr(event, 'xlim'): 
     332                new_panel.subplot.set_xlim(event.xlim) 
     333            if hasattr(event, 'ylim'): 
     334                new_panel.subplot.set_ylim(event.ylim) 
    314335        return 
  • src/sas/sasgui/guiframe/media/data_formats_help.rst

    rd85c194 r280f929  
    33.. This is a port of the original SasView html help file to ReSTructured text 
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5.. WG Bouwman, DUT, added during CodeCamp-V in Oct 2016 the SESANS data format 
    56 
    67.. _Formats: 
     
    910============ 
    1011 
    11 SasView reads several different 1D (I(Q) vs Q) and 2D (I(Qx,Qy) vs (Qx,Qy)) 
     12SasView reads several different 1D (I(Q) vs Q), 2D SANS(I(Qx,Qy) vs (Qx,Qy)) 
     13and SESANS (P(z) vs z) 
    1214data files. But please note that SasView does not at present load data where 
    1315the Q and I(Q) data are in separate files. 
    1416 
    15 1D Formats 
    16 ---------- 
     171D Formats SANS 
     18--------------- 
    1719 
    1820SasView will read files with 2 to 4 columns of numbers in the following order:  
     
    4648.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    4749 
    48 2D Formats 
    49 ---------- 
     502D Formats SANS 
     51--------------- 
    5052 
    5153SasView will only read files in the NIST 2D format with the extensions  
     
    6062.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    6163 
    62 .. note::  This help document was last changed by Steve King, 01May2015 
     64SESANS Format 
     65------------- 
     66 
     67The current file extension is .ses or .sesans (not case sensitive). 
     68 
     69The file format is to have a list of name-value pairs as a header at the top of the file, detailing general experimental parameters necessary for fitting and analyzing data. This list should contain all information necessary for the file to be 'portable' between users. 
     70 
     71Following that is a 6 column list of instrument experimental variables: 
     72 
     73- Spin echo length (z, in Angstroms) 
     74- Spin echo length error (:math:`\Delta` z, in Angstroms) (experimental resolution) 
     75- neutron wavelength (:math:`\lambda`, in Angstroms) (essential for ToF instruments) 
     76- neutron wavelength error (:math:`\Delta \lambda`, in Angstroms) 
     77- Normalized polarization (:math:`P/P_0`, unitless) 
     78- Normalized polarization error (:math:`\Delta(P/P_0)`, unitless) (measurement error) 
     79 
     80 
     81.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     82 
     83.. note::  This help document was last changed by Wim Bouwman, 05Oct2016 
  • src/sas/sasgui/perspectives/calculator/pyconsole.py

    r7673ecd rf1cbae7  
    99import wx 
    1010from wx.lib.dialogs import ScrolledMessageDialog 
     11from wx.lib import layoutf 
     12 
    1113import wx.py.editor as editor 
    1214 
     
    6365        title, icon = "Info", wx.ICON_INFORMATION 
    6466    text = "\n".join(parts) 
    65     dlg = ScrolledMessageDialog(parent, text, title, size=((550, 250))) 
     67    dlg = ResizableScrolledMessageDialog(parent, text, title, size=((550, 250))) 
    6668    fnt = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL) 
    6769    dlg.GetChildren()[0].SetFont(fnt) 
     
    7072    dlg.Destroy() 
    7173    return errmsg is None 
     74 
     75class ResizableScrolledMessageDialog(wx.Dialog): 
     76    """ 
     77    Custom version of wx ScrolledMessageDialog, allowing border resize 
     78    """ 
     79    def __init__(self, parent, msg, caption, 
     80        pos=wx.DefaultPosition, size=(500,300), 
     81        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER ): 
     82        # Notice, that style can be overrriden in the caller. 
     83        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style) 
     84        x, y = pos 
     85        if x == -1 and y == -1: 
     86            self.CenterOnScreen(wx.BOTH) 
     87 
     88        text = wx.TextCtrl(self, -1, msg, style=wx.TE_MULTILINE | wx.TE_READONLY) 
     89        ok = wx.Button(self, wx.ID_OK, "OK") 
     90 
     91        # Mysterious constraint layouts from  
     92        # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 
     93        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) 
     94        text.SetConstraints(lc) 
     95        lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)) 
     96        ok.SetConstraints(lc) 
     97 
     98        self.SetAutoLayout(1) 
     99        self.Layout() 
    72100 
    73101class PyConsole(editor.EditorNotebookFrame): 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rc65a265 r4c3be25  
    143143        self.theory_qmin_x = None 
    144144        self.theory_qmax_x = None 
    145         self.cb1 = None 
    146145        self.btEditMask = None 
    147146        self.btFit = None 
     
    11971196        # set data, etc. from the state 
    11981197        # reset page between theory and fitting from bookmarking 
    1199         #if state.data == None: 
    1200         #    data = None 
    1201         #else: 
    12021198        data = state.data 
    12031199 
     
    12251221        self.disp_cb_dict = state.disp_cb_dict 
    12261222        self.disp_list = state.disp_list 
    1227  
    1228         ## set the state of the radio box 
    1229         #self.shape_rbutton.SetValue(state.shape_rbutton) 
    1230         #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 
    1231         #self.struct_rbutton.SetValue(state.struct_rbutton) 
    1232         #self.plugin_rbutton.SetValue(state.plugin_rbutton) 
    12331223 
    12341224        ## fill model combobox 
     
    12861276            else: 
    12871277                self.model_view.SetLabel("1D Mode") 
    1288  
    1289         ## set the select all check box to the a given state 
    1290         self.cb1.SetValue(state.cb1) 
    12911278 
    12921279        ## reset state of checkbox,textcrtl  and  regular parameters value 
     
    14181405                        except Exception: 
    14191406                            logging.error(traceback.format_exc()) 
    1420  
    1421         # Make sure the check box updated when all checked 
    1422         if self.cb1.GetValue(): 
    1423             self.select_all_param(None) 
    14241407 
    14251408    def _selectDlg(self): 
     
    25572540                        item[2].Enable() 
    25582541 
    2559             # Make sure the check box updated when all checked 
    2560             if self.cb1.GetValue(): 
    2561                 #self.select_all_param(None) 
    2562                 self.get_all_checked_params() 
     2542            # Make sure the check box updated 
     2543            self.get_all_checked_params() 
    25632544 
    25642545            # update params 
     
    37153696        call back for model selection if implemented 
    37163697        """ 
    3717     def select_all_param(self, event): 
    3718         """ 
    3719         set to true or false all checkBox if implemented 
    3720         """ 
    37213698    def get_weight_flag(self): 
    37223699        """ 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r6c382da r4c3be25  
    624624        ## fill a sizer with the combobox to select dispersion type 
    625625        model_disp = wx.StaticText(self, wx.ID_ANY, 'Function') 
    626         CHECK_STATE = self.cb1.GetValue() 
     626        CHECK_STATE = False 
    627627 
    628628        ix = 0 
     
    969969        self.state.model = self.model.clone() 
    970970        ## save state into 
    971         self.state.cb1 = self.cb1.GetValue() 
    972971        self._copy_parameters_state(self.parameters, self.state.parameters) 
    973972        self._copy_parameters_state(self.orientation_params_disp, 
     
    980979                     StatusEvent(status=" Selected Distribution: Gaussian")) 
    981980        #Fill the list of fittable parameters 
    982         #self.select_all_param(event=None) 
    983981        self.get_all_checked_params() 
    984982        self.Layout() 
     
    26952693        self._manager.set_param2fit(self.uid, param2fit) 
    26962694 
    2697     def select_all_param(self, event): 
    2698         """ 
    2699         set to true or false all checkBox given the main checkbox value cb1 
    2700         """ 
    2701         self.param_toFit = [] 
    2702         if  self.parameters != []: 
    2703             if  self.cb1.GetValue(): 
    2704                 for item in self.parameters: 
    2705                     if item[0].IsShown(): 
    2706                         ## for data2D select all to fit 
    2707                         if self.data.__class__.__name__ == "Data2D" or \ 
    2708                                 self.enable2D: 
    2709                             item[0].SetValue(True) 
    2710                             self.param_toFit.append(item) 
    2711                         else: 
    2712                             ## for 1D all parameters except orientation 
    2713                             if not item in self.orientation_params: 
    2714                                 item[0].SetValue(True) 
    2715                                 self.param_toFit.append(item) 
    2716                     else: 
    2717                         item[0].SetValue(False) 
    2718                 #if len(self.fittable_param)>0: 
    2719                 for item in self.fittable_param: 
    2720                     if item[0].IsShown(): 
    2721                         if self.data.__class__.__name__ == "Data2D" or \ 
    2722                                 self.enable2D: 
    2723                             item[0].SetValue(True) 
    2724                             self.param_toFit.append(item) 
    2725                             try: 
    2726                                 if len(self.values[item[1]]) > 0: 
    2727                                     item[0].SetValue(False) 
    2728                             except: 
    2729                                 pass 
    2730  
    2731                         else: 
    2732                             ## for 1D all parameters except orientation 
    2733                             if not item in self.orientation_params_disp: 
    2734                                 item[0].SetValue(True) 
    2735                                 self.param_toFit.append(item) 
    2736                                 try: 
    2737                                     if len(self.values[item[1]]) > 0: 
    2738                                         item[0].SetValue(False) 
    2739                                 except: 
    2740                                     pass 
    2741                     else: 
    2742                         item[0].SetValue(False) 
    2743  
    2744             else: 
    2745                 for item in self.parameters: 
    2746                     item[0].SetValue(False) 
    2747                 for item in self.fittable_param: 
    2748                     item[0].SetValue(False) 
    2749                 self.param_toFit = [] 
    2750  
    2751         self.save_current_state_fit() 
    2752  
    2753         if event != None: 
    2754             #self._undo.Enable(True) 
    2755             ## post state to fit panel 
    2756             event = PageInfoEvent(page=self) 
    2757             wx.PostEvent(self.parent, event) 
    2758         param2fit = [] 
    2759         for item in self.param_toFit: 
    2760             if item[0] and item[0].IsShown(): 
    2761                 param2fit.append(item[1]) 
    2762         self.parent._manager.set_param2fit(self.uid, param2fit) 
    2763  
    27642695    def select_param(self, event): 
    27652696        """ 
     
    28082739        if len(self.fittable_param) > 0: 
    28092740            len_orient_para *= 2 
    2810         #Set the value of checkbox that selected every checkbox or not 
    2811         if len(self.parameters) + len(self.fittable_param) - len_orient_para \ 
    2812             == len(self.param_toFit): 
    2813             self.cb1.SetValue(True) 
    2814         else: 
    2815             self.cb1.SetValue(False) 
    28162741 
    28172742        self.save_current_state_fit() 
     
    29152840        iy = 0 
    29162841        ix = 0 
    2917         select_text = "Select All" 
    2918         self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10)) 
    2919         wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 
    2920         self.cb1.SetToolTipString("To check/uncheck all the boxes below.") 
    2921         self.cb1.SetValue(True) 
    2922  
    2923         sizer.Add(self.cb1, (iy, ix), (1, 1), \ 
    2924                              wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 
     2842        sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Parameter'), 
     2843                  (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    29252844        ix += 1 
    29262845        self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value') 
     
    29492868        self.text2_4.Hide() 
    29502869 
    2951         CHECK_STATE = self.cb1.GetValue() 
     2870        CHECK_STATE = False 
    29522871        for item in keys: 
    29532872 
  • src/sas/sasgui/perspectives/fitting/media/plugin.rst

    rcbbb6a4 rb2a3814  
    33Writing a Plugin Model 
    44====================== 
     5 
     6.. note:: If some code blocks are not readable, expand the documentation window 
    57 
    68Overview 
Note: See TracChangeset for help on using the changeset viewer.