Difference between revisions of "Data Manipulation Functions"

From LIBISIS
Jump to navigation Jump to search
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Data manipulation functions change the data in some way, such as scaling or flipping it. The functions available are
 
Data manipulation functions change the data in some way, such as scaling or flipping it. The functions available are
  
<pre>>> wnew = shift(w, xshift)
+
 
>> wwout = shift_x(ww, xshift)
 
>> wwout = shift_y(ww, yshift)
 
>> wwout = shift_xy(ww, xshift, yshift)
 
>> wout = scale(w, factor)
 
>> wwout = scale_x(ww, factor)
 
>> wwout = scale_y(ww, factor)
 
>> wout = flip(w)
 
>> wwout = flip_x(ww)
 
>> wwout = flip_y(ww)</pre>
 
  
 
==Shift Functions==
 
==Shift Functions==
 +
 
These functions add a value to one of the independent variable arrays (x or y), leaving any related data (such as the signal data) untouched. For instance if an x array, [10, 20, 30, 40, 50], is shifted by 2 the output x array will be [12, 22, 32, 42, 52].  
 
These functions add a value to one of the independent variable arrays (x or y), leaving any related data (such as the signal data) untouched. For instance if an x array, [10, 20, 30, 40, 50], is shifted by 2 the output x array will be [12, 22, 32, 42, 52].  
  
Line 31: Line 23:
  
  
'''Example:'''
+
'''''Example:'''''
 
 
 
 
>> wout = shift_x(ww, 4)
 
  
 +
<pre> >> wout = shift_x(ww, 4)</pre>
  
 
Every x value in wout will have 4 added to them
 
Every x value in wout will have 4 added to them
Line 41: Line 31:
  
 
==Scale Functions==
 
==Scale Functions==
 +
 
Multiplies one of the independent variable arrays (x or y) by a constant. For instance if an x array, [10, 20, 30, 40, 50], is scaled by 2 the output x array will be [20, 40, 60, 80, 100].
 
Multiplies one of the independent variable arrays (x or y) by a constant. For instance if an x array, [10, 20, 30, 40, 50], is scaled by 2 the output x array will be [20, 40, 60, 80, 100].
  
Line 47: Line 38:
 
>> wwout = scale(ww, xyscale)</pre>
 
>> wwout = scale(ww, xyscale)</pre>
  
* Input is an [[IXT_dataset_2d]] object
+
* Input is an [[IXTdataset_2d]] object
* Output is an [[IXT_dataset_2d]] object
+
* Output is an [[IXTdataset_2d]] object
 
* Scales x by factor xscale
 
* Scales x by factor xscale
 
* Scales y by factor yscale
 
* Scales y by factor yscale
Line 56: Line 47:
 
<pre>>> wout = scale(w, xscale)</pre>
 
<pre>>> wout = scale(w, xscale)</pre>
  
* Input is an [[IXTdatset_1d]] object
+
* Input is an [[IXTdataset_1d]] object
 
* Output is an [[IXTdataset_1d]] object
 
* Output is an [[IXTdataset_1d]] object
 
* scales x by an amount xscale
 
* scales x by an amount xscale
  
  
'''Example:'''
+
'''''Example:'''''
  
 +
<pre>>> wwout = scale_y(ww, 4)</pre>
  
>> wwout = scale_y(ww, 4)
+
will multiply every y value in wwout by 4
  
  
will multiply every y value in wwout by 4
+
==Flip Functions==
  
==Flip Functions==
 
 
All data, including associated signal and error data is reversed in the order it appears in the dataset. For instance if a dataset has x data [1, 2, 3, 4], signal data [34, 35, 36, 37] and error data [0.1 0.2 0.1 0.1] then the flipped data will have xdata [4, 3, 2, 1], signal data [37, 36, 35, 34] and error data [0.1 0.1 0.2 0.1].  
 
All data, including associated signal and error data is reversed in the order it appears in the dataset. For instance if a dataset has x data [1, 2, 3, 4], signal data [34, 35, 36, 37] and error data [0.1 0.2 0.1 0.1] then the flipped data will have xdata [4, 3, 2, 1], signal data [37, 36, 35, 34] and error data [0.1 0.1 0.2 0.1].  
  
Line 80: Line 71:
 
<pre>>> flip_y(ww)</pre>
 
<pre>>> flip_y(ww)</pre>
  
Reverses the order of y rows in [[IXTdatset_2d]]
+
Reverses the order of y rows in [[IXTdataset_2d]]
  
 
<pre>>> flip(ww)
 
<pre>>> flip(ww)
Line 86: Line 77:
  
 
Reverses the order of x rows in [[IXTdataset_1d]] or both x columns and y rows in [[IXTdataset_2d]].
 
Reverses the order of x rows in [[IXTdataset_1d]] or both x columns and y rows in [[IXTdataset_2d]].
 +
  
 
== Arrays of Datasets ==
 
== Arrays of Datasets ==
Line 92: Line 84:
  
  
'''Example:'''
+
'''''Example:'''''
 
 
  
>> wout = flip(w)
+
<pre>>> wout = flip(w)</pre>
  
  
 
is equivilent to  
 
is equivilent to  
  
 
+
<pre>for i = 1:length(w)
for i = 1:length(w)
+
  wout(i) = flip(w(i))
 
+
end</pre>
<nowiki>  wout(i) = flip(w(i))</nowiki>
 
 
 
end
 

Latest revision as of 14:04, 1 April 2008

Data manipulation functions change the data in some way, such as scaling or flipping it. The functions available are


Shift Functions

These functions add a value to one of the independent variable arrays (x or y), leaving any related data (such as the signal data) untouched. For instance if an x array, [10, 20, 30, 40, 50], is shifted by 2 the output x array will be [12, 22, 32, 42, 52].

>> shift_x(ww, xshift)
>> shift_y(ww,yshift)
>> shift_xy(ww,xshift,yshift)
>> shift(w, xshift)


Example:

 >> wout = shift_x(ww, 4)

Every x value in wout will have 4 added to them


Scale Functions

Multiplies one of the independent variable arrays (x or y) by a constant. For instance if an x array, [10, 20, 30, 40, 50], is scaled by 2 the output x array will be [20, 40, 60, 80, 100].

>> wwout = scale_x(w, xscale)
>> wwout = scale_y(ww, yscale)
>> wwout = scale(ww, xyscale)
  • Input is an IXTdataset_2d object
  • Output is an IXTdataset_2d object
  • Scales x by factor xscale
  • Scales y by factor yscale
  • Scales both x and y by amount xyscale


>> wout = scale(w, xscale)


Example:

>> wwout = scale_y(ww, 4)

will multiply every y value in wwout by 4


Flip Functions

All data, including associated signal and error data is reversed in the order it appears in the dataset. For instance if a dataset has x data [1, 2, 3, 4], signal data [34, 35, 36, 37] and error data [0.1 0.2 0.1 0.1] then the flipped data will have xdata [4, 3, 2, 1], signal data [37, 36, 35, 34] and error data [0.1 0.1 0.2 0.1].


>> flip_x(ww)

Reverses the order of x columns in IXTdataset_2d


>> flip_y(ww)

Reverses the order of y rows in IXTdataset_2d

>> flip(ww)
>> flip(w)

Reverses the order of x rows in IXTdataset_1d or both x columns and y rows in IXTdataset_2d.


Arrays of Datasets

If an array of dataset objects is passed to the function, then the operation is performed on each dataset in turn.


Example:

>> wout = flip(w)


is equivilent to

for i = 1:length(w)
   wout(i) = flip(w(i))
end