Difference between revisions of "IXTdataset 2d"
m |
m (→Examples) |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
{| {{Tablestyle}} | {| {{Tablestyle}} | ||
|- | |- | ||
− | | Field | + | ! {{Headcellstyle}} | Field |
− | | Type | + | !{{Headcellstyle}} | Type |
− | | Description | + | ! {{Headcellstyle}} | Description |
|- | |- | ||
|'''base''' | |'''base''' | ||
Line 21: | Line 21: | ||
|- | |- | ||
|'''title''' | |'''title''' | ||
− | | char | + | | char(allocatable) |
| Title of the dataset used in [[Plot Commands|plotting]] | | Title of the dataset used in [[Plot Commands|plotting]] | ||
|- | |- | ||
|'''signal''' | |'''signal''' | ||
− | | real (ptr) | + | | real(ptr) |
| Signal data | | Signal data | ||
|- | |- | ||
|'''error''' | |'''error''' | ||
− | | real (ptr) | + | | real(ptr) |
| Standard error | | Standard error | ||
|- | |- | ||
Line 37: | Line 37: | ||
|- | |- | ||
|'''x''' | |'''x''' | ||
− | | real (ptr) | + | | real(ptr) |
| First independent variable data (i.e. x data). If point data this will be the point positions in the x axis. If histogram data, this will be the bin boundaries in the x axis | | First independent variable data (i.e. x data). If point data this will be the point positions in the x axis. If histogram data, this will be the bin boundaries in the x axis | ||
|- | |- | ||
Line 49: | Line 49: | ||
|- | |- | ||
|'''y''' | |'''y''' | ||
− | | real (ptr) | + | | real(ptr) |
| Second independent variable data (i.e. y data). If point data this will be the point positions in the y axis. If histogram data, this will be the bin boundaries in the y axis | | Second independent variable data (i.e. y data). If point data this will be the point positions in the y axis. If histogram data, this will be the bin boundaries in the y axis | ||
|- | |- | ||
Line 105: | Line 105: | ||
Here, assume that a function my_func is some unusual function of the form | Here, assume that a function my_func is some unusual function of the form | ||
− | <tt>function z = | + | <tt>function z = my_polynom2D(x, y, pin) |
− | |||
− | |||
z = pin(1).*x.^6 + pin(2).*y.*sin(x) + pin(3).*x</tt> | z = pin(1).*x.^6 + pin(2).*y.*sin(x) + pin(3).*x</tt> | ||
Line 119: | Line 117: | ||
y = 1:2:60 | y = 1:2:60 | ||
− | z = | + | [xm, ym] = ndgrid(y, x) |
+ | |||
+ | z = my_polynom2D(xm, ym, [2, 3, 2]) % generate z values | ||
title = 'my unusual function' | title = 'my unusual function' | ||
Line 131: | Line 131: | ||
e = zeros(size(z)) % need error values for full construction | e = zeros(size(z)) % need error values for full construction | ||
− | w = IXTdataset_2d(IXTbase, title, z, e, | + | w = IXTdataset_2d(IXTbase, title, z, e, zaxis, x, xaxis, false, y, yaxis, false) |
[[Plot Commands|dl]](w) % plot the data</tt> | [[Plot Commands|dl]](w) % plot the data</tt> | ||
− | gives the same results as | + | gives the same results as the function |
Line 153: | Line 153: | ||
w.s_axis = [[IXTaxis]]('z') | w.s_axis = [[IXTaxis]]('z') | ||
− | w = [[High Level Functions#Function Evaluation|func_eval]](w, [2 3 2]) | + | w = [[High Level Functions#Function Evaluation|func_eval]](w,@my_polynom2D, [2 3 2]) |
[[Plot Commands|dl]](w)</tt> | [[Plot Commands|dl]](w)</tt> | ||
+ | |||
+ | ==F90 syntax== | ||
+ | |||
+ | <pre>use IXMdataset_2d | ||
+ | |||
+ | type(IXTdataset_2d):: data2d | ||
+ | type(IXTstatus):: status</pre> | ||
+ | |||
+ | |||
+ | ==Fortran Operations== | ||
+ | |||
+ | The following operations may be performed on this data type: | ||
+ | |||
+ | *[[General Operations]] | ||
+ | *[[Special Subroutines]] | ||
+ | *[[Special Vector manipulations]] | ||
+ | |||
+ | |||
+ | ===Class Specific Operations=== | ||
+ | |||
+ | *[[IXFmake_dataset_2d]] | ||
+ | *[[IXFgetei_dataset_2d]] | ||
+ | *[[IXFmoments_dataset_2d]] | ||
+ | *[[IXFunits_dataset_2d]] | ||
+ | |||
+ | |||
+ | ===rebinning operations=== | ||
+ | |||
+ | *[[IXFrebin_x_dataset_2d]] | ||
+ | *[[IXFrebin_y_dataset_2d]] | ||
+ | *[[IXFrebin_xy_dataset_2d]] | ||
+ | |||
+ | |||
+ | ===rebunching operations=== | ||
+ | |||
+ | *[[IXFrebunch_x_dataset_2d]] | ||
+ | *[[IXFrebunch_y_dataset_2d]] | ||
+ | *[[IXFrebunch_xy_dataset_2d]] | ||
+ | |||
+ | |||
+ | ===regrouping operations=== | ||
+ | |||
+ | *[[IXFregroup_x_dataset_2d]] | ||
+ | *[[IXFregroup_y_dataset_2d]] | ||
+ | *[[IXFregroup_xy_dataset_2d]] | ||
+ | |||
+ | |||
+ | ===integration operations=== | ||
+ | |||
+ | *[[IXFintegrate_x_dataset_2d]] | ||
+ | *[[IXFintegrate_y_dataset_2d]] | ||
+ | *[[IXFintegrate_xy_dataset_2d]] | ||
+ | |||
+ | |||
+ | ===numerical derivatives=== | ||
+ | |||
+ | *[[IXFderiv1x_dataset_2d]] | ||
+ | *[[IXFderiv1y_dataset_2d]] | ||
+ | *[[IXFderiv2x_dataset_2d]] | ||
+ | *[[IXFderiv2y_dataset_2d]] | ||
+ | *[[IXFshift_dataset_2d]] | ||
+ | *[[IXFcontract_arrayd2d_dataset_2d]] | ||
+ | *[[IXFexpand_arrayd2d_dataset_2d]] | ||
+ | *[[IXFexpand_arrayd1d_dataset_2d]] |
Latest revision as of 15:06, 18 January 2010
An IXTdataset_2d is an object that stores signal and error data against two independent dimensions (the x and y axes). Title and label information is also stored. These are used for manipulating and visualising a single spectrum.
Two dimensional plotting can be used to visualise the data and many functions exist to manipulate it given in the user manual
Fields
IXTdataset_2d objects contain the following fields
Field | Type | Description |
---|---|---|
base | IXTbase | Object required for internal use |
title | char(allocatable) | Title of the dataset used in plotting |
signal | real(ptr) | Signal data |
error | real(ptr) | Standard error |
s_axis | IXTaxis | object containing the signal axis label and units code information |
x | real(ptr) | First independent variable data (i.e. x data). If point data this will be the point positions in the x axis. If histogram data, this will be the bin boundaries in the x axis |
x_axis | IXTaxis | object containing the x axis label and units code information |
x_distribution | logical | True if signal is a distribution on x (e.g. counts/microsecond) False if signal is not a distribution on x (e.g. counts) |
y | real(ptr) | Second independent variable data (i.e. y data). If point data this will be the point positions in the y axis. If histogram data, this will be the bin boundaries in the y axis |
y_axis | IXTaxis | object containing the y axis label and units code information |
y_distribution | logical | True if signal is a distribution on y (e.g. counts/spectrum) False if signal is not a distribution on y (e.g. counts) |
Constructing an IXTdataset_2d Object
The constructor for an IXTdataset_2d can be used to create a full IXTdataset_2d object using the following syntax
>> ww = IXTdataset_2d(base, 'title', [signal], [error], s_axis,... [x], x_axis, [x_distribution], [y], y_axis, y_distribution )
- Size(signal,1), size(error,1), Length(x) must all be equal
- Size(signal,2), size(error,2), Length(y) must all be equal
- x and y must be one dimensional arrays
- Signal and error must be two dimensional arrays of size (length(x), length(y))
- s_axis, x_axis and y_axis must be properly constructed IXTaxis objects
- x_distribution and y_distribution must be a logical value (1 or 0, TRUE or FALSE)
- base must be a properly constructed IXTbase object
Datasets without title and label information may be constructed using the syntax
>> ww = IXTdataset_2d(x, y, signal, error)
- signal and error may be omitted. If so, w.signal and/or w.error will contain an array of 0's matching the dimensions of the x data
- Title, s_axis, x_axis and y_axis will contain blank objects
- x_distribution and y_distribution will be FALSE
datasets can also be made using commands found in input and output functions
Changing Values in an IXTdataset_2d object
The fields in the object are accessible on the matlab command line. Therefore the values of the fields can be changed easily, for instance
>> ww.title = 'mytitle'
will set the title in w to 'mytitle'
Examples
Two Identical Scripts to Construct an IXTdataset_2d From a Function
Here, assume that a function my_func is some unusual function of the form
function z = my_polynom2D(x, y, pin)
z = pin(1).*x.^6 + pin(2).*y.*sin(x) + pin(3).*x
The function
x = 1:300
y = 1:2:60
[xm, ym] = ndgrid(y, x)
z = my_polynom2D(xm, ym, [2, 3, 2]) % generate z values
title = 'my unusual function'
xaxis = IXTaxis('x')
yaxis = IXTaxis('y')
zaxis = IXTaxis('z')
e = zeros(size(z)) % need error values for full construction
w = IXTdataset_2d(IXTbase, title, z, e, zaxis, x, xaxis, false, y, yaxis, false)
dl(w) % plot the data
gives the same results as the function
x = 1:300
y = 1:2:60
w = IXTdataset_2d(x, y) % create dataset with blank signal and e values
w.title = 'my unusual function'
w.x_axis = IXTaxis('x')
w.y_axis = IXTaxis('y')
w.s_axis = IXTaxis('z')
w = func_eval(w,@my_polynom2D, [2 3 2])
dl(w)
F90 syntax
use IXMdataset_2d type(IXTdataset_2d):: data2d type(IXTstatus):: status
Fortran Operations
The following operations may be performed on this data type:
Class Specific Operations
rebinning operations
rebunching operations
regrouping operations
integration operations