Herein is an expansion on extracting barcodes from Numpy-formatted data for the DAQ Synchronization project. This can be a standalone project or can be considered part of the overall DAQ Synchronization Project. With this part of the project, a DAQ is used to record a unique barcode signal coded in a TTL pulse train. This Python script can be used to take the sampled data and extract the unique barcode values and the start time of these barcodes (as an index value). This barcode data can subsequently be used to align this and other recorded signals on the same DAQ to other recordings with other systems using other steps of the DAQ Synchronization project.
All DAQ Synchronization project code (with example data!) can be found within this zip file. Simply download and extract. Or, if you want just the code for this part of the project, see here.
Most of the code need not be altered. However, we encourage users to take a look under the hood and learn some coding, email us here if you find issues (Note: We are sharing this code, which works for our needs, but comes with no guarantees. It probably has issues and definitely is sloppy), make your boss think you are a hacker by using this as a wallpaper, or update the code to fit your needs. The most important variables that a user could change are listed up at the top of the code. An explanation of them can be found below:
USER INPUTS EXPLAINED:
- raw_data_format = (bool) Set to “True” if the data being inputted has not been filtered to just event timestamps (like in LJ data); set to “False” if otherwise (like NP data from OpenEphys)
- signals_column = (int) The column where the sorted signal timestamps or the raw barcode data appears (base 0, 1st column = 0).
- expected_sample_rate = (int) The DAQ’s sample rate, in Hz, when this data was collected. For example, NP runs at 30000 Hz.
- global_tolerance = (float) The fraction (in %/100) of tolerance allowed for duration measurements (ex: ind_bar_duration).
- barcodes_name = (str) The name of the outputted file(s) that will be saved to your chosen directory.
- save_npy = (bool) Set to “True” if you want the output saved as a .npy file.
- save_csv = (bool) Set to “True” if you want the output saved as a .csv file.
(The user inputs below are based on your Arduino barcode generator settings)
- nbits = (int) the number of bits (bars) that are in each barcode (not including wrappers).
- inter_barcode_interval = (int) The duration of time (in milliseconds) between each barcode’s start.
- ind_wrap_duration = (int) The duration of time (in milliseconds) of the ON wrapper portion (default = 10 ms) in the barcodes.
- ind_bar_duration = (int) The duration of time (in milliseconds) of each bar (bit) in the barcode.
ONE Core acknowledgment
Please acknowledge the ONE Core facility in your publications. An appropriate wording would be:
“The Optogenetics and Neural Engineering (ONE) Core at the University of Colorado School of Medicine provided engineering support for this research. The ONE Core is part of the NeuroTechnology Center, funded in part by the School of Medicine and by the National Institute of Neurological Disorders and Stroke of the National Institutes of Health under award number P30NS048154.”