Changeset fb8d4050 in sasview for guiframe


Ignore:
Timestamp:
Oct 2, 2008 3:41:38 PM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
7d0c1a8
Parents:
cfbe9b5
Message:

Allow multiple data sets to be loaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    rc7bc3e7 rfb8d4050  
    6262def plot_data(parent, path, name="Loaded Data"): 
    6363    from sans.guicomm.events import NewPlotEvent, StatusEvent 
    64     from sans.guitools.plottables import Data1D, Theory1D 
    6564    from DataLoader.loader import  Loader 
    66     import numpy 
    6765    #Instantiate a loader  
    6866    L=Loader() 
     
    7573        return 
    7674         
     75    if type(output).__name__=='list': 
     76        for i in range(len(output)): 
     77            _plot_single_data(parent, output[i], path, name, str(i)) 
     78    else: 
     79        _plot_single_data(parent, output, path, name) 
     80         
     81def _plot_single_data(parent, output, path, name="Loaded Data", index=None): 
     82    """ 
     83        Plot a single data set 
     84        @param output: data set to plot 
     85    """ 
     86    from sans.guicomm.events import NewPlotEvent 
     87    from sans.guitools.plottables import Data1D, Theory1D 
     88     
    7789    if output.dy==None: 
    7890        new_plot = Theory1D(output.x, output.y) 
     
    8193         
    8294    filename = os.path.basename(path) 
     95    if index is not None: 
     96        filename += "(%s)" % index 
    8397         
    8498    new_plot.name = name 
     
    90104    new_plot.group_id = filename 
    91105         
    92     wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 
     106    title = filename 
     107    if len(output.title) > 0: 
     108        title = filename+'['+output.title+']' 
     109 
     110    wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=title)) 
Note: See TracChangeset for help on using the changeset viewer.