修改符合能谱加载动画控制

This commit is contained in:
徐海 2026-05-13 10:37:38 +08:00
parent 653ee44f1a
commit b3c78ad0d3

View File

@ -86,10 +86,10 @@ void ConformToTheEnergySpectrum::SetAnalyzeDataFilename(const QMap<QString, QVar
void ConformToTheEnergySpectrum::loadAndProcess()
{
_busy_indicator->Start();
auto functionToRun = [this]() {
if (_data_filename.isEmpty()) return;
_busy_indicator->Start();
if (_data_filename.isEmpty())
return;
std::vector<SpectrumData> rawData;
io::CSVReader<4> in(QStrToSysPath(_data_filename));
@ -112,34 +112,16 @@ void ConformToTheEnergySpectrum::loadAndProcess()
}
if (rawData.empty()) {
_busy_indicator->Stop();
QMetaObject::invokeMethod(this, [this]() {
_busy_indicator->Stop();
}, Qt::QueuedConnection);
return;
}
// const uint64_t TIME_WINDOW_NS = 50;
// const int MIN_ORDER = 2;
// const int MAX_ORDER = 9;
// std::vector<CoincidenceEvent> coincidences = processCoincidence(rawData, TIME_WINDOW_NS, MIN_ORDER, MAX_ORDER);
// if (coincidences.empty()) {
// _busy_indicator->Stop();
// return;
// }
// const int STEP = 1;
// std::map<int, double> hist;
// for (const auto& ev : coincidences) {
// for (const auto& spdt : ev.events) {
// int idx = static_cast<int>(spdt.energy) / STEP;
// hist[idx] += 1.0;
// }
// }
const int STEP = 1;
std::map<int, double> hist;
for (const auto& spdt : rawData) {
for (const SpectrumData& spdt : rawData) {
int idx = static_cast<int>(spdt.energy) / STEP;
hist[idx] += 1.0;
}
@ -151,7 +133,9 @@ void ConformToTheEnergySpectrum::loadAndProcess()
}
if (vx.isEmpty()) {
_busy_indicator->Stop();
QMetaObject::invokeMethod(this, [this]() {
_busy_indicator->Stop();
}, Qt::QueuedConnection);
return;
}