Open the input event file Read the observing mode from the input event file Read from the EPN_CTI CCF coefficients and template values Loop over each event set coefficients(a,b,c) from the event CCD, RAWX, RAWY values set template value from the event CCD, RAWX, RAWY values h = log10(event_pi) - 3.0; f = a + (b + c * h) * h; event_pi = event_pi - template_value * f end of loop Add the keyword SPATCTIC = 'yes' into the EVENTS header