Herein is an expansion on processing LabJack data files 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 very inexpensive DAQ, called the LabJack, is used to record several signals and outputs its data in a form that needs a bit of processing to be utilized in the grand scheme of the DAQ Synchronization project. The data is output in .dat format (we want to play with .npy format), can be output as several files (done so for the consideration of computer memory), and can have headers at the top of each data file. We have written some Python code to remove the headers, accurately combine the files into one dataset, and output the data in the .npy format we so enjoy.
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:
- header_present = (bool) Use “True” if all .dat files have headers, or use “False” if there are no headers. If some do and some don’t, then you need to separate the files into header/non-header folders or manually remove the headers from the data.
- headerdata_split = (int) The row number where the header section ends and the actual data begins. If header_present = False, then you can disregard this variable.
- save_npy = (bool) If set to “True”, the code will output a Numpy (.npy) file to your chosen directory. You will need a .npy file to run the “extraction_barcodes.py” code.
- save_csv = (bool) If set to “True”, the code will output a CSV (.csv) file to your chosen directory. This is useful for visualizing your output or use with other data analysis tools that use .csv files.
- keep_header = (bool) Set to True if your .dat files have headers and you want to keep that header in the .csv file. Note that in order for the header to be attached to the data, you must have both “save_csv” and “header_present” set to True; the Numpy output file will not have the header either way, so keep that in mind.
- out_file_name = (str) The name you wish to give the output file(s). Note that the file will include the date and time when it was created attached to the end of the filename (YYYY-MM-DD-HH-MM-SS)
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.”