*/
public InstantaneousOutput run(float[] time, float[] current) {
InstantaneousOutput result = null;
if (myMode.equals(SimulationMode.CONSTANT_RATE)) {
result = new RealOutputImpl(new float[]{myRateFunction.map(new float[]{current[0]})}, Units.SPIKES_PER_S, time[time.length-1]);
} else if (myMode.equals(SimulationMode.RATE)) {
float totalTimeSpan = time[time.length-1] - time[0];
float ratePerSecond = myRateFunction.map(new float[]{MU.mean(current)});
float ratePerStep = totalTimeSpan * ratePerSecond;
float numSpikes = new PoissonPDF(ratePerStep).sample()[0];
result = new RealOutputImpl(new float[]{numSpikes / totalTimeSpan}, Units.SPIKES_PER_S, time[time.length-1]);
} else {
boolean spike = false;
for (int i = 0; i < time.length - 1 && !spike; i++) {
float timeSpan = time[i+1] - time[i];