function WPAROUND, ind, n ;+ ;NAME: ; WPAROUND ; ;PURPOSE: ; To perform a circular map onto 0->(n-1) ; ;CATEGORY: ; Array Transformation. ; ;CALLING SEQUENCE: ; indnew = WPAROUND(ind, n) ; ;INPUTS: ; ind = vector to wrap ; n = length of wrap ; ;OUTPUTS: ; An array with the values wrapped. ; ;EXAMPLE: ; IDL> arr = [1,2,3,4,5,6,7,8,9] ; IDL> print, arr ; 1 2 3 4 5 6 7 ; 8 9 ; IDL> n = 7 ; IDL> indnew = WPAROUND(arr,n) ; IDL> print, indnew ; 1 2 3 4 5 6 7 ; 1 2 ; ;MODIFICATION HISTORY: ; Written by: Amara Graps November, 1995 ;Translated from MatLab Wavelab routine: wraparound.m ;- indnew = (ind LE n) * ind + (ind GT n) * (ind - n) ; ; Algorithm Source: WaveLab Version 0.600 ; WaveLab WWW site: http://playfair.stanford.edu/ ; WaveLab Questions? e-mail wavelab@playfair.stanford.edu RETURN, indnew END ;of function WPAROUND ;*********************************************************************