IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
dataio_txt_dpt.m
Go to the documentation of this file.
1 %> @brief DPT TXT *loader* only
2 %>
3 %> DPT - Data Points Table
4 %>
5 %> Format saved by OPUS. First column is wavenumbers, then subsequence columns
6 %> are spectra.
7 %>
8 %> </ul>
10  properties
11  %> (optional) Image height. If specified, will assign it the loaded dataset
12  height = [];
13  %> ='hor'. Whether the pixels are taken horizontally ('hor') or vertically ('ver') to form the image.
14  %> It was found that OPUS numbers the point in the image map left-right, bottom-up, hence 'hor'.
15  %> Same as irdata.direction (although irdata.direction has a different default).
16  direction = 'hor';
17  end;
18 
19 
20  methods
21  function o = dataio_txt_dpt()
22  o.flag_params = 1; % uip_data_txt.dpt.(fig/m)
23  end;
24 
25  %> Loader
26  function ds = load(o)
27  Q = load(o.filename);
28  fea_x = Q(:, 1)';
29  X = Q(:, 2:end)';
30 
31 
32  ds = irdata();
33  ds.filename = o.filename;
34  ds.filetype = 'txt_dpt';
35  ds.X = X;
36  mask = ['p%0', int2str(ceil(log10(ds.no))), 'd'];
37  ds.obsnames = arrayfun(@(i) sprintf(mask, i), (0:ds.no-1)', 'UniformOutput', 0);
38  ds.fea_x = fea_x;
39  ds = ds.assert_fix();
40  if ~isempty(o.height)
41  ds.height = o.height;
42  ds.direction = o.direction;
43  end;
44  ds.assert_not_nan();
45  end;
46 
47  %> Saver
48  function o = save(o, data)
49  irerror('Sorry, DPT saving not supported at the moment.');
50  end;
51  end
52 end
function irerror(in s)
Dataset class.
Definition: irdata.m:30
Dataset loader/saver common class.
Definition: dataio.m:2
Analysis Session (AS) base class.
Definition: as.m:6
DPT TXT loader only.
Definition: dataio_txt_dpt.m:9