update to spike train envelope code