Assuming the code actually works, which is questionable given its complexity, the impedance check is simply using the on board current generator and the intan chip and measuring the resultant voltage on the native channels. Capacitance is calculated via phase shift.
See page 29 of intan data sheet:
Some potential reasons:
- current generation is simply using a DAC in series with capacitor, which works if we assume the capacitor is absolutely perfect. Given that these are 0.1 to 10pF, this claim is pretty questionable since its going to be competing with weird parasitics all over the place. I assume Reid did the necessary tests to make sure this was not an issue.
- The voltage across the microwire during a measurement is going to depend on its impedance and the current you inject. You would want to tune the injected current in order to fill the ADCs +/-5 mV dyanamic range by in order to get repeatable measurements. This involves changing the series capacitance and DAC waveform adaptively for each electrode until you got a large but non-saturating voltage back. Im unwilling to look through the code, but if it does not do this, it might be the reason for non-repeatable measurements.