void REIXSXESScanController::onScanFinished() { scanProgressTimer_.stop(); disconnect(&scanProgressTimer_, SIGNAL(timeout()), this, SLOT(onScanProgressCheck())); disconnect(REIXSBeamline::bl()->mcpDetector(), SIGNAL(imageDataChanged()), this, SLOT(onNewImageValues())); saveRawData(); setFinished(); }
sp<Retval> MonPacket::draw(int num, sp<info>& info, sp<MonBase>& thiz , const char* path) { sp<Retval> retval; if( DFW_RET(retval, saveRawData(num, info, thiz, path)) ) return DFW_RETVAL_D(retval); return NULL; }
void REIXSXESScanController::onScanProgressCheck() { int secondsElapsed = startTime_.secsTo(QDateTime::currentDateTime()); if(secondsElapsed > config_->maximumDurationSeconds()) { onScanFinished(); return; } int totalCounts = int(REIXSBeamline::bl()->mcpDetector()->totalCounts()); // Check if total counts is reached. // problem: What if this occurs before the detector is done clearing itself? could be spurious? To solve this problem simply, just make sure we collect at least 5 seconds regardless of the total counts. if(secondsElapsed > 5 && totalCounts > config_->maximumTotalCounts()) { onScanFinished(); return; } double timeProgress = double(secondsElapsed) / config_->maximumDurationSeconds(); double countsProgress = double(totalCounts) / config_->maximumTotalCounts(); // emit based on whichever looks more promising to happen first... if(countsProgress > timeProgress) { // more likely to hit max counts first emit progress(totalCounts, config_->maximumTotalCounts()); double timeLeft = (config_->maximumTotalCounts()-totalCounts) * (double(secondsElapsed)/totalCounts); emit timeRemaining(timeLeft); } else { emit progress(secondsElapsed, config_->maximumDurationSeconds()); emit timeRemaining(config_->maximumDurationSeconds() - secondsElapsed); } // every 5 seconds, save the raw data to disk. /// \todo Make this a define adjustable if(secondsElapsed % 5 == 0) { saveRawData(); } }