Special Functions

From LIBISIS
Jump to navigation Jump to search

Some special functions exist that are useful when writing scripts that use Libisis


Contract Functions

These functions are used to contract an array of datasets into a single dataset.

>> wwout = contract(ww)
  • ww is an array of IXTdataset_2d objects
  • wwout is a single IXTdataset_2d object
  • Two datasets must have matching x dimensions
  • Each element of ww will be appended to the y dimension in the previous ww

For instance, if a dataset has ww(1).x = [1, 2, 3, 4] ww(1).y = [1, 2, 3, 4] ww(2).x = [1, 2, 3, 4] ww(2).y = [6, 7, 8] then wwout will be a dataset with wwout.x = [1, 2, 3, 4] and wwout.y = [1, 2, 3, 4, 6, 7, 8].


Expand Functions

These functions are used to expand a single IXTdataset_2d into an array of datasets.

>> wwout = expand_d2d(ww)
>>wwout = expand_listd2d(ww, list)
  • Input is an IXTdataset_2d object
  • Output is an IXTdataset_2d object
  • Output will be an array, each element containing just one y value
  • If list is given, only the y indicies in list will be expanded

For instance, if a dataset ww has y values ww.y = [32, 44, 55, 66] and list was [2, 3] then wwout will be a 2 element array of IXTdataset_2d objects with wwout(1).y = 44 and wwout(2).y = 55

>> wout = expand_d1d(ww)
>> wout = expand_listd1d(ww, list)
  • Input is an IXTdataset_2d object
  • Output is an IXTdataset_1d object
  • Output will be an array, each element pertaining to one y row in the input
  • If list is give, only the y indicies in list will be expanded


Conversion Functions

Conversion functions convert from one object type or data type to another

>> wwout = oned_to_twod(w)
  • Input is an array of IXTdataset_1d objects
  • Output is an IXTdataset_2d object or array of IXTdataset_2d objects
  • Output will contain one y row for each element of the input
  • y values will be [1, 2, 3 ...]
  • x values in output will be the same as input
  • Signal values in output will be the same as input
  • If possible, the output dataset will be contracted to a single IXTdataset_2d object
>> wout = hist2point(w)
>> wwout = hist2point_x(ww)
>> wwout = hist2point_y(ww)
  • Converts one dimension (x or y) from histogram data to point data


Functions to Aid Plotting

Standard functions exist to help with plotting

>>[xlab, ylab] = make_label(w)
>> [xlab, ylab, zlab] = make_label(ww)
  • xlab is the label for the x axis
  • ylab is the label for the y axis
  • zlab is the label for the z axis
  • w is an IXTdataset_1d object
  • ww is an IXTdataset_2d object


Noisify

Noisify is a function used to add random noise to a dataset. It is good for testing fit functions etc.


>> w= noisify(w)
>> w = noisify(w, factor)
>> w = noisify(w,'poison')


  • w may be an IXTdataset_1d or IXTdataset_2d object
  • Output will be the same as input
  • Noise will have a gaussian distribution unless given the 'poison' command
  • Standard deviation = factor * (maximum signal value)
  • Default factor is 0.1
  • Mean value at a point in the poison distribution method is the y value.