adding detrend unit test to output result to a file