[Kst] branches/work/kst/1.5/kst/src/datasources/scuba2
Andrew Walker
arwalker at sumusltd.com
Fri Sep 7 02:13:40 CEST 2007
SVN commit 709266 by arwalker:
add support for data mode 6 to scuba2 datasource
M +67 -48 scuba.cpp
M +9 -1 scuba.h
--- branches/work/kst/1.5/kst/src/datasources/scuba2/scuba.cpp #709265:709266
@@ -385,10 +385,7 @@
_metaData.insert(metaName, metaString);
}
- if (s.compare(END_HEADER_1) == 0) {
- done = true;
- rc = true;
- } else if (s.contains("data_mode") == 1) {
+ if (s.contains("data_mode") == 1) {
index = s.find(QChar('>'));
scopy = s;
s.remove(0, index+1);
@@ -427,14 +424,7 @@
}
foundNumRows = true;
} else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
- index = s.find(QChar('>'));
- s.remove(0, index+1);
- s.stripWhiteSpace();
- s.remove(5, s.length());
- _version = s.toInt(&ok, 10);
- if (!ok) {
- _version = -1;
- }
+ _version = readVersionNumber(s);
foundVersion = true;
} else if (s.contains("<RC>") == 1) {
index = s.find(QChar('>'));
@@ -797,6 +787,7 @@
case DataRaw:
break;
case Data18_14:
+ case DataFiltered18_14:
if (!error) {
lvalue /= 0x4000;
} else {
@@ -882,6 +873,7 @@
case DataRaw:
break;
case Data18_14:
+ case DataFiltered18_14:
if (!error) {
lvalue /= 0x4000;
} else {
@@ -997,29 +989,30 @@
int index;
if (str.find("Error") != -1) {
- str.remove("Error");
isError = true;
- } else {
- str.remove("Pixel");
}
- str.remove(0,1);
index = str.find(QChar('_'));
+ if (index != -1) {
+ str.remove(0, index+1);
+ index = str.find(QChar('_'));
+ if (index != -1) {
+ //
+ // find the column index, the second value...
+ //
+ strRowCol = str;
+ strRowCol.remove(0, index+1);
+ colIndex = strRowCol.toInt(&ok, 10);
- //
- // find the column index, the second value...
- //
- strRowCol = str;
- strRowCol.remove(0, index+1);
- colIndex = strRowCol.toInt(&ok, 10);
-
- if (ok) {
- //
- // find the row index, the first value...
- //
- strRowCol = str;
- strRowCol.remove(index, str.length());
- rowIndex = strRowCol.toInt(&ok, 10);
+ if (ok) {
+ //
+ // find the row index, the first value...
+ //
+ strRowCol = str;
+ strRowCol.remove(index, str.length());
+ rowIndex = strRowCol.toInt(&ok, 10);
+ }
+ }
}
//
@@ -1036,14 +1029,13 @@
// determine the field index...
//
if (_version > 111 && _format == FormatBinary) {
- fieldIndex = rowIndex * _datamodes.size() * COLUMNS_PER_READOUTCARD;
+ fieldIndex = rowIndex * _readoutCards.size() * COLUMNS_PER_READOUTCARD;
fieldIndex += colIndex;
} else {
fieldIndex = _numRows * ( colIndex / COLUMNS_PER_READOUTCARD );
fieldIndex += rowIndex * COLUMNS_PER_READOUTCARD;
fieldIndex += colIndex % COLUMNS_PER_READOUTCARD;
}
-
fieldIndex += _numHousekeepingFieldsInUse;
}
}
@@ -1116,6 +1108,7 @@
break;
case Data18_14:
case Data24_8:
+ case DataFiltered18_14:
file.at(_frameIndex[(s + i)/iSamplesPerFrame]);
valueIndex = fieldIndex - _numHousekeepingFieldsInUse;
break;
@@ -1136,6 +1129,7 @@
lvalue &= 0xFF;
break;
case Data18_14:
+ case DataFiltered18_14:
if (!isError) {
lvalue /= 0x4000;
} else {
@@ -1217,6 +1211,7 @@
break;
case Data18_14:
case Data24_8:
+ case DataFiltered18_14:
file.at(_frameIndex[(s + i)/iSamplesPerFrame]);
valueIndex = fieldIndex - _numHousekeepingFieldsInUse;
break;
@@ -1246,6 +1241,7 @@
lvalue &= 0xFF;
break;
case Data18_14:
+ case DataFiltered18_14:
if (!isError) {
lvalue /= 0x4000;
} else {
@@ -1429,14 +1425,7 @@
}
foundNumRows = true;
} else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
- index = s.find(QChar('>'));
- s.remove(0, index+1);
- s.stripWhiteSpace();
- s.remove(5, s.length());
- version = s.toInt(&ok, 10);
- if (!ok) {
- version = -1;
- }
+ version = readVersionNumber(s);
foundVersion = true;
} else if (s.contains("<RC>") == 1) {
readoutCards.clear();
@@ -1544,6 +1533,10 @@
rc += QString("Pixel_%1_%2").arg(row).arg(col);
rc += QString("Error_%1_%2").arg(row).arg(col);
break;
+ case DataFiltered18_14:
+ rc += QString("Pixel_%1_%2").arg(row).arg(col);
+ rc += QString("Error_%1_%2").arg(row).arg(col);
+ break;
default:
break;
}
@@ -1576,6 +1569,10 @@
rc += QString("Pixel_%1_%2").arg(i).arg(j);
rc += QString("Error_%1_%2").arg(i).arg(j);
break;
+ case DataFiltered18_14:
+ rc += QString("Pixel_%1_%2").arg(i).arg(j);
+ rc += QString("Error_%1_%2").arg(i).arg(j);
+ break;
default:
break;
}
@@ -1676,14 +1673,7 @@
}
foundNumRows = true;
} else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
- index = s.find(QChar('>'));
- s.remove(0, index+1);
- s.stripWhiteSpace();
- s.remove(5, s.length());
- version = s.toInt(&ok, 10);
- if (!ok) {
- version = -1;
- }
+ version = readVersionNumber(s);
foundVersion = true;
} else if (s.contains("<RC>") == 1) {
index = s.find(QChar('>'));
@@ -1824,6 +1814,16 @@
_matrixList += QString("FrameErrorRecentAvg");
_matrixList += QString("FrameErrorRecentMax");
break;
+ case DataFiltered18_14:
+ _matrixList += QString("FramePixelLast");
+ _matrixList += QString("FramePixelRecentAvg");
+ _matrixList += QString("FramePixelRecentMax");
+ _matrixList += QString("FramePixelRecentMin");
+
+ _matrixList += QString("FrameErrorLast");
+ _matrixList += QString("FrameErrorRecentAvg");
+ _matrixList += QString("FrameErrorRecentMax");
+ break;
default:
break;
}
@@ -1847,6 +1847,10 @@
_matrixList += QString("FramePixel_%1").arg(i);
_matrixList += QString("FrameError_%1").arg(i);
break;
+ case DataFiltered18_14:
+ _matrixList += QString("FramePixel_%1").arg(i);
+ _matrixList += QString("FrameError_%1").arg(i);
+ break;
default:
break;
}
@@ -1878,7 +1882,22 @@
return 0;
}
+int ScubaSource::readVersionNumber(QString& s) {
+ int index = s.find(QChar('>'));
+ int version = -1;
+ bool ok;
+ s.remove(0, index+1);
+ s = s.stripWhiteSpace();
+ s.remove(4, s.length());
+ version = s.toInt(&ok, 10);
+ if (!ok) {
+ version = -1;
+ }
+
+ return version;
+}
+
class ConfigWidgetScuba : public KstDataSourceConfigWidget {
public:
ConfigWidgetScuba() : KstDataSourceConfigWidget() {
--- branches/work/kst/1.5/kst/src/datasources/scuba2/scuba.h #709265:709266
@@ -23,7 +23,14 @@
#include <kstdatasource.h>
enum DataFormat { FormatText = 0, FormatBinary, FormatText2 };
-enum DataMode { DataError = 0, DataPreScaleFeedback, DataFiltered, DataRaw, Data18_14, Data24_8, DataInvalid };
+enum DataMode { DataError = 0,
+ DataPreScaleFeedback,
+ DataFiltered,
+ DataRaw,
+ Data18_14,
+ Data24_8,
+ DataFiltered18_14,
+ DataInvalid };
class ScubaSource : public KstDataSource {
public:
@@ -57,6 +64,7 @@
private:
bool initFrameIndex();
void setDataType(QFile& file);
+ static int readVersionNumber(QString& s);
int _datamode;
int _rowLen;
More information about the Kst
mailing list