Mako Camera Timeout Error During wait_for_capture

84 views
Skip to first unread message

Zhang Shukun

unread,
Feb 27, 2024, 10:25:41 PMFeb 27
to the labscript suite
Hi everyone,

I am using a Mako G-040B camera in my device, and controlled by NI 6254 card. I use the code from https://github.com/fretchen/synqs_devices, and the snap() function works fine in the Blacs. I try to take photos in the Labscript sequence, but it shows the warning first and then the timeout error:
User-uploaded image: image.png
User-uploaded image: image.png

I run the script and noticed that when the camera exposes, the GUI shows "Transitioning to manual" mode, so I click the Mako_trigger twice in the GUI, and the script successfully finishes with two images taken.

I wonder why my script does not work. Here is the connection table and the sequence:

Connection_table:
PrawnBlaster(
    name="prawnblaster_0",
    com_port="COM3",
    num_pseudoclocks=2,
)

NI_PXI_6254(
    name="ni_card_1",
    parent_device=prawnblaster_0.clocklines[0],
    clock_terminal="/PXI1Slot2/PFI0",
    MAX_name="PXI1Slot2",
    max_AO_sample_rate=400e3,
)
mako_attributes = {
    "AcquisitionMode": "MultiFrame",
    "ExposureMode": "TriggerWidth",
    "ExposureTimeAbs": 3000,
    "TriggerActivation": "LevelHigh",
    "TriggerMode": "On",
    "TriggerSelector": "FrameStart",
    "TriggerSource": "Line1",
}
Mako_Camera(name="Mako", parent_device=ni_card_1, connection="port0/line0", serial_number='DEV_000F315E2CC6', camera_attributes=mako_attributes)

DigitalOut(
    name='digital0', parent_device=ni_card_1, connection='port0/line0'
)
DigitalOut(
    name='digital1', parent_device=ni_card_1, connection='port0/line1'
)

Sequence:
start()
t += 0.01

Mako.expose(t, name='comparison', frametype='before', trigger_duration=2)
t += 0.5
digital0.go_high(t=t)
t += 0.5
digital0.go_low(t=t)
t += 1.5

Mako.expose(t, name='comparison', frametype='after', trigger_duration=2)
t += 0.5
digital0.go_high(t=t)
t += 0.5
digital0.go_low(t=t)
t += 1
t += 0.5
stop(t=t)

Thanks alot!

Zhang Shukun

unread,
Feb 27, 2024, 10:29:48 PMFeb 27
to the labscript suite
error1.PNGerror2.PNG
Two error images that does not uploaded

Chris Billington

unread,
Feb 28, 2024, 12:18:06 AMFeb 28
to labscri...@googlegroups.com
Hi Zhang,

When you instantiate the Mako camera with this line:

Mako_Camera(name="Mako", parent_device=ni_card_1, connection="port0/line0", serial_number='DEV_000F315E2CC6', camera_attributes=mako_attributes)

The "parent" and "connection" arguments are used to create a digital out object internally to represent the trigger. Then when you call:

Mako.expose(t, name='comparison', frametype='before', trigger_duration=2)

This commands a trigger pulse of length 2 seconds on that digital output.

So your creation of the digital output object:

DigitalOut(
    name='digital0', parent_device=ni_card_1, connection='port0/line0'
)

would seem to be in conflict, as it uses the same parent device and connection string. It looks like (unfortunately) neither labscript or the NI DAQmx class are currently set up to detect and raise an error when two child devices use the same connection string, which would have brought this problem to your attention.

Looking at the implementation of the NI DAQmx class, it looks like only the last to be instantiated child device will actually be used. So the 'digital0' DigitalOut object is being used, whereas the internally-created DigitalOut that would normally control the triggers is being ignored by the NI DAQmx code, and no pulses are being generated for it. Since your manually-created DigitalOut is only generating one pulse, the camera is not receiving the two triggers expected for the two exposures, hence the timeout.

If the two digital out objects are intended to provide triggers for the camera, they are unnecessary and can be deleted. As long as port0/line0, as specified in the arguments to the Mako_Camera, is connected to the camera's trigger input, the triggering will be handled automatically using your set trigger duration and polarity (which you haven't set but it's 'rising' by default, so that looks correct). And if those two digital out objects are intended for something else, then you'll need to choose port and line numbers that don't conflict with those used for the camera trigger.

Hope that helps,

Chris


--
You received this message because you are subscribed to the Google Groups "the labscript suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to labscriptsuit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/labscriptsuite/69826e7b-5071-4a63-8e33-31c3f829408fn%40googlegroups.com.

Zhang Shukun

unread,
Feb 28, 2024, 2:43:18 AMFeb 28
to the labscript suite
Thanks a lot Chris!

I comment out the digital0 and run the program again. It shows the same error.  
Here is the connection table and sequence now:
# connection table:
def ConnectionTable():

PrawnBlaster(
name="prawnblaster_0",
com_port="COM3",
num_pseudoclocks=2,
)

NI_PXI_6254(
name="ni_card_1",
parent_device=prawnblaster_0.clocklines[0],
clock_terminal="/PXI1Slot2/PFI0",
MAX_name="PXI1Slot2",
max_AO_sample_rate=400e3,
)
mako_attributes = {
"AcquisitionMode": "MultiFrame",
"ExposureMode": "TriggerWidth",
"ExposureTimeAbs": 3000,
"TriggerActivation": "LevelHigh",
"TriggerMode": "On",
"TriggerSelector": "FrameStart",
"TriggerSource": "Line1",
}
Mako_Camera(name="Mako", parent_device=ni_card_1, connection="port0/line0", serial_number='DEV_000F315E2CC6', camera_attributes=mako_attributes)

DigitalOut(
name='digital1', parent_device=ni_card_1, connection='port0/line1'
)

# Sequence
start()
t += 0.01
Mako.expose(t, name='comparison'frametype='before'trigger_duration=2)
t += 3

Mako.expose(t, name='comparison'frametype='after'trigger_duration=2)
t += 3
stop(t=t)

Chris Billington

unread,
Feb 28, 2024, 2:54:07 AMFeb 28
to labscri...@googlegroups.com
Hi Zhang,

Ah, in that case, I don't know what the problem is. 

You'll want to verify with an oscilloscope that the pulses are in fact being generated when they are supposed to be, and if they are then it suggests the problem is elsewhere, possibly with configuration. Whilst your configuration settings look sensible at a glance, I'm not familiar with that camera or the device class, so can't be sure.

-Chris



Zhang Shukun

unread,
Feb 28, 2024, 2:56:20 AMFeb 28
to the labscript suite
I connect the BNC cable to oscilloscope and the voltage goes high, and reconnect it to the camera after verify the connection is good.

One interesting thing is that I set the  trigger_edge_type="falling"
and restart the experiment. The Mako_trigger button in the Blacs GUI shows high and then transition into manual. I clicked the button again and it take the photo and works fine.

Is there any lag between the camera and the signal? (high voltage sent before the camera is ready to receive)

On Wednesday, February 28, 2024 at 1:18:06 PM UTC+8 chrisjbi...@gmail.com wrote:

Zhang Shukun

unread,
Feb 29, 2024, 12:50:24 AMFeb 29
to the labscript suite
Problem Solved!

I change the camera configuration to :
mako_attributes = {
"AcquisitionMode": "Continuous",

"ExposureMode": "TriggerWidth",
"ExposureTimeAbs": 3000,
"TriggerActivation": "RisingEdge",

"TriggerMode": "On",
"TriggerSelector": "FrameStart",
"TriggerSource": "Line1",
}
and it works!

Reply all
Reply to author
Forward
0 new messages