Real_Time_Place_Preference - KravitzLab/KreedLabWiki GitHub Wiki

To get started:

Experimental execution:

  • Run a 15 minute baseline period with no stimulation applied to either side
  • Run a 30 minute ON period with stimulation applied to a specific side (left, right, arbitrary choice but keep track of the stimulated side)
  • Save files, clean chamber for next mouse.

Script tutorial: image

image

  • We first apply a crop to fit the camera's tracking field of view to the dimensions of the arena. If we inspect the crop properties, we can see the dimensions of the cropped field in terms of pixels, the most important field here to check is the width, because we will use that information to determine when stimulation is triggered when the subject is at a specific point in the x/y space. Half of the width of the crop segments the arena symmetrically. image image image

  • Adjust the HsvThreshold node to achieve the desired segmentation of your subject for centroid tracking. You can also play with the camera exposure settings and white balance as well.

image image image

  • The LessThanOrEqual node is important in setting when stimulation happens. You can see here it is configured at the half point (in pixels) of the crop x-dimensions (width). LessThanOrEqual configures the stimulation to be activated when the centroid x position is on the left side. You can change this node to GreaterThanOrEqual to flip the stimulation contingency to the right. When wiring up the hardware for triggering your stimulation device through Bonsai, be sure to set the correct COM port and pin based on your hardware wiring.

Analysis: