Here's my grouping function. It's shorter than yours, but I don't know if it's good Slang. It doesn't do the grouping, just returns the grouping array, given the array length, len, and the bins per group, nbins. We should probably start tossing our utilities around and collecting useful ones in a central repository. Since many of us are gradually learning Slang, this will also help w/ language features and progamming styles. define ngrp(len,nbins) { return ([0:len-1:1]/nbins mod 2) * 2 - 1; } davis> Here is my group_data function. I have it defined in my davis> .isisrc file: davis> public define group_data (ds, num) davis> { davis> variable idx, len; davis> rebin_data (ds, 0); % unbin data davis> (idx,,,) = get_data (ds); davis> len = length (idx); davis> idx = Int_Type [len]; davis> variable i, s; davis> s = 1; davis> _for (0, len-1, 1) davis> { davis> i = (); davis> !if (i mod num) davis> s = -s; davis> idx[i] = s; davis> } davis> rebin_data (ds, idx); davis> } -- DaveReceived on Wed Dec 13 2000 - 15:03:15 EST
This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:43 EDT