Evaluating Raw Fiber Photometry Data

Whenever you try out a new method or piece of equipment in the lab, you’re bound to have many questions. Perhaps one of the most important questions is a rather simple one: are these data that I’m collecting any good? Am I recording a decent signal, or is this noise that I can’t yet recognize in real time?

Sometimes it is hard to answer this question until you’ve progressed some part of the way through your analysis pipeline. Still, it’s never a good feeling to realize you’ve spent time processing data that could have been much nicer if you had tweaked some settings during the collection phase. Here, we’ve laid out some important considerations to give you a jump-start on the road to learning how to identify good photometry data in real time. If you are brand new to fiber photometry, we recommend checking out our resources to get familiar with the basic concept behind the method.

Getting Connected and Checking for Signal

When you first connect your animal to your fiber photometry system, you’ll want to check to see if you have any fluorescent signal. To check for signal, you should set your driver box to constant mode and turn on the LED corresponding to the color of fluorophore you are interested in recording from (470nm if imaging a green fluorescent indicator, 560nm if imaging a red fluorescent indicator).

A live depiction of your fluorescent trace is shown as a scrolling trace on a graph that updates in real time. The x-axis of the graph represents time, and the y-axis represents the relative fluorescence of your indicator. Remember that this raw signal trace is a representation of the bulk fluorescence captured by the camera. The measurement of this signal is based upon the mean pixel value recorded by the camera, or “F.” These are arbitrary units and will vary between subjects and recording sessions. Therefore, conclusions about the absolute strength of your indicator’s fluorescence cannot be drawn based solely on the numerical value reached on the y-axis of this live graph. To make accurate comparisons between recording sessions, experimental conditions, or other variables in your fiber photometry experiment, you’ll need to perform some post-hoc analysis. 

Even before the analysis phase, it is possible to make some assessment of the quality of your signal during the recording. For example, if you are recording from a mouse in an open field, you may be able to see signal changes that correlate with events such as rearing or reactions to external stimuli. You may also be able to evaluate the kinetic features of your trace in relation to the known kinetics of your indicator. As a general rule, the kinetics of the these bulk signals cannot exceed the kinetics of the indicator; if you’re recording with GCaMP6s, for example, and see a peak with a rise time of 50ms, this peak exceeds the kinetics of GCaMP6s and is therefore necessarily an artifact rather than true signal. Paying close attention to kinetics and correlations with the behavioral environment can impart some confidence that your signal is “real” and not merely the result of confounding variables, such as motion artifacts. 

Recognizing Motion Artifacts

Signals may fluctuate as a result of activity-independent variables, like motion. Such artificial variation can considerably undermine your data. There are some controls in place to mitigate motion artifacts (including the isosbestic signal, a concept we will be reviewing here at the FP Academy in the coming weeks), but you still want to be on the lookout for evidence of such a confound.

When recording in one of the trigger modes, motion artifacts often appear in live traces as steep parallel deflections; the top and bottom of the trace will move in the same direction (either upward or downward) simultaneously. This parallel motion is the result of both your calcium-dependent and calcium-independent signal fluctuating in sync with each other, which by definition means your signal is not activity dependent. 

You may also note kinetics that starkly contrast with the expected kinetics of your fluorophore. For example, you may record a signal with a sharp signal decrease followed by a slow increase; the opposite of established GCaMP kinetics. This is the result of an optical fiber that is exceeding its bend radius, which limits its ability to transmit light (both to and from the brain) and ultimately attenuates your signal.

If you suspect that you are recording some motion artifacts, a good place to start troubleshooting is to practice good patch cord management. The most common cause of motion artifacts is not a result of the brain moving relative to the implant, but rather the patch cord bending. Smooth out any sharp angles or kinks in the patch cord, and let it drape or hang in a way that bends as little as possible. Take care to use a patch cord that is just the right length for your setup — not so short that it impedes the animal’s movement, but not so long that it gets tangled up. If you’re following good patch cord management practices, it goes a long way towards mitigating motion artifacts. Even if you think your signal looks great, take care to practice good patch cord management; no amount of isosbestic control will compensate for a poorly managed patch cord.

Evaluating SNR

One of the nice things about photometry data is that it generally has a high signal-to-noise ratio (SNR) which is interpretable before you process the data. A quick way to evaluate the SNR is to look at the “smoothness” of your live trace on the auto-scaled graph. A clear and crisp trace that appears as a single line likely has good SNR. 

If you’re looking at a very rough (“noisy”) trace, the SNR may be relatively poor. You are probably looking at the read noise of your camera — the same thing you would see if the camera was recording but all of the LEDs were off. This “roughness” takes the form of fluctuations that are usually less than one pixel. If the trace is “smooth,” the auto-scaling is probably hiding this read noise.

Understanding Live Traces in Trigger Modes

While most people use constant mode when checking for signal, your actual experimental recordings will typically utilize one of the trigger modes. These trigger modes will have unique patterns of LED on/off cycles, and it is important to know which LEDs are on at any given time when interpreting your signal. Refer to the user manual to familiarize yourself with the different trigger mode LED patterns prior to recording.

When you first turn your driver box on, one thing will always be true: the 470nm LED will be first in the sequence and therefore be your starting point. Since the recorded signal is an interleaved combination of up to three unique signals, the primary raw data trace will take on a zig-zag pattern as the LEDs alternate. By incorporating a slice node into your Bonsai workflow, you can separate the live traces so that you are visualizing each real-time signal on its own.

This guide is intended to serve as a primer for understanding raw fiber photometry data; the best way to have a comprehensive understanding of what to look for while you’re recording is to practice! The Neurophotometrics team is always available to help you evaluate the quality of your raw signal traces and understand the components of the trace more clearly — just use our contact form to get in touch. 

This post was written by Caroline Sferrazza and Gemma Deegan.

Aligning the FP3001

After you have set up your system, you will need to align it to your patch cord.  Your system was aligned in our shop, but all patch cords have different tolerances. Therefore, your system may need to be adjusted to focus on your specific patch cord. We also recommend that you check your alignment prior to each new day of recording, as it may need adjustment from time to time.

Begin the alignment by inserting your patch cord into the system. Be sure that it is fully connected via the FC connector; it should not twist or jiggle.  Once connected, turn the system on and set all LEDs to 100% power.

Open flycapture and click on “Configure Selected”.  Turn “Gain” all the way up and then press ok. This gain adjustment will help you better visualize your cores. 

When looking at FlyCapture, you should see a mirror image of the cores on your screen.  For example, if you have a 2 branch patch cord, you will see a total of 4 cores mirrored over the midline. The green channel is on the right, and the red channel is on the left.

Tap on the tip of the patch cord to saturate the signal.  This will help you better see the current alignment of the cores.  They should be crisp, concentric circles with minimum flare. 

Example of flare that indicates poor alignment.

The FP3001 has a 5-axis translator that can be used to adjust the alignment of your system if needed. There are five knobs on the translator, but only three should be used during the alignment; these three knobs are larger and have white writing on them.

We strongly recommend that you avoid turning the two smaller knobs on the 5-axis translator. These were lined up with the objective lens prior to shipment and very rarely need to be adjusted. They are also very sensitive; a little turn can go a long way towards throwing off your alignment!

To adjust the alignment, slightly turn these three knobs, adjusting one at a time while tapping on the tip of the patch cord until the image comes into focus.  Once the cores are in focus, lower the gain halfway to visualize the flare.  The cores should not bleed into each other; we want them to be independent in order to not confound your data.

Once your system is aligned, remember to turn the gain back down to <10 before recording. You’re now ready to go!

Example of good alignment — ready to go!

This post was written by Savanna Howard.

Patch Cord Purchasing Guidelines

Prior to conducting your first fiber photometry experiment, you are going to need a patch cord. While Neurophotometrics does not currently manufacture patch cords, we are happy to provide guidance so that your selection is the most compatible with your fiber photometry system and experimental setup.

The most important thing when choosing a patch cord is ensuring you have the correct numerical aperture (NA).  Neurophotometrics systems come with an objective that has a 0.37 NA. To maximize your signal, the patch cord (and fiber optic cannulae) should match this NA. Matching the NA will ensure that there is no light loss from the excitation or emission side. Having mismatched NAs at any of these points will cause significant light loss, giving you less than optimal signal — or none at all!

Next, you must choose the ferrule and core diameters of the patch cord. These can vary between experiments, but must match specifications of the fiber optic cannula(e) that you will implant into the animal.  Common ferrule diameters are 1.25mm and 2.5mm.  Common core diameters are 200um and 400um.  The most popular combination is 1.25mm ferrule diameter with a 200um core diameter.  You can pick any combination to fit your experiment — just be sure that the patch cord matches the fibers.

Another consideration for your patch cord is the connection to the system. The Neurophotometrics fiber photometry system comes with an FCM connector, so we suggest purchasing a patch cord that also has an FCM connector. However, if you prefer to use an SMA connector and patch cord, this is an easy swap.  Just let us know and we can provide an adaptor for you.

The patch cord also must connect to the animal subject, of course, so you will need to specify this type of connection as well. This connection type should be MF, followed by the size of your ferrule. For example, if you are using fiber optic cannulae with 1.25mm ferrules, the connection would be “MF1.25.”

Patch cords come in a variety of lengths. We recommend a length of 2-3 meters. This will make multiplexing the system and managing the patch cord easier.  The longer the patch cord, the more resistant it will be to twisting (i.e. it can absorb a higher number of twists before the signal starts to attenuate). However, a longer patch cord will also lower your efficiency, as you will lose signal as a function of distance.

Patch cords can also have several branches. The number of branches you choose is completely up to you and dependent on your experimental needs.  How many animals and/or brain regions you wish to record from at once will influence this choice.  We recommend starting with at least two branches, even if you are only recording from one brain region to start.  You can simply cover up one the unused core with tape during the experiment.

Once you’ve determined what kind of patch cord you need, we recommend buying that patch cord from Doric Lenses.  Please note, however, that they can have quite long lead times; you’ll want to place your order at least 6 weeks before you plan to do any experiments.

Example order for a 2-branch patch cord, 3m long, 1.25mm ferrule diameter, 200um core, 0.37 NA.

Here at Neurophotometrics, we use the Branching Fiber-optic Bundle Design patch cords (1.25mm/200um/0.37NA).  On the left you can see an example of how to specify what qualities you want in your patch cord when ordering from Doric. In this example, I have chosen a 2 branch, 3 meter long patch cord.

Some labs that are just beginning to do fiber photometry might already have patch cords. A common question we receive is whether or not these pre-existing patch cords will work for fiber photometry experiments, even if the NA, ferrule size, and/or core diameter don’t perfectly match their new system or fiber optic implants.  We highly recommend that you purchase a patch cord that will perfectly match up with the system. There will be a significant amount of emission loss when these qualities are mis-matched, resulting in a diminished signal.  Patch cords with higher or lower NAs can be used for testing and getting comfortable with recording, but ideally would not be used for experiments.  It is always a good idea to double check the specs of your patch cord before recording, especially if you have multiple patch cords.

Example order for a pigtail commutator.

If you are performing experiments that require long recording periods, it is tempting to purchase a rotary joint or commutator as well.  However, most rotary joints that are used for optogenetics are not optimized for fiber photometry.  They can cause a loss of light at the connection point of the rotary joint and patch cord.  Additionally, it is not currently possible to record from multiple regions while using a rotary joint due to their rotating nature.  It would be impossible to keep the correct orientation of multiple cores, resulting in confounded data.  We advise that you start recording without one, and add one only if necessary.  If you decide that you need a rotary joint, Doric makes a pigtail commutator that is compatible with fiber photometry.  These are very expensive (around $850), and make it impossible to record from multiple brain regions.

This second example order is for a pigtail commutator.  It will also need to have an NA of 0.37 and match the ferrule and core diameters of your fibers.

This post was written by Savanna Howard.

How to Cleave Fibers

After deciding on an experimental paradigm, you will need to cleave your fibers to reach your brain region(s) of interest.  It is vital that the fiber is cleaved properly, as fiber photometry employs very low levels of light. Proper fiber cleaving ensures the maximum light power can be emitted.

In order to cleave your fibers, you will need a scribe.  We recommend getting them from Specialized Products. The ruby and carbide versions both work well.  We also recommend using a ferrule jig when cleaving fibers. We 3D print the ferrule jigs in-house to help standardize the fiber cleaving process; if you have ordered a system from us, you likely received one with your system.  They allow you to cut fibers in 0.5mm increments from 2mm to 10mm. The jigs eliminate the need for rulers and leave you with a perfectly cleaved fiber, ready for implantation.

Fibers purchased from Neurophotometrics are sold at 10 mm in length, so they will need to be cleaved to size dictated by your experimental needs.  Consult a brain atlas to choose the proper coordinates for your implants. For fiber photometry experiments, it is very important that the fiber is implanted at the viral injection site.  This differs from optogenetics, where the fiber is usually implanted ~200um above the injection site. We are working with considerably lower levels of light in fiber photometry than in optogenetics, so it is important that the fiber is directly implanted in the brain area you are wanting to record from.  It is important to note that many other factors beyond target brain regions go into choosing a fiber length as well. These include surgical method, type of animal subject, and where your target brain region is located relative to the varying thickness of the skull. 

It is imperative that fiber optics meant for brain implantation are flat and polished at the tip.  Jagged, irregular, or slanted tips will diminish the power efficiency and limit the cell populations that you can reach.  Using scissors, or chopping all the way through the fiber, will result in a fractured core. A clean and symmetrical cut allows for fluorescent traces in the nW range to be picked up by your fiber photometry system.

To cleave a fiber with a ferrule jig:

1.     Place the fiber in the well of the ferrule jig that corresponds to your desired fiber length (the fiber goes into the side of the ferrule with the measurements).

2.     Holding the bottom of the ferrule in place with one finger, lightly score ONE side of the fiber using the scribe. The pressure applied should be light enough that the fiber does not snap off, but firm enough to push it up against the side of the well.

3.     Flick the excess fiber off gently with your finger.

4.     Check the efficiency of the fiber using a power meter to ensure it is about 80%. This can be accomplished by taking a power measurement out of the patch cord with the fiber attached and dividing it by the power coming out of just the patch cord (sans fiber). If it is slightly below this threshold (3-4%), you may lightly polish the fiber by rubbing it gently on polishing paper placed on a rubber pad.

Mistakes happen! Most likely, you will accidentally chop through a few fibers with the scribe. All is not lost — the fiber might be salvageable.  As long as the efficiency is still above 80%, you should be okay. If it is close to this threshold but slightly below, lightly polish the tip of the fiber using the guidelines above.  If it is at 70% and below, or if you’ve polished the fiber but still have an efficiency below 80%, it is best to start over with a fresh fiber. A fiber with a low efficiency will effectively lower your SNR.

While the instructions above include the use of a ferrule jig, you can still cleave a fiber without one. Using the same scribe, tape the ferrule to a ruler and carefully score one side of the fiber and flick off the excess. All rules still apply — make sure to use gentle pressure and try not to chop all the way through the fiber. At this time, we only have ferrule jigs for 1.25mm ferrules, so this is the method that you will have to use if you have 2.5mm ferrules.

If you are concerned about the ferrule getting scratched while the animal is in the home cage, there are a few possible solutions. One is to opt for a different home cage lid that is raised.  This makes it less likely that the animal will knock the ferrule on the metal grating, creating scratches. You can also use a dust cap, but if you have a home cage with a low lid, the cap can get caught and yank the entire implant out.  Also, some animals learn to rip off the dust cap, which can be an issue of its own. If you have the raised cage lid and no dust cap, you can simply clean the ferrule with ethanol and a kim wipe and proceed with your experiment.

We understand that lab life is busy, and it might be easier if your fibers arrive pre-cleaved and ready-to-use. To save you some time, we offer a fiber cleaving service for $3 extra per fiber.  Please note, however, that this will increase the time needed to process your order. Generally speaking, we recommend buying fibers at 10mm so they are fully customizable for your experimental needs. 

This post was written by Savanna Howard.

Getting Started with Bonsai

Bonsai is an open source software capable of processing many heterogeneous streams of data in parallel; it is also our software of choice for running fiber photometry experiments using a Neurophotometrics system. Gonçalo Lopes founded Bonsai as a free yet efficient method to track an animal’s behaviour during graduate school at the Champalimaud Centre for the Unknown. We work closely with Gonçalo to improve the way scientists acquire and analyze data. As an open source software, Bonsai is free to use and not proprietary to any one company; therefore, you can use Bonsai to acquire from or run many behavioural paradigms. The entire program is made in C#, but because it is designed for scientists, the user interface has deviated from utilizing syntactical devices used by other coding languages that many find annoying if they aren’t already fluent coders. Instead, Bonsai is a visual coding language, and its user interface relies on understanding a flow of logic and connecting nodes to achieve your desired outcome.

At Neurophotometrics, we specifically like using Bonsai to timelock photometry data to events in other domains, including operant tasks, EEG, elevated mazes, forced swim tests, audio analysis, and more. Bonsai has many built-in nodes for analyzing such data, but its flexibility extends farther than connecting pre-existing nodes; you can output Python commands if Bonsai’s built in nodes are not sufficient. Furthermore, you can contribute to the community by developing your own packages if you are familiar with C#. 

While documentation is limited, Gonçalo moderates a Bonsai Google forum where questions can be posted and code can be shared. In addition, scientists at Neurophotometrics can be called upon as a resource to help timelock photometry data to your behavioural events.

Setting Up Bonsai

We recommend that you download Bonsai 2.4. Current users should ensure that their version is updated to Bonsai 2.4.1 by the end of March 2020. If you haven’t updated Bonsai by then, no worries — your current version of Bonsai will not become obsolete, but as new Neurophotometrics specific nodes are launched, the dependencies will need to be updated.

To set up Bonsai, install the .exe or .zip file, and once fully downloaded open the Bonsai (x64) application. Please note that a security feature on your device may block Bonsai from running, just click “More Information” and “Run Anyway” to bypass security.

From the “Getting Started” page, select the “Manage Packages” page and install the following packages: Bonsai Starter Pack (which will automatically install Arduino, Audio, DSP, DSP Design, Osc, Scripting, Vision, Vision Design and Window Input), Bonsai – Editor, Bonsai, Bonsai – Core, Bonsai – System, Bonsai – Design, Bonsai – Visualizers, Bonsai – Scripting, Bonsai – Video, Bonsai – System Design, Bonsai – Video Design, and Bonsai – PointGrey Library. You may need additional packages if you wish to timelock your behavioural data to your fiber photometry data. We typically recommend downloading every package until the end of the second page. Once you hit close or exit out of the manage packages window, your Bonsai main page will pop up. You can re-access all Bonsai packages by selecting Tools and Manage Packages. 

Working in Bonsai

Once you have everything downloaded, you’re ready to begin coding. To define the path to save your workflow and to play or stop your workflow, use the toolbar at the top of the window.

Your toolbox contains all of your nodes and can be easily searched by typing in the name of your node. All nodes can be separated into 5 different categories: Source, Transform, Combinator, Sink, and Conditions.

  • Source nodes define where incoming data is coming from. In the case of our fiber photometry workflow, incoming data is sourced through the Spinnaker (formerly FlyCapture) node, specific software that accesses data from the camera via a Spinnaker driver. In the case of motion tracking, incoming data is sourced via the VideoCaptureDevice node, which can acquire video feed using the DirectShow driver from most webcams excluding Logitech.
  • Transform nodes process your data or specify a data subset that you would like to examine. CropPolygon and Average(Dsp) is one of our favorite transformation node combinations. We can specify a region of interest within our video feed and take the average pixel value within that region. Not only will we use this combination to process fiber photometry data, but also for conditioned place preference (CPP) tests. Regions of interests can be drawn over different fields in the arena, and when the animal enters a region, the pixel intensity will change to produce the time onset and exit of place preference. 

Transform nodes will maintain the same number of elements in your data set; however, each element will be transformed by a constant variable. 

  • Combinator nodes help synchronize or gate all of your inputs. Our favorite node is the Zip node such that we can combine all streams of data in parallel. However, this is gated by your slowest input sequence. The sequences of data are matched such that the length of each output sequence is equal. Case in point: we output fiber photometry data and key down data into separate zip nodes. If both streams of data input into the same zip node then fiber photometry data will only be saved if a key is pressed (slowest input sequence).

Combinator nodes such as zip will synchronize elements within your data structure such that each array is of equal length. 

  • Sink nodes define the file type into which your data is exported. In most cases we will use CsvWriters (file type .csv) or VideoWriters (file type .avi). When using CsvWriters, note that your rows of data are transposed into columns when exported. For example, if your first row of Bonsai code outputs time and your second row outputs relative fluorescence, the first column of data within your csv file outputs as time and your second column outputs relative fluorescence. Bonsai can process many streams of data simultaneously and can be applied to a wide range of paradigms.

Sink nodes will save every input element until the end of the recording. 

  • Condition nodes act as gate, filtering through a data set to determine elements that pass a specified criteria. Conditions nodes will most likely be used within a closed-loop control with behaviour. Closed-loop control with a behaviour will require additional hardware such as an Arduino to complete certain tasks. The most common use for closed-loop control is to optogenetically stimulate a brain region in relation to a certain behaviour. 

Condition nodes filter out data elements that meet a certain criteria specified by the condition.

While this article briefly touches upon some fundamental aspects of Bonsai code, the extent of data processing expands much further! Below, we have included a downloadable set of sample workflows to help you get started. If you need help designing a workflow or have any questions about coding in Bonsai, please don’t hesitate to contact us by using the contact form on this website!

This post was written by Madalyn De Viso.

How To Increase Your Frame Rate to 100Hz

The standard frame rate for recordings with Neurophotometrics fiber photometry systems is 40 Hz. This is plenty sufficient for most fiber photometry experiments given the kinetics of the most commonly used fluorescent indicators (e.g. GCaMP). However, if you find yourself wanting to record even faster, you can adjust the camera settings to record up at speeds up to 100 Hz by following this simple procedure.To increase your frame rate, you’ll first need to adjust the field of view of your BlackFly camera. Start by plugging the camera USB cable into a USB-3 port on your computer. Open the FlyCapture software and select “camera” from the devices menu. Before you continue, double check that FlyCapture recognizes the camera as USB 3.0.

From here, click “OK” and navigate to “camera settings” at the top of the toolbar (circled in red).

Under the “Custom Video Modes” tab, change the pixel format to Mono 8.

In the upper left-hand corner, you will see a blue box. Click and drag your cursor within this box to create a smaller red rectangle within that box–this is now your cropped field of view.In the “Image” section, toggle the Left, Top, Width, and Height fields until your cropped field (the red rectangle) is centered within the blue box.

Once the cropped field seems centered, use the FlyCapture viewfinder to check that the entire image from your fiber photometry system is still visible. If it is, click “apply” to save the settings. If not, continue to toggle the cropped field until you can visualize the full image in the viewfinder.

Now that the field of view has been adjusted, the next step is to change the camera’s frame rate. Under the “Camera Settings” tab, check the On/Off box next to the “Frame Rate” sliding scale.Type “100” in the selected field, then uncheck the box. The scale should auto-adjust to the new maximum frame rate.

The final step of this process is to update the code on your driver box. To do this, you first need to download the Arduino IDE if you have not already. Open the file “Drivers_Update.ino” and under the “Sketch” menu, hover over “include library.”If “Button,” “LiquidCrystal,” and “NPM_LCD” are not present at the bottom of this menu, click on “add .zip library” and select each one from the “Libraries” folder included in the “NPM_Drivers_Update_6-2019” folder.

Plug your driver box into your computer using a USB-B to USB-A cable. Select the “Tools” menu, and be sure that the port your driver box is plugged into is selected. On Windows computers, it should be named “COM” followed by a number. On Apple computers, it will probably look something like this:

Finally, click on the arrow next to the check mark, and the code should upload to the driver box. You can now record up to 100 Hz during your experiments!

This post was written by Caroline E. Sferrazza.