Difference between revisions of "General Behaviour"
Line 1: | Line 1: | ||
Some general behaviour is shared by many different functions | Some general behaviour is shared by many different functions | ||
+ | |||
==Arrays of Datasets== | ==Arrays of Datasets== | ||
Line 23: | Line 24: | ||
==Property-Value Pairs== | ==Property-Value Pairs== | ||
+ | |||
Some functions, particularly those in the [[User Manual#Graphics|Graphics]] package have many optional independent input parameters. Property-value pairs are used to set these. | Some functions, particularly those in the [[User Manual#Graphics|Graphics]] package have many optional independent input parameters. Property-value pairs are used to set these. | ||
Line 35: | Line 37: | ||
==Naming of Functions== | ==Naming of Functions== | ||
+ | [[IXTdatset_1d]] functions are named after what they do, for instance rebin will rebin data in the dataset. | ||
+ | Most functions have counterparts that act on [[IXTdataset_2d]] objects. These often have the same name with a suffix _x, if acting along the x dimension, _y, if acting along the y dimension and _xy if acting along both dimensions at the same time. For instance rebin_x, rebin_y, rebin_xy. | ||
− | |||
==Order of Inputs== | ==Order of Inputs== | ||
− | + | * Datasets are always the ''first'' input | |
+ | * Property-value pairs are always the ''last'' input | ||
+ | * Any inputs pertaining to the x dimension come before any inputs pertaining to the y dimension | ||
+ | |||
==Name Tags== | ==Name Tags== | ||
See [[Using Default Properties and Name Tags]] for more information | See [[Using Default Properties and Name Tags]] for more information | ||
+ | |||
+ | |||
+ | ==Reference Datasets== | ||
+ | |||
+ | Some functions can use reference datasets as an input instead of parameters. Here, the relevant parameters will match the reference dataset | ||
+ | |||
+ | <pre>>> wout = func(w1, w2)</pre> | ||
+ | |||
+ | wout will be the function func acting on w1 with parameters determined by w2 | ||
+ | |||
+ | |||
+ | '''''EXAMPLE:''''' | ||
+ | |||
+ | <pre>>>wout = rebin(w, w2)</pre> | ||
+ | |||
+ | * w will be rebinned to have the same binning as w2 |
Revision as of 09:37, 19 March 2008
Some general behaviour is shared by many different functions
Arrays of Datasets
If an array of datasets is given then the operation is performed on each dataset in turn, so that
>> wwout = func(ww, params)
where wwout and ww are arrays of datasets and params are the parameters required by the function func, is the equivilent of
for i = 1:length(ww) wwout(i) = func(ww(i), params) end
If all of the parameters are arrays of the same length as the dataset then for some functions this will be equivilent to
for i = 1:length(ww) wwout(i) = func(ww(i), params(i) end
See the matlab online help on individual functions for information on whether they use this syntax.
Property-Value Pairs
Some functions, particularly those in the Graphics package have many optional independent input parameters. Property-value pairs are used to set these.
>> func(input1, input2, ... 'Property', value, 'Property2', value2, ...)
- Properties are always strings that indicate which property will be set
- Values must be in the correct format for the property being set. For instance, if the property is a size, then the value should be a number, but if the property is a label then the value should be a string
- Property-value pairs may be given in any order or omitted
- Property-value pairs are always the final set of arguments to a function
Naming of Functions
IXTdatset_1d functions are named after what they do, for instance rebin will rebin data in the dataset.
Most functions have counterparts that act on IXTdataset_2d objects. These often have the same name with a suffix _x, if acting along the x dimension, _y, if acting along the y dimension and _xy if acting along both dimensions at the same time. For instance rebin_x, rebin_y, rebin_xy.
Order of Inputs
- Datasets are always the first input
- Property-value pairs are always the last input
- Any inputs pertaining to the x dimension come before any inputs pertaining to the y dimension
Name Tags
See Using Default Properties and Name Tags for more information
Reference Datasets
Some functions can use reference datasets as an input instead of parameters. Here, the relevant parameters will match the reference dataset
>> wout = func(w1, w2)
wout will be the function func acting on w1 with parameters determined by w2
EXAMPLE:
>>wout = rebin(w, w2)
- w will be rebinned to have the same binning as w2