Changeset 8d3d20a in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Oct 6, 2016 12:35:24 PM (8 years ago)
Author:
GitHub <noreply@…>
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
4c3be25
Parents:
0639476 (diff), e32e35a (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.
git-author:
Andrew Jackson <andrew.jackson@…> (10/06/16 12:35:24)
git-committer:
GitHub <noreply@…> (10/06/16 12:35:24)
Message:

Merge pull request #11 from SasView?/corfunc

Implement Correlation Function Perspective

Location:
src/sas/sasgui/guiframe
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • 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/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/aboutbox.py

    rd85c194 re0f28e6  
    106106        self.bitmap_button_nist = wx.BitmapButton(self, -1, wx.NullBitmap) 
    107107        self.bitmap_button_umd = wx.BitmapButton(self, -1, wx.NullBitmap) 
    108         self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap) 
     108        self.bitmap_button_ornl = wx.BitmapButton(self, -1, wx.NullBitmap) 
     109        #self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap) 
    109110        #self.bitmap_button_nsf = wx.BitmapButton(self, -1, 
    110111        #                                         wx.NullBitmap) 
     
    115116        self.bitmap_button_ess = wx.BitmapButton(self, -1, wx.NullBitmap) 
    116117        self.bitmap_button_ill = wx.BitmapButton(self, -1, wx.NullBitmap) 
     118        self.bitmap_button_ansto = wx.BitmapButton(self, -1, wx.NullBitmap) 
    117119         
    118120        self.static_line_3 = wx.StaticLine(self, -1) 
     
    124126        self.Bind(wx.EVT_BUTTON, self.onNistLogo, self.bitmap_button_nist) 
    125127        self.Bind(wx.EVT_BUTTON, self.onUmdLogo, self.bitmap_button_umd) 
    126         self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns) 
     128        #self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns) 
     129        self.Bind(wx.EVT_BUTTON, self.onOrnlLogo, self.bitmap_button_ornl) 
    127130        #self.Bind(wx.EVT_BUTTON, self.onNsfLogo, self.bitmap_button_nsf) 
    128131        #self.Bind(wx.EVT_BUTTON, self.onDanseLogo, self.bitmap_button_danse) 
     
    131134        self.Bind(wx.EVT_BUTTON, self.onEssLogo, self.bitmap_button_ess) 
    132135        self.Bind(wx.EVT_BUTTON, self.onIllLogo, self.bitmap_button_ill) 
     136        self.Bind(wx.EVT_BUTTON, self.onAnstoLogo, self.bitmap_button_ansto) 
    133137        # end wxGlade 
    134138        # fill in acknowledgements 
     
    163167        self.bitmap_button_umd.SetBitmapLabel(logo) 
    164168 
    165          
     169        image = file_dir + "/images/ornl_logo.png" 
     170        if os.path.isfile(config._ornl_logo): 
     171            image = config._ornl_logo 
     172        logo = wx.Bitmap(image)         
     173        self.bitmap_button_ornl.SetBitmapLabel(logo) 
     174 
     175        """ 
    166176        image = file_dir + "/images/sns_logo.png" 
    167177        if os.path.isfile(config._sns_logo): 
     
    170180        self.bitmap_button_sns.SetBitmapLabel(logo) 
    171181         
    172         """ 
    173182        image = file_dir + "/images/nsf_logo.png" 
    174183        if os.path.isfile(config._nsf_logo): 
     
    206215        logo = wx.Bitmap(image) 
    207216        self.bitmap_button_ill.SetBitmapLabel(logo) 
     217         
     218        image = file_dir + "/images/ansto_logo.png" 
     219        if os.path.isfile(config._ansto_logo): 
     220            image = config._ansto_logo 
     221        logo = wx.Bitmap(image) 
     222        self.bitmap_button_ansto.SetBitmapLabel(logo) 
    208223                 
    209224        # resize dialog window to fit version number nicely 
     
    227242        self.bitmap_button_nist.SetSize(self.bitmap_button_nist.GetBestSize()) 
    228243        self.bitmap_button_umd.SetSize(self.bitmap_button_umd.GetBestSize()) 
    229         self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize()) 
     244        self.bitmap_button_ornl.SetSize(self.bitmap_button_ornl.GetBestSize()) 
     245        #self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize()) 
    230246        #self.bitmap_button_nsf.SetSize(self.bitmap_button_nsf.GetBestSize()) 
    231247        #self.bitmap_button_danse.SetSize(self.bitmap_button_danse.GetBestSize()) 
     
    234250        self.bitmap_button_ess.SetSize(self.bitmap_button_ess.GetBestSize()) 
    235251        self.bitmap_button_ill.SetSize(self.bitmap_button_ill.GetBestSize()) 
     252        self.bitmap_button_ansto.SetSize(self.bitmap_button_ansto.GetBestSize()) 
    236253        # end wxGlade 
    237254 
     
    285302        sizer_logos.Add(self.bitmap_button_nist, 0,  
    286303                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    287         sizer_logos.Add(self.bitmap_button_sns, 0,  
     304        #sizer_logos.Add(self.bitmap_button_sns, 0,  
     305        #                wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     306        sizer_logos.Add(self.bitmap_button_ornl, 0,  
    288307                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    289308        sizer_logos.Add(self.bitmap_button_isis, 0,  
     
    292311                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    293312        sizer_logos.Add(self.bitmap_button_ill, 0,  
     313                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     314        sizer_logos.Add(self.bitmap_button_ansto, 0,  
    294315                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    295316                 
     
    321342        event.Skip() 
    322343         
     344    def onOrnlLogo(self, event):  
     345        """ 
     346        """ 
     347        # wxGlade: DialogAbout.<event_handler> 
     348        launchBrowser(config._ornl_url) 
     349        event.Skip() 
     350         
    323351    def onSnsLogo(self, event):  
    324352        """ 
     
    368396        # wxGlade: DialogAbout.<event_handler> 
    369397        launchBrowser(config._ill_url) 
     398        event.Skip() 
     399 
     400    def onAnstoLogo(self, event): 
     401        """ 
     402        """  
     403        # wxGlade: DialogAbout.<event_handler> 
     404        launchBrowser(config._ansto_url) 
    370405        event.Skip() 
    371406 
  • src/sas/sasgui/guiframe/acknowledgebox.py

    rd85c194 rc1fdf84  
    6868        self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) 
    6969        self.SetTitle("Acknowledging SasView") 
    70         self.SetSize((525, 225)) 
     70        #Increased size of box from (525, 225), SMK, 04/10/16 
     71        self.SetSize((600, 300)) 
    7172        # end wxGlade 
    7273 
  • src/sas/sasgui/guiframe/gui_manager.py

    rc8a641e8 r3fac0df  
    13451345        self._help_menu.Append(wx_id, '&Documentation', '') 
    13461346        wx.EVT_MENU(self, wx_id, self._onSphinxDocs) 
     1347        self._help_menu.AppendSeparator() 
    13471348 
    13481349        if config._do_tutorial and (IS_WIN or sys.platform == 'darwin'): 
    1349             self._help_menu.AppendSeparator() 
    13501350            wx_id = wx.NewId() 
    13511351            self._help_menu.Append(wx_id, '&Tutorial', 'Software tutorial') 
    13521352            wx.EVT_MENU(self, wx_id, self._onTutorial) 
     1353            self._help_menu.AppendSeparator() 
     1354 
    13531355 
    13541356        if config._do_acknowledge: 
    1355             self._help_menu.AppendSeparator() 
    13561357            wx_id = wx.NewId() 
    13571358            self._help_menu.Append(wx_id, '&Acknowledge', 'Acknowledging SasView') 
    13581359            wx.EVT_MENU(self, wx_id, self._onAcknowledge) 
     1360            self._help_menu.AppendSeparator() 
     1361 
    13591362 
    13601363        if config._do_aboutbox: 
     1364            logging.info("Doing help menu") 
     1365            wx_id = wx.NewId() 
     1366            self._help_menu.Append(wx_id, '&About', 'Software information') 
     1367            wx.EVT_MENU(self, wx_id, self._onAbout) 
    13611368            self._help_menu.AppendSeparator() 
    1362             self._help_menu.Append(wx.ID_ABOUT, '&About', 'Software information') 
    1363             wx.EVT_MENU(self, wx.ID_ABOUT, self._onAbout) 
     1369 
    13641370 
    13651371        # Checking for updates 
  • 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/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/guiframe/media/graph_help.rst

    re68c9bf rf9b0c81  
    4242plot window. 
    4343 
    44 *NOTE! If a residuals graph (when fitting data) is hidden, it will not show up 
    45 after computation.* 
     44.. note::  
     45    *If a residuals graph (when fitting data) is hidden, it will not show up 
     46    after computation.* 
    4647 
    4748Dragging a plot 
     
    6768After zooming in on a a region, the *left arrow* or *right arrow* buttons on 
    6869the toolbar will switch between recent views. 
     70 
     71The axis range can also be specified manually.  To do so go to the *Graph Menu* 
     72(see Invoking_the_graph_menu_ for further details), choose the *Set Graph Range* 
     73option and enter the limits in the pop box. 
    6974 
    7075*NOTE! If a wheel mouse is available scrolling the wheel will zoom in/out 
     
    116121^^^^^^^^^^^^^^^^^^^ 
    117122 
    118 From the *Graph Menu* (see Invoking_the_graph_menu_) it is also possible to 
    119 make some custom modifications to plots, including: 
     123It is possible to make custom modifications to plots including: 
    120124 
    121125*  changing the plot window title 
    122 *  changing the axis legend locations 
    123 *  changing the axis legend label text 
    124 *  changing the axis legend label units 
    125 *  changing the axis legend label font & font colour 
     126*  changing the default legend location and toggling it on/off 
     127*  changing the axis label text 
     128*  changing the axis label units 
     129*  changing the axis label font & font colour 
    126130*  adding/removing a text string 
    127131*  adding a grid overlay 
     132 
     133The legend and text strings can be drag and dropped around the plot 
     134 
     135These options are accessed through the *Graph Menu* (see Invoking_the_graph_menu_) 
     136and selecting *Modify Graph Appearance* (for axis labels, grid overlay and 
     137legend position) or *Add Text* to add textual annotations, selecting font, color, 
     138style and size. *Remove Text* will remove the last annotation added. To change 
     139the legend. *Window Title* allows a custom title to be entered instead of Graph 
     140x.  
    128141 
    129142Changing scales 
     
    234247selected data will be removed from the plot. 
    235248 
    236 *NOTE! This action cannot be undone.* 
     249.. note:: 
     250    The Remove data set action cannot be undone. 
    237251 
    238252Show-Hide error bars 
     
    248262In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Modify Plot 
    249263Property* to change the size, color, or shape of the displayed marker for the 
    250 chosen dataset, or to change the dataset label that appears on the plot. 
     264chosen dataset, or to change the dataset label that appears in the plot legend 
     265box. 
    251266 
    252267.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    292307average. 
    293308 
    294 *NOTE! The displayed average only updates when input focus is moved back to 
    295 that window; ie, when the mouse pointer is moved onto that plot.* 
     309.. note:: 
     310    The displayed average only updates when input focus is moved back to 
     311    that window; ie, when the mouse pointer is moved onto that plot. 
    296312 
    297313Selecting *Box Sum* automatically brings up the 'Slicer Parameters' dialog in 
     
    359375.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    360376 
    361 .. note::  This help document was last changed by Steve King, 01May2015 
     377.. note::  This help document was last modified by Paul Butler, 05 September, 2016 
  • src/sas/sasgui/guiframe/utils.py

    rd85c194 ra0373d5  
    4646    return flag 
    4747 
    48      
     48 
     49def check_int(item): 
     50    """ 
     51    :param item: txtcrtl containing a value 
     52    """ 
     53    flag = True 
     54    try: 
     55        mini = int(item.GetValue()) 
     56        item.SetBackgroundColour(wx.WHITE) 
     57        item.Refresh() 
     58    except: 
     59        flag = False 
     60        item.SetBackgroundColour("pink") 
     61        item.Refresh() 
     62    return flag 
     63 
     64 
    4965class PanelMenu(wx.Menu): 
    5066    """ 
Note: See TracChangeset for help on using the changeset viewer.