Coadd: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Neal
No edit summary
Line 1: Line 1:
===Purpose===
===Purpose===


Line 11: Line 10:
===Description===
===Description===


COADD is used to combine ("bin") adjacent variables, samples, or slabs of a matrix. Inputs include the original array data, the number of elements to combine together bins {default: 2}, and an optional options structure ''options''. Alternatively, the input ''options'' can be replaced with a scalar value of ''dim'' which will be used for options.dim (see below) and all other options will be the default values.
COADD is used to combine, or "bin", adjacent variables, samples, or slabs of a matrix. Inputs include the original array (data), the number of elements to combine together (bins) {default: 2}, and an optional options structure (''options''). Alternatively, the input (''options'') can be replaced with a scalar value of (''dim'') which will be used for options.dim (see below) and all other options will be the default values.


The mode of co-adding (defined by the options value mode) defines how items within each bin are combined mathematically. See options below for details.
The mode of co-adding (defined by the options value mode) defines how items within each bin are combined mathematically. See options below for details.
Line 17: Line 16:
Unpaired values at the end of the matrix are padded with the least biased value to complete the bin. Output is the co-added data. Unlike DERESOLV, COADD reduces the size of the data matrix by a factor of 1/bins for the dimension.
Unpaired values at the end of the matrix are padded with the least biased value to complete the bin. Output is the co-added data. Unlike DERESOLV, COADD reduces the size of the data matrix by a factor of 1/bins for the dimension.


===Example===
===Options===
 
Options = structure array with the following fields:
 
:dim :  Dimension / mode in which to perform binning {default = 2},


Given a matrix, data, size 300 by 1000, the following would coadd variables in groups of three:
:mode :  [ 'sum' | {'mean'} | 'prod' ] method of binning. See algorithm notes for details of these modes.


:databin = coadd(data,3);
===Algorithm===


and the following would coadd samples in groups of two:
The input (options.mode) defines the type of binning to apply. The different types are described for (options.dim = 2) [i.e., for variables] as follows.


:options.dim = 1;
:'sum' : groups of variables are added together and stored. The resulting values will be larger in magnitude than the original values by a factor on the order of the number of variables binned.


:databin = coadd(data,2,options);
:'mean' : groups of variables are added together and that sum is divided by the number of variables binned. The resulting values will be similar in magnitude to the original values.


The following is equivalent to the previous two lines using the "shortcut" input of dim.
:'prod' : groups of variables are multiplied together.


:databin = coadd(data,2,1);
===Example===


===Options===
Given a matrix, (data), size 300 by 1000, the following coadds variables in groups of three:


* '''dim''': Dimension in which to do combination {default = 2},  
:databin = coadd(data,3);


* '''mode''': [ 'sum' | {'mean'} | 'prod' ] method of combination. See algorithm notes for details of these modes.
and the following coadds samples in groups of two:


===Algorithm===
:options.dim = 1;


The three modes, sum, mean and prod behave according to the following (described in terms of variables):
:databin = coadd(data,2,options);


SUM: groups of variables are added together and stored. The resulting values will be larger in magnitude than the original values by a factor equal to the number of variables binned.
The following is equivalent to the previous two lines using the "shortcut" input of (dim).


MEAN: groups of variables are added together and that sum is divided by the number of variables binned. The resulting values will be similar in magnitude to the original values.
:databin = coadd(data,2,1);


PROD: groups of variables are multiplied together.


===See Also===
===See Also===


[[deresolv]]
[[deresolv]]

Revision as of 16:01, 25 September 2008

Purpose

Reduce resolution through combination of adjacent variables or samples.

Synopsis

databin = coadd(data,bins,options)
databin = coadd(data,bins,dim)

Description

COADD is used to combine, or "bin", adjacent variables, samples, or slabs of a matrix. Inputs include the original array (data), the number of elements to combine together (bins) {default: 2}, and an optional options structure (options). Alternatively, the input (options) can be replaced with a scalar value of (dim) which will be used for options.dim (see below) and all other options will be the default values.

The mode of co-adding (defined by the options value mode) defines how items within each bin are combined mathematically. See options below for details.

Unpaired values at the end of the matrix are padded with the least biased value to complete the bin. Output is the co-added data. Unlike DERESOLV, COADD reduces the size of the data matrix by a factor of 1/bins for the dimension.

Options

Options = structure array with the following fields:

dim : Dimension / mode in which to perform binning {default = 2},
mode : [ 'sum' | {'mean'} | 'prod' ] method of binning. See algorithm notes for details of these modes.

Algorithm

The input (options.mode) defines the type of binning to apply. The different types are described for (options.dim = 2) [i.e., for variables] as follows.

'sum' : groups of variables are added together and stored. The resulting values will be larger in magnitude than the original values by a factor on the order of the number of variables binned.
'mean' : groups of variables are added together and that sum is divided by the number of variables binned. The resulting values will be similar in magnitude to the original values.
'prod' : groups of variables are multiplied together.

Example

Given a matrix, (data), size 300 by 1000, the following coadds variables in groups of three:

databin = coadd(data,3);

and the following coadds samples in groups of two:

options.dim = 1;
databin = coadd(data,2,options);

The following is equivalent to the previous two lines using the "shortcut" input of (dim).

databin = coadd(data,2,1);


See Also

deresolv