Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Absolute timestamps
#1
Hey all,

I'm recording video from a set of webcams through Matlab which gives me absolute timestamps for each frame that I am now trying to synchronize against Bpod. The TrialStartTimeStamp property is in seconds and relative to the onset of the SessionStart property which is an absolute timestamp in the Bpod object. By combining those two I could therefore get to absolute timestamps for Bpod events but I'm wondering whether it would be possible to get absolute timestamps for the onset of individual trials instead.

The main reason why this would be better is that over the course of the session the system time and Bpod time may drift apart which is pretty hard to control for. I can also record IR LEDs as indicators for different Bpod states but synchronizing the cameras and behavior this way is not very precise. If anyone has a better idea on the setup, I would love to hear it !


Best,
Simon
Reply
#2
Hi Simon

By "Absolute timestamps", I'm assuming you mean timestamps recorded by the operating system clock (not the Bpod clock).

With a non real-time operating system, this is a tricky issue. Your best bet, if you need this level of precision, is to use a camera that has TTL signaling capabilities, like Point Grey. In theory, Bpod can manually trigger frames from its 3.3V wire terminals, or ongoing frames can be timestamped by the Bpod clock as Wire1High/Wire1Low events if the camera's strobe output is fed to one of the wire terminal inputs (also see this).

If an IR LED is driven by Bpod, the frame that captures the IR flash should precisely match the Bpod timestamp of the flash. You can actually use this method to measure clock drift, jitter and latency between the two systems, by comparing the OS frame timestamps with the LED flash timestamps.

-Josh
Reply
#3
(04-26-2017, 03:37 PM)Josh Wrote: Hi Simon

By "Absolute timestamps", I'm assuming you mean timestamps recorded by the operating system clock (not the Bpod clock).

With a non real-time operating system, this is a tricky issue. Your best bet, if you need this level of precision, is to use a camera that has TTL signaling capabilities, like Point Grey. In theory, Bpod can manually trigger frames from its 3.3V wire terminals, or ongoing frames can be timestamped by the Bpod clock as Wire1High/Wire1Low events if the camera's strobe output is fed to one of the wire terminal inputs (also see this).

If an IR LED is driven by Bpod, the frame that captures the IR flash should precisely match the Bpod timestamp of the flash. You can actually use this method to measure clock drift, jitter and latency between the two systems, by comparing the OS frame timestamps with the LED flash timestamps.

-Josh

Hi, Josh,

I think I have the same question and thanks for your answers. It seems that an IR LED is an easy solution. To be specific, we can just add one state in which the outputaction is 'wire1', and set the value to 1, and wire1 is connected to the IR LED?

Best,

Mu
Reply
#4
Hi Mu


Wire1 should be able to drive an IR LED - but remember to put a series resistor in the current path. This online tool can help you calculate the correct value, using the forward voltage and current in your IR emitter's datasheet. The wire terminal output line is 3.3V, and can supply up to 15mA. If you need more current to drive the emitter, consider a circuit using the wire output line to gate a port interface board's infrared emitter supply pin (5V, pin labeled '+') using an N-channel MOSFET.

-Josh
Reply
#5
(04-26-2017, 10:04 PM)Josh Wrote: Hi Mu


Wire1 should be able to drive an IR LED - but remember to put a series resistor in the current path. This online tool can help you calculate the correct value, using the forward voltage and current in your IR emitter's datasheet. The wire terminal output line is 3.3V, and can supply up to 15mA. If you need more current to drive the emitter, consider a circuit using the wire output line to gate a port interface board's infrared emitter supply pin (5V, pin labeled '+') using an N-channel MOSFET.

-Josh

Hi, Josh,

Thanks again! This is very helpful! Just to clarify, the value for Wire1 is actually voltage instead of the boolean level?

Best,

Mu
Reply
#6
The voltage that comes out of the Wire1 + terminal when the boolean level is high, is 3.3V. Low = 0V.

To set the boolean level high, use output action {'Wire1', 1} (if using the repository beta branch)
Reply
#7
(04-27-2017, 02:12 AM)Josh Wrote: The voltage that comes out of the Wire1 + terminal when the boolean level is high, is 3.3V. Low = 0V.

To set the boolean level high, use output action {'Wire1', 1} (if using the repository beta branch)

Got you! Thanks, Josh!
Reply


Forum Jump: