| 11 | | #TODO: setupt __init__ in AWG Frame so that 'file' can be first |
| 12 | | return ['file','sine', 'cosine', 'random', 'zeros'] |
| | 13 | return self.available_sources |
| | 14 | |
| | 15 | |
| | 16 | def read_file(self, file_name, delimiter): |
| | 17 | |
| | 18 | try: |
| | 19 | my_file = open(file_name, 'r') |
| | 20 | except IOError: |
| | 21 | print "no file named " + file_name |
| | 22 | return [] #return an empty packet |
| | 23 | |
| | 24 | data_from_file = my_file.read() #read the file as a big string |
| | 25 | my_file.close() #done reading the file. process the string from now on |
| | 26 | |
| | 27 | data_from_file.strip('\n') #\n's will not be tollerated |
| | 28 | data_from_file.strip('[') #['s will not be tollerated |
| | 29 | data_from_file.strip(']') #]'s will not be tollerated |
| | 30 | |
| | 31 | data_from_file = data_from_file.split(delimiter) #break string into a list |
| | 32 | |
| | 33 | return data_from_file |
| | 34 | |
| 39 | | try: |
| 40 | | my_file = open(file_name, 'r') |
| 41 | | except IOError: |
| 42 | | print "no file named " + file_name |
| 43 | | return [] #return an empty packet |
| 44 | | |
| 45 | | data_from_file = my_file.read() #read the file as a big string |
| 46 | | my_file.close() #done reading the file. process the string from now on |
| 47 | | |
| 48 | | data_from_file.strip('\n') #\n's will not be tollerated |
| 49 | | data_from_file.strip('[') #['s will not be tollerated |
| 50 | | data_from_file.strip(']') #]'s will not be tollerated |
| 51 | | |
| 52 | | data_from_file = data_from_file.split(delimiter) #break string into a list |
| 53 | | |
| 54 | | return data_from_file |