This script proposes a new convex fitting procedure that allows the parameters estimation of a large class of stochastic Integrate-and-Fire model upgraded with spike-triggered current and moving threshold from patch-clamp experiments (i.e. given the injected current and the recorded membrane potential). This script applies the method described in the paper to estimate the parameters of a reference model from a single voltage trace and the corresponding input current and evaluate the performance of the fitted model on a separated test set.