Drift correction for electrophysiology and two-photon calcium imaging