Show
Ignore:
Timestamp:
06/18/07 16:24:56 (7 years ago)
Author:
DrewCormier
Message:

standardizing method API's so that the user does not have to change code in AWG.py for basic use

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • experimental/AWG/trunk/AWG/AWG.py

    r4194 r4195  
    1919        self.parent = parent 
    2020 
    21     def get_signal(self, signal_type, file_name): 
     21    def get_signal(self, signal_index, file_name): 
    2222        #signal I want is hard-coded for now 
    23         self.signal_type = signal_type 
     23        self.signal_index = signal_index 
    2424        self.signal_len = 8192   #length of packet 
    2525        self.frequency = 5   #cycles per packet 
    26         rand_type = 'random' 
     26        self.rand_type = 'random' 
    2727        self.file_name = file_name 
    28         delimiter = ',' 
     28        self.delimiter = ',' 
    2929 
    3030        my_signal = sources.sources(self)    #instance of signals class 
    31  
    32         self.signal_type = self.signal_type.lower()  #makes comparison case insesitive 
    33         if self.signal_type == 'sine': 
    34             self.the_signal = my_signal.gen_sine(self.frequency, self.signal_len) 
    35         elif self.signal_type == 'cosine': 
    36             self.the_signal = my_signal.gen_cosine(self.frequency, self.signal_len) 
    37         elif self.signal_type == 'random': 
    38             self.the_signal = my_signal.gen_random_data(self.signal_len, rand_type) 
    39         elif self.signal_type == 'file': 
    40             self.the_signal = my_signal.read_file(self.file_name, delimiter)  
    41         elif self.signal_type == 'zeros': 
    42             self.the_signal = my_signal.gen_zeros(self.signal_len) 
    43         else: 
    44             print "signals other than sine,cosine, rand, zeros, and readfile are not supported yet in _get_signal" 
     31        self.the_signal = my_signal.gen_signal() 
    4532 
    4633        return self.the_signal               
     
    196183        self.q_file_name = self.qFileNameEditor.GetLineText(0) 
    197184        AWG_instance = AWG(self) 
    198         i_source_selected = self.iSourceChoice.GetStringSelection() 
    199         q_source_selected = self.qSourceChoice.GetStringSelection() 
     185        i_source_selected = self.iSourceChoice.GetSelection() 
     186        q_source_selected = self.qSourceChoice.GetSelection() 
    200187        self.I = AWG_instance.get_signal(i_source_selected, self.i_file_name) 
    201188        self.Q = AWG_instance.get_signal(q_source_selected, self.q_file_name)