// can probably delete this int MathModel::SigmaXRiseFunction(float *output,int npts, float *frame_times, int sub_steps, float C, float t_mid_nuc,float sigma) { int ndx = 0; float tlast = 0.0f; float last_nuc_value = 0.0f; int i_start = 0; bool i_start_uninitialized = true; memset(output,0,sizeof(float[npts*sub_steps])); for (int i=0;(i < npts) && (last_nuc_value < 0.999f*C);i++) { // get the frame number of this data point (might be fractional because this point could be // the average of several frames of data. This number is the average time of all the averaged // data points float t=frame_times[i]; for (int st=1;st <= sub_steps;st++) { float tnew = tlast+(t-tlast)*(float)st/sub_steps; float erfdt = (tnew-t_mid_nuc)/sigma; if (erfdt >= -3.0f) last_nuc_value = C*(1.0+ErfApprox(erfdt))/2.0f; output[ndx++] = last_nuc_value; } if (i_start_uninitialized && (last_nuc_value >= MIN_PROC_THRESHOLD)) { i_start = i; i_start_uninitialized = false; } tlast = t; } for (;ndx < sub_steps*npts;ndx++) output[ndx] = C; if (i_start_uninitialized) printf("SigmaXRiseFunction... ERROR_FINDING_I_START: t_mid_nuc: %f sigma: %f npts:%d sub_steps:%d\n", t_mid_nuc, sigma, npts, sub_steps); return(i_start); }
// can probably delete this int SigmaXRiseFunction(float *output,int npts, float *frame_times, int sub_steps, float C, float t_mid_nuc,float sigma) { int ndx = 0; float tlast = 0; float last_nuc_value = 0.0; int i_start; i_start = -1; memset(output,0,sizeof(float[npts*sub_steps])); for (int i=0;(i < npts) && (last_nuc_value < 0.999*C);i++) { // get the frame number of this data point (might be fractional because this point could be // the average of several frames of data. This number is the average time of all the averaged // data points float t=frame_times[i]; for (int st=1;st <= sub_steps;st++) { float tnew = tlast+(t-tlast)*(float)st/sub_steps; float erfdt = (tnew-t_mid_nuc)/sigma; if (erfdt >= -3) last_nuc_value = C*(1.0+ErfApprox(erfdt))/2.0; output[ndx++] = last_nuc_value; } if ((i_start == -1) && (last_nuc_value >= MIN_PROC_THRESHOLD)) i_start = i; tlast = t; } for (;ndx < sub_steps*npts;ndx++) output[ndx] = C; return(i_start); }