Changeset ef16f59 in sasview for guiframe/data_loader.py


Ignore:
Timestamp:
Aug 9, 2010 11:38:42 AM (14 years ago)
Author:
Jae Cho <jhjcho@…>
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:
e683abb
Parents:
4da35bc
Message:

Now it saves and opens all states of fitv taps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    r4da35bc ref16f59  
    181181      
    182182    filename = os.path.basename(path) 
    183      
    184183    if not  output.__class__.__name__ == "list": 
    185184        ## Creating a Data2D with output 
     
    202201        ## name of the data allow to differentiate data when plotted 
    203202        name = parse_name(name=output.filename, expression="_") 
    204         #if not name in parent.indice_load_data.keys(): 
    205         #    parent.indice_load_data[name] = 0 
    206         #else: 
    207             ## create a copy of the loaded data 
    208         #    parent.indice_load_data[name] += 1 
    209         #    name = name +"[%i]"%parent.indice_load_data[name] 
    210203        
    211204        new_plot.name = name 
     
    233226                        #add this plot the an existing panel 
    234227                        new_plot.group_id = existing_panel.group_id 
     228        # plot data 
    235229        wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=title)) 
     230        # set state and plot computation if exists 
    236231        wx.PostEvent(parent,InvStateUpdateEvent()) 
    237232        wx.PostEvent(parent,FitStateUpdateEvent()) 
    238233    ## the output of the loader is a list , some xml files contain more than one data 
    239234    else: 
    240          
    241         i=1 
    242         for item in output: 
     235        i=0 
     236        for item in output:  
    243237            try: 
    244238                ## Creating a Data2D with output 
     
    261255         
    262256                    new_plot = Data1D(x=item.x,y=item.y,dx=dx,dy=item.dy) 
     257                    if dxl != None: 
     258                        new_plot.dxl = dxl 
     259                    if dxl != None: 
     260                        new_plot.dxw = dxw 
     261                 
     262                new_plot.copy_from_datainfo(item)     
     263                item.clone_without_data(clone=new_plot)     
     264                 
     265                name = parse_name(name=str(item.run[0]), expression="_") 
    263266                     
    264                     new_plot.dxl = dxl 
    265                     new_plot.dxw = dxw 
    266                      
    267                 item.clone_without_data(clone=new_plot)     
    268                 new_plot.copy_from_datainfo(item) 
    269                 name = parse_name(name=str(item.run[0]), expression="_") 
    270                 #if not name in parent.indice_load_data.keys(): 
    271                 #    parent.indice_load_data[name] = 0 
    272                 #else: 
    273                     ## create a copy of the loaded data 
    274                      
    275                     #TODO: this is a very annoying feature. We should make this 
    276                     # an option. Excel doesn't do this. Why should we? 
    277                     # What is the requirement for this feature, and are the 
    278                     # counter arguments stronger? Is this feature developed 
    279                     # to please at least 80% of the users or a special few? 
    280                     #parent.indice_load_data[name] += 1 
    281                     #name = name + "(copy %i)"%parent.indice_load_data[name] 
    282                      
     267                #TODO: this is a very annoying feature. We should make this 
     268                # an option. Excel doesn't do this. Why should we? 
     269                # What is the requirement for this feature, and are the 
     270                # counter arguments stronger? Is this feature developed 
     271                # to please at least 80% of the users or a special few?                     
    283272                new_plot.name = name 
    284273                new_plot.interactive = True 
     
    286275                new_plot.id = name 
    287276                new_plot.is_data = True 
    288              
     277                title = item.filename 
     278                 
    289279                if hasattr(item,"title"): 
    290280                    title = item.title.lstrip().rstrip() 
     
    301291                            #add this plot the an existing panel 
    302292                            new_plot.group_id = existing_panel.group_id 
     293                # plot data 
    303294                wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title))) 
     295 
     296                # set state and plot computation if exists 
    304297                wx.PostEvent(parent,InvStateUpdateEvent()) 
    305298                wx.PostEvent(parent,FitStateUpdateEvent()) 
    306                 i+=1 
    307299            except: 
    308                 pass 
     300                raise 
Note: See TracChangeset for help on using the changeset viewer.