function template=lsqfit_template_generator2(seed_values,time_vector)
%description: pretty straightforward -- used by lsqcurvefit (curve fitting toolbox)
%everything is done in terms of samples here

amplitude_scaler=seed_values(1);
tau_rise=seed_values(2);
tau_decay1=seed_values(3);
y_offset=seed_values(4);
latency=seed_values(5);

template=y_offset-[zeros(1,ceil(latency)) amplitude_scaler*(1-exp(-time_vector/tau_rise)).*exp(-time_vector/tau_decay1)];
template=template(1:length(time_vector));   %needs to be done because lsqcurvefit apparently will only compare two vectors of the same length