Understanding spiking networks through convex optimization