Hi Alex,
Indeed, this functionality doesn't currently exist. The use of counters for wait monitors is fairly specific to wait monitors, and not on top of any more general labscript counter functionality. To implement counters for other purposes "properly" in labscript, changes in several places would be needed, including (I think):
* Modify labscript/inputs.py to add a CounterInput class similar to AnalogInput
* Modify labscript_devices/NI_DAQmx/models/get_capabilities.py to introspect counter capabilities - right now it counts how many counter inputs there are, it's possible this is sufficient information for basic counter usage, but I'm not sure. If more info is needed, then after adding introspection for it to the script, one would then need to run the script on a system with simulated devices of all supported models added in NI MAX to introspect their capabilities and save to the capabilities.json file. One would then need to re-run labscript_devices/NI_DAQmx/models/generate_subclasses.py to regenerate all the subclasses for the specific models, that pass set these capabilities as keyword arguments.
* Modify labscript_devices/NI_DAQmx/labscript_devices.py to allow CounterInput child devices, and to write their acquisition details to a table in the HDF5 file during compilation, similar to how analog acquisition details are currently saved. If additional capabilities were added to capabilities.json via get_capabilities.py, then arguments for the additional capabilities would need to be added as instantiation arguments to the NI_DAQmx labscript device class (the generated subclasses automatically pass in anything in the capabilities dict as instantiation arguments).
* Modify labscript_devices/NI_DAQmx/blacs_workers.py to read this table and configure counter inputs using the NI DAQmx API during transition_to_buffered, and to save the results to the HDF5 file during transition_to_manual. This would likely require defining an additional worker class for the acquisition, similar to how the NI_DAQmxAcquisitionWorker class acquires analog input data in a separate worker process.
* Modify labscript_devices/NI_DAQmx/blacs_tabs.py to create the new worker, similar to how it currently does for the analog acquisition worker.
* Presumably add some methods to lyse.Run() to extract these acquisition traces
So pretty involved!
An alternative hack if you just want it working for yourself is to set up the counter acquisition as an entirely separate program that configures the acquisition and for it to start on a trigger or whatnot, as you would using the NI DAQmx API if you were not using labscript at all. Then just use labscript to deliver the trigger at the desired time with a Trigger object. You might then use a labscript FunctionRunner object to read the acquired data from that other program (over a socket, over zmq, or even reading from a file on disk written by the acquisition program) and save it to the HDF5 file at the end of a shot.
Regards,
Chris