Difference between revisions of "General Behaviour"

From LIBISIS
Jump to navigation Jump to search
Line 17: Line 17:
  
 
<pre>for i = 1:length(ww)
 
<pre>for i = 1:length(ww)
     wwout(i) = func(ww(i), params(i)
+
     wwout(i) = func(ww(i), params(i))
 
end</pre>
 
end</pre>
  
 
See the matlab online help on individual functions for information on whether they use this syntax.
 
See the matlab online help on individual functions for information on whether they use this syntax.
 
  
 
==Property-Value Pairs==
 
==Property-Value Pairs==

Revision as of 08:39, 20 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