Changeset 89f3b66 in sasview for park_integration/Loader.py
- Timestamp:
- Oct 19, 2010 9:02:08 PM (14 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:
- 4ddb7a4
- Parents:
- 74b1770
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/Loader.py
raa36f96 r89f3b66 1 1 # class Loader to load any king of file 2 import wx 3 import string,numpy 2 #import wx 3 #import string 4 import numpy 4 5 class Load: 5 6 """ … … 7 8 """ 8 9 9 def _init_(self, x=None,y=None,dx=None,dy=None):10 def _init_(self, x=None, y=None, dx=None, dy=None): 10 11 # variable to store loaded values 11 12 self.x = x … … 15 16 self.filename = None 16 17 17 def set_filename(self, path=None):18 def set_filename(self, path=None): 18 19 """ 19 20 Store path into a variable.If the user doesn't give a path as a parameter a pop-up … … 25 26 self.filename = path 26 27 27 28 28 def get_filename(self): 29 29 """ return the file's path""" … … 33 33 """ Store the values loaded from file in local variables""" 34 34 if not self.filename == None: 35 input_f = open(self.filename, 'r')35 input_f = open(self.filename, 'r') 36 36 buff = input_f.read() 37 37 lines = buff.split('\n') 38 self.x =[]39 self.y =[]38 self.x = [] 39 self.y = [] 40 40 self.dx = [] 41 self.dy =[]41 self.dy = [] 42 42 for line in lines: 43 43 try: … … 64 64 def get_values(self): 65 65 """ Return x, y, dx, dy""" 66 return self.x, self.y,self.dx,self.dy66 return self.x, self.y, self.dx, self.dy 67 67 68 def load_data(self, data):68 def load_data(self, data): 69 69 """ Return plottable""" 70 70 #load data … … 72 72 data.y = self.y 73 73 data.dx = self.dx 74 data.dy = self.dy74 data.dy = self.dy 75 75 #Load its View class 76 76 #plottable.reset_view() … … 78 78 79 79 if __name__ == "__main__": 80 load = Load()80 load = Load() 81 81 load.set_filename("testdata_line.txt") 82 82 print load.get_filename()
Note: See TracChangeset
for help on using the changeset viewer.