This small repository contains code for preparing *.csv
files that describe a stimulus
sequence and can also insert the same information into
*.imagine
files.
One application is to interface with the Ultima 3000 autosampler (Thermo Fisher)
via its Chromeleon software.
The tutorial below was written with this usage in mind, but in reality it could be used
for any stimulus sequence that (1) consists of a number of randomized repeats of
a discrete set of stimuli, (2) stimulus delivery can be made to run off of *.csv
files, and
(3) encodes the timing of each presentation with a TTL pulse recorded by
Imagine's default stimulus analog input line.
If you've installed HolyLabRegistry,
you can install this package with pkg> add Autosampler
.
Open a spreadsheet program (LibreOffice Calc, Microsoft Excel, or other) and prepare a file that lists your stimuli and the slots into which these are placed. It should look something like this:
StimName | Position |
---|---|
chemical1_10uM | RA1 |
chemical1_01uM | RA2 |
Having a header (the first row with "StimName" and "Position") is required, although you can name your columns however you wish. In reality, you can have as many columns as needed to pass the required information to the stimulus delivery program, as long as column 1 corresponds to an "identity" label that you use in later code. Here the "Position" column describes to the autosampler where the particular named tube is located in the array of vials.
Save this file with some useful name, e.g., "Tim_20190327_coolexperiment.csv". The saved file must be in CSV format. Now you can close your spreadsheet program.
Launch Julia from the directory in which you've saved this file (or navigate to that directory), and do something like the following:
julia> using Autosampler
julia> stim_randomize("Tim_20190327_coolexperiment.csv", 4)
Headers found: ["StimName", "Position"]
14 stimuli found
where 4
means the number of trials (different presentations of each stimulus) you want to
deliver over the course of your experiment.
There are more options possible, see ?stim_randomize
for more information.
This will generate a file by default named "Tim_20190327_coolexperiment_sequence.csv"
.
By default, this will not include the column headers, although you can control this
with keywords (see CSV.jl).
Pay attention to the output ("Headers found:" and "14 stimuli found" above),
as it can help guard against common errors.
If desired you can open the *sequence.csv
file in a spreadsheet program and check it,
or look at it with the Linux command line tool cat
.
When satisfied, copy this file onto a USB stick and use standard procedures
(documented elsewhere) to load it onto the autosampler.
Make certain that any feedback timing generated by the stimulus delivery will be encoded by Imagine (via a TTL pulse), so that the timing can be extracted later.
Navigate to the directory in which you have your *.imagine
and *.cam
files.
It is convenient if this is the same directory in which you created
"Tim_20190327_coolexperiment_sequence.csv"
(or whatever the file was named).
Again launch Julia, and do something like this:
using Autosampler
update_imagine("Tim_20190327_tissue1.imagine", "Tim_20190327_coolexperiment_sequence.csv")
This may prompt you to enter a bit more information, if the .imagine
file doesn't encode
the um_per_pixel
(microns per pixel) sampling and if you didn't supply that info via
keywords (see ?update_imagine
).
Once you enter the required information, it will scan the corresponding *.ai
file
(e.g., "Tim_20190327_tissue1.ai"
) and try to extract stimulus timing.
If what it discovers is consistent with the *sequence.csv
file, then it will rename
the original *.imagine
file (here, "Tim_20190327_tissue1.imagine.orig"
)
and write a new one that incorporates the stimulus information.