Theory and Tools for the Conversion of Analog to Spiking Convolutional Neural Networks