コード例 #1
0
 def EveryNCallback_py(taskHandle, everyNsamplesEventType, nSamples, 
                       callbackData_ptr):
     """Function called every N samples"""
     callbackdata = daqmx.get_callbackdata_from_id(callbackData_ptr)
     data, npoints = daqmx.ReadAnalogF64(taskHandle, self.nsamps, 
             10.0, daqmx.Val_GroupByChannel, self.nsamps, 
             len(self.analogchans))
     callbackdata.extend(data.tolist())
     self.data["torque_trans"] = np.append(self.data["torque_trans"], 
                                           data[:,0], axis=0)
     self.data["torque_arm"] = np.append(self.data["torque_arm"], 
                                         data[:,1], axis=0)
     self.data["drag_left"] = np.append(self.data["drag_left"], 
                                         data[:,2], axis=0)
     self.data["drag_right"] = np.append(self.data["drag_right"], 
                                         data[:,3], axis=0)
     self.data["time"] = np.arange(len(self.data["torque_trans"]), 
                                dtype=float)/self.sr                                                
     carpos, cpoints = daqmx.ReadCounterF64(self.carpostask,
                                            self.nsamps, 10.0,
                                            self.nsamps)
     self.data["carriage_pos"] = np.append(self.data["carriage_pos"],
                                           carpos)  
     turbang, cpoints = daqmx.ReadCounterF64(self.turbangtask,
                                             self.nsamps, 10.0,
                                             self.nsamps)
     self.data["turbine_angle"] = np.append(self.data["turbine_angle"],
                                            turbang)
     self.data["turbine_rpm"] \
         = ts.smooth(fdiff.second_order_diff(self.data["turbine_angle"], 
                                   self.data["time"])/6.0, 8)
     return 0 # The function should return an integer
コード例 #2
0
ファイル: makewaves.py プロジェクト: capnmatt41/MakeWaves
 def EveryNCallback_py(taskHandle, everyNsamplesEventType, nSamples, 
                       callbackData_ptr):
                           
     callbackdata = daqmx.get_callbackdata_from_id(callbackData_ptr)
     
     data, npoints = daqmx.ReadAnalogF64(taskHandle, buffsize/20, 10.0, 
                                         daqmx.Val_GroupByChannel, buffsize/20, 1)
                        
     callbackdata.extend(data.tolist())
     self.npdata = np.append(self.npdata, data)
     return 0 # The function should return an integer
コード例 #3
0
ファイル: synch_ai_ao.py プロジェクト: Raveeeen/daqmx
def EveryNCallback_py(taskHandle, everyNsamplesEventType, nSamples, 
                      callbackData_ptr):
                          
    callbackdata = daqmx.get_callbackdata_from_id(callbackData_ptr)
    
    data, npoints = daqmx.ReadAnalogF64(taskHandle, buffsize, 10.0, 
                                        daqmx.Val_GroupByChannel, buffsize, 1)
                       
    callbackdata.extend(data.tolist())
    print "Acquired %d samples"%len(data)
    saved_data = np.load(filename)
    new_saved_data = np.append(saved_data, np.asarray(data))
    np.save(filename, new_saved_data)
    return 0 # The function should return an integer
コード例 #4
0
def EveryNCallback_py(taskHandle, everyNsamplesEventType, nSamples,
                      callbackData_ptr):

    callbackdata = daqmx.get_callbackdata_from_id(callbackData_ptr)

    data, npoints = daqmx.ReadAnalogF64(taskHandle, buffsize, 10.0,
                                        daqmx.Val_GroupByChannel, buffsize, 1)

    callbackdata.extend(data.tolist())
    print "Acquired %d samples" % len(data)
    saved_data = np.load(filename)
    new_saved_data = np.append(saved_data, np.asarray(data))
    np.save(filename, new_saved_data)
    return 0  # The function should return an integer
コード例 #5
0
ファイル: tests.py プロジェクト: whmrtm/daqmx
 def EveryNCallback_py(taskHandle, everyNsamplesEventType, nSamples,
                       callbackData_ptr):
     """Function called every N samples"""
     callbackdata = daqmx.get_callbackdata_from_id(callbackData_ptr)
     data, npoints = daqmx.ReadAnalogF64(taskHandle, self.nsamps, 10.0,
                                         daqmx.Val_GroupByChannel,
                                         self.nsamps,
                                         len(self.analogchans))
     callbackdata.extend(data.tolist())
     self.data["torque_trans"] = np.append(self.data["torque_trans"],
                                           data[:, 0],
                                           axis=0)
     self.data["torque_arm"] = np.append(self.data["torque_arm"],
                                         data[:, 1],
                                         axis=0)
     self.data["drag_left"] = np.append(self.data["drag_left"],
                                        data[:, 2],
                                        axis=0)
     self.data["drag_right"] = np.append(self.data["drag_right"],
                                         data[:, 3],
                                         axis=0)
     self.data["t"] = np.arange(len(self.data["torque_trans"]),
                                dtype=float) / self.sr
     carpos, cpoints = daqmx.ReadCounterF64(self.carpostask,
                                            self.nsamps, 10.0,
                                            self.nsamps)
     self.data["carriage_pos"] = np.append(self.data["carriage_pos"],
                                           carpos)
     turbang, cpoints = daqmx.ReadCounterF64(self.turbangtask,
                                             self.nsamps, 10.0,
                                             self.nsamps)
     self.data["turbine_angle"] = np.append(self.data["turbine_angle"],
                                            turbang)
     self.data["turbine_rpm"] \
         = ts.smooth(fdiff.second_order_diff(self.data["turbine_angle"],
                                   self.data["t"])/6.0, 50)
     return 0  # The function should return an integer