implement snv and detrend