Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

stream data processing


  • Please log in to reply
4 replies to this topic

#1 binolardo

binolardo
  • Members
  • 4 posts

Posted 05 June 2012 - 01:56 PM

I am using the UD driver to get stream data from 6 channel with this function: LabJackPython.eGetRaw(self.d.handle, LabJackPython.LJ_ioGET_STREAM_DATA, LabJackPython.LJ_chALL_CHANNELS, 100, [0]*8*6*100 the first 8 byte (AIN0) in the array are [0, 160, 106, 153, 76, 173, 149, 191] how do I convert those value to a voltage value? I have found the "toDouble" function but it does not return a value that I understand (-1080709811.4007168). the Raw value of d.getFeedback(u6.AIN(0)) is around 33419 thanks.

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 05 June 2012 - 04:14 PM

If you are streaming raw data, one sample is two bytes. The first byte is the LSB and the second is the MSB, so the first raw sample is byte[0] + (byte[1]<<8). You can pass the raw sample to the binaryToCalibratedAnalogVoltage method in the U6 class to convert the binary data to a voltage. Look at the u6allio.py for example usage. Also, look at the streamTest.py example as it shows how to stream with LabJackPython without UD driver calls.

https://github.com/l...master/Examples

#3 binolardo

binolardo
  • Members
  • 4 posts

Posted 05 June 2012 - 08:33 PM

I think I need the UD driver because I need the streamData() function to be not blocking.

as explained in this post: https://forums.labja...?showtopic=5435

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 06 June 2012 - 01:24 PM

You can stream and queue data in a different thread, and then collect data from the queue in your main thread in a non-blocking manner. Take a look at the streamTest-threading.py example. It reads data in a blocking manner, but that can be changed and it demonstrates data queuing in a different thread. If you decide to go the UD eGetRaw route still, let us know if you have further questions on converting the binary data to a voltage.

#5 binolardo

binolardo
  • Members
  • 4 posts

Posted 07 June 2012 - 06:56 AM

I have found a solution! if I pass a array of float instead of the array of integer, the driver return the value in volts so instead of : LabJackPython.eGetRaw(self.d.handle, LabJackPython.LJ_ioGET_STREAM_DATA, LabJackPython.LJ_chALL_CHANNELS, 100, [0]*8*6*100 I use this LabJackPython.eGetRaw(self.d.handle, LabJackPython.LJ_ioGET_STREAM_DATA, LabJackPython.LJ_chALL_CHANNELS, 100, [0.0]*6*100


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users