Changeset 4197
 Timestamp:
 06/18/07 16:28:27 (8 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

experimental/AWG/trunk/AWG/sources.py
r4196 r4197 41 41 42 42 def gen_sine(self): 43 '''freq is frequency in cycles per packet. len is the length of the packet. type is the data type to return (e.g., "float", "short", "int")'''43 '''freq is frequency in cycles per packet. signal_len is the length of the packet. type is the data type to return (e.g., "float", "short", "int")''' 44 44 45 45 count = 0 46 46 sine = [] 47 while count < self.parent. len:48 sine.append(math.sin(self.parent.freq*2*math.pi*count/self.parent. len))47 while count < self.parent.signal_len: 48 sine.append(math.sin(self.parent.freq*2*math.pi*count/self.parent.signal_len)) 49 49 count = count + 1 50 50 … … 53 53 54 54 def gen_cosine(self): 55 '''freq is frequency in cycles per packet. len is the length of the packet. type is the data type to return (e.g., "float", "short", "int")'''55 '''freq is frequency in cycles per packet. signal_len is the length of the packet. type is the data type to return (e.g., "float", "short", "int")''' 56 56 57 57 count = 0 58 58 cosine = [] 59 while count < self.parent. len:60 cosine.append(math.cos(self.parent.freq*2*math.pi*count/self.parent. len))59 while count < self.parent.signal_len: 60 cosine.append(math.cos(self.parent.freq*2*math.pi*count/self.parent.signal_len)) 61 61 count = count + 1 62 62 … … 72 72 if tmp_rand_type == 'random': 73 73 count = 0 74 while count < self.parent. len:74 while count < self.parent.signal_len: 75 75 data.append(random.random()) 76 76 count = count + 1 77 77 elif tmp_rand_type == 'uniform': 78 78 count = 0 79 while count < self.parent. len:79 while count < self.parent.signal_len: 80 80 data.append(random.uniform()) 81 81 count = count + 1 … … 88 88 '''returns a list of zeros''' 89 89 data = [] 90 for n in range(self.parent. len):90 for n in range(self.parent.signal_len): 91 91 data.append(0) 92 92 return data