logger.severe(e.toString());
throw (new IOException(
"Could not read from variable scan_index from file " + file));
}
IndexIterator scanIndexIterator = scanIndexArray.getIndexIterator();
int ind = 0;
while (scanIndexIterator.hasNext()) {
scanStartPositions[ind] = ((Integer) scanIndexIterator.next())
.intValue();
ind++;
}
scanIndexIterator = null;
scanIndexArray = null;
scanIndexVariable = null;
// Calc stop position for the last scan
// This defines the end index of the last scan
scanStartPositions[totalScans] = (int) massValueVariable.getSize();
// Read retention times
double[] retentionTimes = new double[totalScans];
Variable scanTimeVariable = inputFile
.findVariable("scan_acquisition_time");
if (scanTimeVariable == null) {
logger.severe("Could not find variable scan_acquisition_time from file "
+ file);
throw (new IOException(
"Could not find variable scan_acquisition_time from file "
+ file));
}
Array scanTimeArray = null;
try {
scanTimeArray = scanTimeVariable.read();
} catch (Exception e) {
logger.severe(e.toString());
throw (new IOException(
"Could not read from variable scan_acquisition_time from file "
+ file));
}
IndexIterator scanTimeIterator = scanTimeArray.getIndexIterator();
ind = 0;
while (scanTimeIterator.hasNext()) {
if (scanTimeVariable.getDataType().getPrimitiveClassType() == float.class) {
retentionTimes[ind] = ((Double) scanTimeIterator.next()) / 60d;
}
if (scanTimeVariable.getDataType().getPrimitiveClassType() == double.class) {
retentionTimes[ind] = ((Double) scanTimeIterator.next()) / 60d;
}
ind++;
}
scanTimeIterator = null;