Updated the ndsi function to run using apply to feed data to pwelch to avoid the long for loop. Huge improvement in speed.