fixed bug in trimming of pulse models

was incorrectly trimming to first and last positive value. Now
correctly trims to first and last non-zero value