Closed john-judge closed 3 years ago
NI_pt
pointer. saveNI_data
in SM_take_tb-Chun.cpp -- excerpt:
for (m = 0; m < num_frames*BNC_ratio; m++) {
*NI_dpt++ = *NI_spt;
NI_spt += numBNC_chan;
}
where NI_dpt
appears to be the destination pointer and NI_spt
appears to be the source pointer. It appears that the NI data is indeed interleaved, but in a very simple way.
Frame and Trace viewers connected. Next: stimulation settings, and use this to test whether NI-DAQmx is working properly
Finished connected GUI for TTL Output config to hardware module. This should pass the num_bursts
, etc data on to the C++ Lib, which will use that in fillPDout
to populate the DO data. We should see a change in the analog input FP data as we vary these settings. That'll be evidence of whether NI-DAQmx is set up properly.
Successfully enabled NI-DAQmx: stimulation administered with configurable number of pulses and pulse-interval, and properly read back in via analog input.
Reply from Chun regarding sync'ing Little Dave via NI clock:
For BNC ratio = 1, we set the camera to trigger mode (@ TXC 1) and make DO0 (black cable, resting high, low to trigger) to go low (to zero) to trigger the camera. Blue cable has the camera’s clock, which triggers the NI input.
For BNC ratio > 1, again @ TXC 1, but we use NI clock (the output and input is supposed to be synched), and DO0 (50% duty cycle per camera frame) to trigger camera (low to trigger), and NI input uses the same clock, but you can go at multiple frame rate of the camera’s.
DO0 should be "Dev1/port0/line0"
From TurboSM:
if (NI_flag == 1) {
resting_v = 1;
trigger_v = 0;
}
else {
resting_v = 0;
trigger_v = 1;
}
for (i = 0; i < delay; ++i)
output_data[i] = resting_v + 2;
The "+2" is done because line1 is the LED shutter -- SM uses DIgital Write U32 instead of Write Lines.
if (BNC_ratio > 1) {
int m;
for (; i < output_sample / BNC_ratio; ++i) {
for (m = 0; m < BNC_ratio / 2; m++)
output_data[i*BNC_ratio + m] = trigger_v + 2;
for (; m < BNC_ratio; m++)
output_data[i*BNC_ratio + m] = resting_v + 2;
}
for (m = (output_sample / BNC_ratio)*BNC_ratio; m < output_sample; m++)
output_data[m] = trigger_v + 2;
output_data[output_sample - 1] = trigger_v + 2;
}
else {
for (; i < output_sample; ++i)
output_data[i] = trigger_v + 2;
}
Talked to Meyer:
DapChannel
class)To-do:
Mainly we want to avoid the overhead of starting/closing true parallelism -- 2.08 s for single image is high. Evidence that reassembly takes only < 0.5 % of time spent in DLL code during live feed (current state, which is too slow)
Use two sync flags (a numpy bool array) that is shared between the plotter Python thread and the acquisition thread that calls into the C++ DLL. This establishes a producer-consumer relationship:
continue_livefeed_in_background
will be moved to C++ in Controller::continueLiveFeed
Continuation of @https://github.com/john-judge/PhotoZ_upgrades/issues/21
7/26/21
Resolved errors by keeping sampling rate non-zero and finite, and resolving a name conflict for the DO buffer
outputs
Next: plot thefp_data
we are getting back and see if it's reasonable.