Difference between revisions of "General Behaviour"

From LIBISIS
Jump to navigation Jump to search
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
Some general behaviour is shared by many different functions
 +
 +
 
==Arrays of Datasets==
 
==Arrays of Datasets==
 +
 +
If an array of datasets is given then the operation is performed on each dataset in turn, so that
 +
 +
<pre>>> wwout = func(ww, params)</pre>
 +
 +
where wwout and ww are arrays of datasets and params are the parameters required by the function func, is the equivalent of
 +
 +
<pre>for i = 1:length(ww)
 +
    wwout(i) = func(ww(i), params)
 +
end</pre>
 +
 +
If all of the parameters are arrays of the same length as the dataset then for some functions this will be equivalent to
 +
 +
<pre>for i = 1:length(ww)
 +
    wwout(i) = func(ww(i), params(i))
 +
end</pre>
 +
 +
See the matlab online help on individual functions for information on whether they use this syntax.
  
 
==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.
 +
 +
<pre>>> func(input1, input2, ... 'Property', value, 'Property2', value2, ...)</pre>
 +
 +
* 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
 +
* See [[User Reference]] for more information about the properties that can be set
 +
 +
  
 
==Naming of Functions==
 
==Naming of Functions==
  
talk about _x, _y, _xy convention etc. etc.  
+
[[IXTdataset_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]] or [[IXTrunfile]] 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.
 +
 
 +
An [[IXTrunfile]] object should be thought of as an array of [[IXTdataset_2d]] objects.
 +
 
 +
 
  
 
==Order of Inputs==
 
==Order of Inputs==
  
things like, the dataset always comes first, then any x transformation, then any y transformation.
+
* 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 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

Latest revision as of 09:58, 10 April 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 equivalent 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 equivalent 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
  • See User Reference for more information about the properties that can be set


Naming of Functions

IXTdataset_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 or IXTrunfile 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.

An IXTrunfile object should be thought of as an array of IXTdataset_2d objects.


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