Filtering – A practical guide

Finding good information on how filters work, what the different types of filters mean, and how you should filter your data is hard. Lots of explanations only make sense if you have a year or two of electrical engineering education, and most of the rest are just a list of rules of thumb. I want to try to get you to a place where you can test your own filter settings, and show you the importance of the rules of thumb without going into the relatively complex math that is often used to explain filters. Warning: a lot of the code I’m going to use requires the Matlab Signal Processing Toolbox. If you don’t have it, you wont be able to execute the code yourself, but hopefully you’ll still be able to follow along with the logic.
Continue reading

Electrical Stimulation: Why we use isolators.

Even though we are now in the era of optogenetics, electrical stimulation of excitable tissues is still common place in the lab. However, despite how common they are, I see that a lot of people don’t fully understand why they using some fancy expensive box to deliver the stimulus, rather than just, say, using the DAC output of your digitizer. The actual physics of why passing current through your tissue excites neurons/muscles is a bit more complex than you might think, but that’s not what I’m going to talk about. I’m going to talk about what a stimulus isolator is, and why we use them. Continue reading

Merging ROIs in suite2p

Suite2p is a wonderful Matlab toolbox written by Marius Pachitariu for analyzing population calcium imaging data. It uses a number of computational tricks to automate and accelerate the process (so no more drawing regions of interest (ROIs) by hand!). However, I spend most of my time imaging dendrites and axons, and here suite2p has a problem. Suite2p uses a heuristic that is looking for approximately elliptical ROIs, and hence it tends to split axons/dendrites into a large number smaller ROIs. The problem was simple: how can we merge the ROIs belonging to single cells? Well I used the logic that ROIs that belong to the same neuron should have highly correlated calcium signals (yes, I can imagine a situations where this wont be the case in dendrites, but bAPs will still dominate the calcium trace 99.9% of the time). Hence I simply correlate each ROI with every other ROI. ROIs with a correlation coefficient above some user settable threshold are considered to be part of the same process.

The main script is available here, and it requires distinguishable_colors.m (which in turn requires the image processing toolbox I believe).

join_axon

The code is relatively well documented/commented, and there is even a ‘Help!’ button. If anyone has any problems with it, please let me know.

Neuronal Modelling – The very basics. Part 2: Hodgkin and Huxley.

In part 1 of this post, I discussed the very basics of neuronal modelling. We discussed the fundamental equations that explain how ion channels create current and how current changes the membrane potential. With that knowledge, we created a simple one-compartment model that had capacitance, and a leak ion channel. But we didn’t have any action potentials. In order to model action potentials, we need to insert some mechanism to generate them. There are several ways of doing this, but the most common is the Hodgkin and Huxley (HH) model. I’m going to dive straight in to understanding the HH model, and as usual, I’m going to start from the ground floor.

\mathbf{\overset{n}{Open}} \overset{\beta}{\rightarrow} \mathbf{\overset{1-n}{Closed}}

Continue reading

Neuronal Modelling – The very basics. Part 1.

I think a lot of people are confused about neuronal modelling. I think a lot of people think it is more complex than it is. I think too many people think you have to be a mathematical or computational wizard to understand it, and I think that leads to a lot of good modelling being discounted and a lot of bad modelling being let through peer-review. I’m here to tell you that biophysical models on neurons don’t have to be hard to implement, or understand. I’m going to start you off on the ground floor, in fact, below the ground floor, this is the basement level. All you need to know is a little coding (I’m going to do both Matlab and Python to start). But I should temper your expectations. When we are done, you’re not going to be ready to publish fully fledged multi-compartment models of neurons, but at least you will understand the fundamental principles of what is happening. And the most fundamental of all is this…

\frac{\mathrm{d}v}{\mathrm{d}t} = \frac{i}{C}

Continue reading

The ins and outs of field potentials

Recording field potentials was the first form of electrophysiology I ever did, and because of that, I tend to think that field potentials are simple. But the reality is far different. Field potentials, in my view, are harder to gain a solid understanding of than intracellular membrane potentials. So I’m going to try to take a ‘first principles’ approach to thinking about field potentials. To motivate us, I’m going to present exhibit ‘A': The hippocampal CA1 population spike.

Exhibit A: A CA1 population spike.

Exhibit A: A CA1 population spike. Recorded by me in 2004.

A CA1 population spike is the field potential recorded near the cell bodies of the CA1 pyramidal cells, when their afferents are stimulated strongly enough to cause the CA1 cells to spike. You see a brief upward deflection, which is an artefact from the electrical stimulation used to activate the afferents. Then you see a small downward deflection, which is due to the action potential in the afferent fibers. Then you see the population spike: the large, brief, negative potential caused by thousands of neurons spiking synchronously. It is negative because when the action potential is generated, Na+ moves into the cell, making the extracellular space negative. But here is a question: Why does the population spike appear to be resting on a positive going hump? Read on and find out, and learn more about field potentials in general.
Continue reading

You need to understand the voltage divider!

In electronic design, the voltage divider is probably the most fundamental circuit motif. You would be hard pressed to find single circuit that doesn’t have one. But more importantly, it is a deeply useful concept for explaining the physiology of excitable cells, and for understanding the nature of electrophysiological techniques. I’ve talked about voltage dividers in several of my posts, but one of my readers said I should explain what they are so that’s what I’m going to do now.

voltage-divider

Continue reading

2-Photon Excitation Spectrum of Red Retrobeads

In order to successfully combined in vivo 2-photon GCaMP6f imagining and red retrobeads, I need to know the 2-photon excitation spectrum for the beads. I couldn’t find the information online, and the lumafluor didn’t have it, so I produced a rough and ready estimate. First, the power of the laser was measured in the range of 740 to 940 nm, then a small sample of undiluted retrobeads was held in the bottom of a sealed capillary tube, and the mean pixel value of the center of this capillary was measured as the wavelength was changed. I have presented the data as both the raw pixel values (Arb.) and the pixel values normalized to the power at the sample (Arb/µW). Long story short: between 780 and 880 nm is where you want to image.red-retrobead-spectrum2

EDIT: I have adjusted the axis as per the comment. I was just going to use “brightness”, but more descriptive = more better, right?

Series Resistance. Why it’s bad.

At the very start of my Masters, my first experiments appeared to show that the histamine H3 receptor inhibited the release of GABA in the neocortex. It turns out, this was all lies. It was all lies because of series resistance, a concept I had vaguely heard of, but didn’t understand. If you’re just starting electrophysiology this post is for you. The hope is that by the end of this post, you will understand series resistance, and you’ll understand why it is extremely important to monitor it religiously, whether you’re performing voltage clamp or current clamp recordings.
Continue reading