| 
 
      Calculate the number of channels (elements) in each group.
     
Array_Type chanspergrp = grpGetChansPerGroup( Array_Type grouping ) 
       
	This function returnes the number of channels (i.e. elements)
	in each group.
	The return value is an array whose length equals
	that of the input data (the dataArray argument)
	and each element within a group contains the same value.
	As an example,
	 grpGetChansPerGroup( [1,-1,1,-1,1,1] )
	will return the array
	 
	since the groups consist of the first two elements,
	then the next two elements, with the last two elements
	being un-grouped.
       
chips> nchan = grpGetChansPerGroup( grp )
	  
	    The nchan array will contain the number of elements 
	    in each group, as given in the grouping scheme
	    stored in the grp array.
	    The nchan array will have the same size as the grp
	    array. The following code shows
	    you how you can convert nchan into an array in
	    which each element corresponds to one group.
	   
chips> i = where( grp == 1 )
chips> nelem = nchan[i]
	    Here we created an array i whose elements correspond
	    to those elements in the grp array with a value of 1
	    (this marks the start of a group). The nelem array is
	    then created by using this array to extract the
	    corresponding elements from the ncham array.
	    It could have been written in one line as:
	   
chips> nelem = nchan[ where( grp == 1 ) ] 
chips> x = [0.5:6.0:0.05]
chips> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 )
chips> ( grp, qual ) = grpNumCounts( y, 15 )
chips> ysum = grpGetGroupSum( y, grp )
chips> nchan = grpGetChansPerGroup( grp )
chips> i = where( grp == 1 and qual == 0 )
chips> xstart = x[i]
chips> yavg = ysum[i] / nchan[i]
	  
	    Here we take the function
	     y = 3 + 30 * exp( -(x-2)^2 / 0.1 )
	    and group it by 15 counts per group.
	    We then filter the summed array (ysum) so that it
	    corresponds to only those elements at the start
	    of a group - the
	     
	    condition - and for which the quality flag is "good" -
	    which is given by
	     
	    This array is divided by the number of elements in each
	    group to calculate the average value in the group. 
	    Note that the xstart array gives the start position of each
	    group.
	   
group
grpadaptive,
grpadaptivesnr,
grpbin,
grpbinfile,
grpbinwidth,
grpgetchanspergroup,
grpgetgroupsum,
grpgetgrpnum,
grpmaxslope,
grpminslope,
grpnumbins,
grpnumcounts,
grpsnr
modules
group
 |