How to generaate a spike at the present of a pixel in a handwritten digit image?

Hi, I’m trying to implement this research paper (*) with brian2 with scikit-learn libraries. The pseudocode for the entire paper is basically

.

The question is: how do I create a spike at the present of a pixel???