MesoNet: bipolar temporal-switch encoder
sign from swapping the two event times, nice. draw pixels either side of a quantization boundary later; want to see how suddenly that pair moves
Reference: base_model/mnistV1.py → temporal_switch(img, quant_levels=10). The archived experiment normalizes each pixel with (img - 127.5)/127.5, maps magnitude to a discrete timing level, and encodes sign by reversing the order of positive/negative events.
norm_img = (img - 127.5) / 127.5
quantized_level = int(np.floor(abs(p) * (quant_levels - 1)) + 1)
t_first = 1 * tau
t_second = quantized_level * tau

Input image and temporal encoder
These four lines restate the archived calculation, with the two event-time variable names simplified for this reference. A positive pixel emits the positive event first and negative event second; a negative pixel swaps them. The code skips quantization levels below 2. It returns two (pixel_indices, spike_times) pairs, used to construct or update SpikeGeneratorGroups. This prototype sets tau = 1*ms and quant_levels = 10.
Review questions: does skipping the lowest bin intentionally suppress near-midgray values? Check zero, minimum and maximum pixels and the boundary between bins. Verify time arrays are interpreted relative to the intended presentation start when reused after Network.run. The archive demonstrates an experimental encoder; later paper text instead describes Poisson input, so the encoding used for a reported benchmark must be identified explicitly.
