Changeset 81812d9 in sasview
- Timestamp:
- Nov 19, 2008 10:01:35 AM (16 years ago)
- 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:
- c4172272
- Parents:
- af4af5a
- Location:
- guiframe
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_loader.py
rce64735 r81812d9 1 1 import os, sys 2 2 import wx 3 from danse.common.plottools.plottables import Data1D, Theory1D, Data2D 3 from dataFitting import Data1D, Theory1D 4 from danse.common.plottools.plottables import Data2D 5 4 6 from DataLoader.loader import Loader 5 7 … … 67 69 import numpy 68 70 #Instantiate a loader 69 L =Loader()71 L = Loader() 70 72 71 73 #Recieves data 72 74 try: 73 75 output=L.load(path) 76 74 77 except: 75 78 wx.PostEvent(parent, StatusEvent(status="Problem loading file: %s" % sys.exc_value)) 76 79 return 77 if hasattr(output,'data'): 78 new_plot = Data2D(image=output.data,err_image=output.err_data, 79 xmin=output.xmin,xmax=output.xmax, 80 ymin=output.ymin,ymax=output.ymax) 81 new_plot.x_bins=output.x_bins 82 new_plot.y_bins=output.y_bins 83 #print "data_loader",output 80 filename = os.path.basename(path) 81 if not output.__class__.__name__=="list": 82 try: 83 dxl=output.dxl 84 dxw=output.dxw 85 except: 86 dxl=None 87 dxw=None 88 if hasattr(output,'data'): 89 new_plot = Data2D(image=output.data,err_image=output.err_data, 90 xmin=output.xmin,xmax=output.xmax, 91 ymin=output.ymin,ymax=output.ymax) 92 new_plot.x_bins=output.x_bins 93 new_plot.y_bins=output.y_bins 94 #print "data_loader",output 95 else: 96 if not hasattr(output,"dy"): 97 new_plot = Theory1D(output.x,output.y, dxl, dxw) 98 else: 99 new_plot = Data1D(x=output.x,y=output.y,dy=output.dy, dxl=dxl, dxw=dxw) 100 #print "dataloader",output[0],output[1] 101 102 new_plot.source=output.source 103 new_plot.name = filename 104 new_plot.interactive = True 105 new_plot.info= output 106 if hasattr(output, "dxl"): 107 new_plot.dxl = output.dxl 108 if hasattr(output, "dxw"): 109 new_plot.dxw = output.dxw 110 #print "loader output.detector",output.source 111 new_plot.detector =output.detector 112 113 # If the data file does not tell us what the axes are, just assume... 114 new_plot.xaxis(output._xaxis,output._xunit) 115 new_plot.yaxis(output._yaxis,output._yunit) 116 new_plot.group_id = filename 117 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 84 118 else: 85 if output.dy==None: 86 new_plot = Theory1D(output.x,output.y) 87 else: 88 new_plot = Data1D(x=output.x,y=output.y,dy=output.dy) 89 90 filename = os.path.basename(path) 91 new_plot.source=output.source 92 new_plot.name = filename 93 new_plot.interactive = True 94 #print "loader output.detector",output.source 95 new_plot.detector =output.detector 96 # If the data file does not tell us what the axes are, just assume... 97 new_plot.xaxis(output._xaxis,output._xunit) 98 new_plot.yaxis(output._yaxis,output._yunit) 99 #new_plot.xaxis("\\rm{Q}",'A^{-1}') 100 #new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 101 102 new_plot.group_id = filename 103 104 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 119 i="res" 120 for item in output: 121 try: 122 dxl=item.dxl 123 dxw=item.dxw 124 except: 125 dxl=None 126 dxw=None 127 if not hasattr(item,"dy"): 128 new_plot = Theory1D(item.x,item.y,dxl,dxw) 129 else: 130 new_plot = Data1D(x=item.x,y=item.y,dy=item.dy,dxl=dxl,dxw=dxw) 131 132 new_plot.source=item.source 133 new_plot.info=output 134 new_plot.name = filename+" "+ str(i) 135 new_plot.interactive = True 136 137 #print "loader output.detector",output.source 138 new_plot.detector =item.detector 139 # If the data file does not tell us what the axes are, just assume... 140 new_plot.xaxis(item._xaxis,item._xunit) 141 new_plot.yaxis(item._yaxis,item._yunit) 142 new_plot.group_id = filename 143 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 144 i="slit" 145 146
Note: See TracChangeset
for help on using the changeset viewer.