Difference between revisions of "IXTdataset 1d"
m |
m (→Examples) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
An IXTdataset_1d is an object that stores signal and error data against one independent dimension (the x axis). Title and label information is also stored. These are used for manipulating and visualising a single spectrum. | An IXTdataset_1d is an object that stores signal and error data against one independent dimension (the x axis). Title and label information is also stored. These are used for manipulating and visualising a single spectrum. | ||
+ | |||
[[Plot Commands#One Dimensional Plots|One dimensional plotting]] can be used to visualise the data and many functions exist to manipulate it given in the [[User Manual|user manual]] | [[Plot Commands#One Dimensional Plots|One dimensional plotting]] can be used to visualise the data and many functions exist to manipulate it given in the [[User Manual|user manual]] | ||
+ | |||
==Fields== | ==Fields== | ||
+ | |||
IXTdataset_1d objects contain the following fields | IXTdataset_1d objects contain the following fields | ||
Line 12: | Line 15: | ||
|- | |- | ||
! {{Headcellstyle}} | Field | ! {{Headcellstyle}} | Field | ||
+ | !{{Headcellstyle}} | Type | ||
! {{Headcellstyle}} | Description | ! {{Headcellstyle}} | Description | ||
|- | |- | ||
− | |'''[[IXTbase]] | + | |'''base''' |
+ | | [[IXTbase]] | ||
| Object required for internal use | | Object required for internal use | ||
|- | |- | ||
|'''title''' | |'''title''' | ||
+ | | char(allocatable) | ||
| Title of the dataset used in [[Plot Commands|plotting]] | | Title of the dataset used in [[Plot Commands|plotting]] | ||
|- | |- | ||
|'''signal''' | |'''signal''' | ||
+ | | real(ptr) | ||
| Signal data | | Signal data | ||
|- | |- | ||
|'''error''' | |'''error''' | ||
+ | | real(ptr) | ||
| Standard error | | Standard error | ||
|- | |- | ||
|'''s_axis''' | |'''s_axis''' | ||
− | | [[IXTaxis]] object containing the signal axis label and units code information | + | | [[IXTaxis]] |
+ | | object containing the signal axis label and units code information | ||
|- | |- | ||
|'''x''' | |'''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''' | |'''x_axis''' | ||
− | | [[IXTaxis]] object containing the x axis label and units code information | + | | [[IXTaxis]] |
+ | | object containing the x axis label and units code information | ||
|- | |- | ||
|'''x_distribution''' | |'''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) | | True if signal is a distribution on x (e.g. counts/microsecond) False if signal is not a distribution on x (e.g. counts) | ||
|} | |} | ||
+ | |||
+ | |||
==Constructing an IXTdataset_1d Object== | ==Constructing an IXTdataset_1d Object== | ||
− | |||
− | <pre> w = IXTdataset_1d(base, 'title', [signal], [error], s_axis, [x], x_axis, [x_distribution])</pre> | + | The constructor for an IXTdataset_1d can be used to create a full IXTdataset_1d object using the following syntax |
+ | |||
+ | <pre>>> w = IXTdataset_1d(base, 'title', [signal], [error], s_axis, [x], x_axis, [x_distribution])</pre> | ||
* Length(signal), Length(error), Length(x) must all be equal | * Length(signal), Length(error), Length(x) must all be equal | ||
Line 56: | Line 71: | ||
* 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 | * 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 and x_axis will contain blank objects |
+ | * x_distribution will be FALSE | ||
+ | |||
+ | |||
+ | datasets can also be made using commands found in [[Input and Output Functions|input and output functions]] | ||
+ | |||
+ | |||
+ | |||
+ | ==Changing Values in an IXTdataset_1d 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 | ||
+ | |||
+ | <pre>>> w.title = 'mytitle'</pre> | ||
+ | |||
+ | will set the title in w to 'mytitle' | ||
+ | |||
+ | |||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
+ | '''Two Identical Scripts to Construct an IXTdataset_1d From a Function''' | ||
+ | |||
+ | |||
+ | Here, assume that a function my_func is some unusual function of the form | ||
+ | |||
+ | <tt>function y = my_polynom(x, pin) | ||
+ | |||
+ | y = pin(1).*x.^6 + pin(2).*x.*sin(x) + pin(3).*x</tt> | ||
+ | |||
+ | |||
+ | The function | ||
+ | |||
+ | |||
+ | <tt>x = 1:300 | ||
+ | |||
+ | y = my_func(x, [2, 3, 2]) % generate y values | ||
+ | |||
+ | title = 'my unusual function' | ||
+ | |||
+ | xaxis = [[IXTaxis]]('Independent Variable') | ||
+ | |||
+ | yaxis = [[IXTaxis]]('Dependent Variable') | ||
+ | |||
+ | e = zeros(size(x)) % need error values for full construction | ||
+ | |||
+ | w = IXTdataset_1d(IXTbase, title, y, e, yaxis, x, xaxis, false) | ||
+ | |||
+ | [[Plot Commands|dl]](w) % plot the data</tt> | ||
+ | |||
+ | |||
+ | gives the same results as | ||
+ | |||
+ | |||
+ | <tt>x = 1:300 | ||
+ | |||
+ | w = IXTdataset_1d(x) % create dataset with blank y and e values | ||
+ | |||
+ | w.title = 'my unusual function' | ||
+ | |||
+ | w.x_axis = [[IXTaxis]]('Independent Variable') | ||
+ | |||
+ | w.s_axis = [[IXTaxis]]('Dependent Variable') | ||
+ | |||
+ | w = [[High Level Functions#Function Evaluation|func_eval]](w,my_polynom(x,[2 3 2])) or w = [[High Level Functions#Function Evaluation|func_eval]](w,@my_polynom,[2 3 2]) | ||
+ | |||
+ | [[Plot Commands|dl]](w)</tt> | ||
+ | |||
+ | ==F90 Syntax== | ||
+ | |||
+ | <pre>use IXMdataset_1d | ||
+ | |||
+ | type(IXTdataset_1d):: dataset_1d | ||
+ | type(IXTstatus):: status</pre> | ||
+ | |||
+ | |||
+ | ==Fortran Operations== | ||
+ | |||
+ | The following operations may be performed on this data type: | ||
+ | |||
+ | *[[General Operations]] | ||
+ | *[[Special Subroutines]] | ||
+ | |||
+ | |||
+ | ===Class Specific Operations=== | ||
+ | |||
+ | *[[IXFmake_dataset_1d]] | ||
+ | *[[IXFintegrate_dataset_1d]] | ||
+ | *[[IXFrebunch_dataset_1d]] | ||
+ | *[[IXFrebin_dataset_1d]] | ||
+ | *[[IXFregroup_dataset_1d]] | ||
+ | *[[IXFshift_dataset_1d]] | ||
+ | *[[IXFderiv1_dataset_1d]] | ||
+ | *[[IXFderiv2_dataset_1d]] | ||
+ | *[[IXFcatarray_dataset_1d]] | ||
+ | *[[IXFunits_dataset_1d]] | ||
+ | *[[IXFcreatexye_dataset_1d]] |
Latest revision as of 10:05, 18 January 2010
An IXTdataset_1d is an object that stores signal and error data against one independent dimension (the x axis). Title and label information is also stored. These are used for manipulating and visualising a single spectrum.
One dimensional plotting can be used to visualise the data and many functions exist to manipulate it given in the user manual
Fields
IXTdataset_1d 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) |
Constructing an IXTdataset_1d Object
The constructor for an IXTdataset_1d can be used to create a full IXTdataset_1d object using the following syntax
>> w = IXTdataset_1d(base, 'title', [signal], [error], s_axis, [x], x_axis, [x_distribution])
- Length(signal), Length(error), Length(x) must all be equal
- signal, error and x must be one dimensional arrays
- s_axis and x_axis must be properly constructed IXTaxis objects
- x_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
w = IXTdataset_1d(x, 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 and x_axis will contain blank objects
- x_distribution will be FALSE
datasets can also be made using commands found in input and output functions
Changing Values in an IXTdataset_1d 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
>> w.title = 'mytitle'
will set the title in w to 'mytitle'
Examples
Two Identical Scripts to Construct an IXTdataset_1d From a Function
Here, assume that a function my_func is some unusual function of the form
function y = my_polynom(x, pin)
y = pin(1).*x.^6 + pin(2).*x.*sin(x) + pin(3).*x
The function
x = 1:300
y = my_func(x, [2, 3, 2]) % generate y values
title = 'my unusual function'
xaxis = IXTaxis('Independent Variable')
yaxis = IXTaxis('Dependent Variable')
e = zeros(size(x)) % need error values for full construction
w = IXTdataset_1d(IXTbase, title, y, e, yaxis, x, xaxis, false)
dl(w) % plot the data
gives the same results as
x = 1:300
w = IXTdataset_1d(x) % create dataset with blank y and e values
w.title = 'my unusual function'
w.x_axis = IXTaxis('Independent Variable')
w.s_axis = IXTaxis('Dependent Variable')
w = func_eval(w,my_polynom(x,[2 3 2])) or w = func_eval(w,@my_polynom,[2 3 2])
dl(w)
F90 Syntax
use IXMdataset_1d type(IXTdataset_1d):: dataset_1d type(IXTstatus):: status
Fortran Operations
The following operations may be performed on this data type: