UltraScan III
us_dataIO.h
Go to the documentation of this file.
1 #ifndef US_DATAIO_H
3 #define US_DATAIO_H
4 
5 #include <QtCore>
6 #include "us_extern.h"
7 
10 
25 {
26  public:
27 
31  static const uint format_version = 5;
32 
35 
47  {
48  public:
49  QString description;
50  char type;
51  char channel;
52  int cell;
53  double temperature;
54  double rpm;
55  double seconds;
56  double omega2t;
57  double rpoint;
58  int count;
59  bool nz_stddev;
60  QVector< double > xvalues;
61  QVector< double > rvalues;
62  QVector< double > stddevs;
63  };
64 
70  class Scan
71  {
72  public:
73  double temperature;
74  double rpm;
75  double seconds;
76  double omega2t;
77  double wavelength;
78  double plateau;
79  double delta_r;
80  bool nz_stddev;
81  QVector< double > rvalues;
82  QVector< double > stddevs;
83  QByteArray interpolated;
84  };
85 
88  {
89  public:
90  char type[ 2 ];
91  char rawGUID[ 16 ];
92  int cell;
93  char channel;
94  QString description;
95 
96  QVector< double > xvalues;
97  QVector< Scan > scanData;
98 
99  int pointCount ( void );
100  int scanCount ( void );
101  int xindex ( double );
102  double radius ( int );
103  double scWavelength( int );
104  double value ( int, int );
105  double reading ( int, int );
106  bool setValue ( int, int, double );
107  double std_dev ( int, int );
108  double average_temperature() const;
109  double temperature_spread () const;
110  };
111 
113  class SpeedData // For equilibrium sets
114  {
115  public:
118  double speed;
119  double meniscus;
120  double dataLeft;
121  double dataRight;
122  };
123 
129  {
130  public:
131  int scan;
132  int radius;
133  double value;
134  };
135 
141  {
142  public:
145  {
146  excludes .clear();
147  lambdas .clear();
148  editedPoints.clear();
149  invert = 1.0;
150  removeSpikes = false;
151  floatingData = false;
152  noiseOrder = 0;
153  ODlimit = 1.5;
154 
156  airGapLeft = 0.0;
157  airGapRight = 9.0;
158  };
159 
160  QString expType;
161  QList< SpeedData > speedData;
162  QString runID;
163  QString cell;
164  QString channel;
165  QString wavelength;
166  QString editGUID;
167  QString dataGUID;
168  double meniscus;
169  double airGapLeft;
170  double airGapRight;
171  double gapTolerance;
172  double rangeLeft;
173  double rangeRight;
174  double plateau;
175  double baseline;
176  double ODlimit;
177  QList< int > excludes;
178  QList< int > lambdas;
179  QList< EditedPoint > editedPoints;
181  double invert;
184  };
185 
188  {
189  public:
190  QString expType;
191  QList< SpeedData > speedData;
193  QString runID;
194  QString editID;
195  QString dataType;
196  QString cell;
197  QString channel;
198  QString wavelength;
199  QString description;
200  QString editGUID;
201  QString dataGUID;
202  double meniscus;
203  double plateau;
204  double baseline;
205  double ODlimit;
207  QVector< double > xvalues;
208  QVector< Scan > scanData;
209 
210  int pointCount ( void );
211  int scanCount ( void );
212  int xindex ( double );
213  double radius ( int );
214  double scWavelength( int );
215  double value ( int, int );
216  double reading ( int, int );
217  bool setValue ( int, int, double );
218  double std_dev ( int, int );
219  double average_temperature() const;
220  double temperature_spread () const;
221  };
222 
225  {
226  public:
227  QString runID;
228  QString editID;
229  QString dataType;
230  QString cell;
231  QString channel;
232  QString wavelength;
233  QString description;
234  QString editGUID;
235  QString dataGUID;
236  double meniscus;
237  double plateau;
238  double baseline;
239  double ODlimit;
241  QVector< Scan > scanData;
242  };
243 
245  enum ioError { OK, CANTOPEN, BADCRC, NOT_USDATA, BADTYPE, BADXML,
246  NODATA, NO_GUID_MATCH, BAD_VERSION };
247 
252  static bool readLegacyFile( const QString&, BeckmanRawScan& );
253 
259  static int writeRawData( const QString&, RawData& );
260 
265  static int readRawData ( const QString&, RawData& );
266 
271  static int readEdits ( const QString&, EditValues& );
272 
276  static QString errorString ( int );
277 
282  static int index ( const QVector< double >&, double );
283 
288  static int index ( US_DataIO::RawData*, double );
289 
294  static int index ( US_DataIO::EditedData*, double );
295 
305  static int loadData ( const QString&, const QString&,
306  QVector< EditedData >&,
307  QVector< RawData >& );
308 
316  static int loadData ( const QString&, const QString&,
317  QVector< EditedData >& );
318 
326  static int loadData ( const QString&, const QString&,
327  EditedData& );
328 
335  static void adjust_interference( RawData&, const EditValues& );
336 
343  static void calc_integral ( RawData&, const EditValues& );
344 
358  static bool spike_check ( const Scan&, const QVector< double >&,
359  int, int, int, double* );
360 
361  private:
362 
365  {
366  public:
367  double min_data1;
368  double max_data1;
369  double min_data2;
370  double max_data2;
371  };
372 
373  static void writeScan ( QDataStream&, const Scan&, quint32&,
374  const Parameters& );
375  static void write ( QDataStream&, const char*, int, quint32& );
376  static void read ( QDataStream&, char*, int, quint32& );
377 
378  static void ident ( QXmlStreamReader&, EditValues& );
379  static void run ( QXmlStreamReader&, EditValues& );
380  static void all_lambdas( QXmlStreamReader&, EditValues& );
381  static void excludes ( QXmlStreamReader&, EditValues& );
382  static void params ( QXmlStreamReader&, EditValues& );
383  static void operations ( QXmlStreamReader&, EditValues& );
384  static void do_edits ( QXmlStreamReader&, EditValues& );
385  static void copyRange ( double, double, const Scan&, Scan&,
386  const QVector< double >& );
387  static void copyxRange ( double, double,
388  const QVector< double >&, QVector< double >& );
389  static QList< double >
390  calc_residuals( int, const QVector< Scan >& );
391 };
392 #endif