mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya
This commit is contained in:
@ -51,11 +51,6 @@ Result<uint32_t> Detector::getRegister(uint32_t addr, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::readRegister, pos, addr);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
-1);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getStartingFrameNumber(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getStartingFrameNumber, pos);
|
||||
}
|
||||
@ -63,29 +58,6 @@ void Detector::setStartingFrameNumber(uint64_t value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setStartingFrameNumber, pos, value);
|
||||
}
|
||||
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, -1);
|
||||
}
|
||||
|
||||
void Detector::setSubExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, -1);
|
||||
}
|
||||
|
||||
void Detector::setPeriod(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, t.count());
|
||||
}
|
||||
|
||||
// File
|
||||
void Detector::setFileName(const std::string &fname, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setFileName, pos, fname);
|
||||
@ -170,8 +142,8 @@ Result<std::string> Detector::getDetectorTypeAsString(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos);
|
||||
}
|
||||
|
||||
int Detector::getTotalNumberOfDetectors() const {
|
||||
return pimpl->getNumberOfDetectors();
|
||||
int Detector::size() const {
|
||||
return pimpl->size();
|
||||
}
|
||||
|
||||
defs::coordinates Detector::getNumberOfDetectors() const {
|
||||
@ -393,6 +365,24 @@ void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
-1);
|
||||
}
|
||||
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, -1);
|
||||
}
|
||||
|
||||
void Detector::setPeriod(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getDelayAfterTrigger(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::DELAY_AFTER_TRIGGER, -1);
|
||||
@ -403,12 +393,22 @@ void Detector::setDelayAfterTrigger(ns value, Positions pos) {
|
||||
value.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubFrameDeadTime(Positions pos) const {
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, -1);
|
||||
}
|
||||
|
||||
void Detector::setSubExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubDeadTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
|
||||
-1);
|
||||
}
|
||||
|
||||
void Detector::setSubFrameDeadTime(ns value, Positions pos) {
|
||||
void Detector::setSubDeadTime(ns value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
|
||||
value.count());
|
||||
}
|
||||
@ -423,6 +423,46 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
value.count());
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFramesLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_NUMBER);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfCyclesLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::CYCLES_NUMBER);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACQUISITION_TIME);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_PERIOD);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::DELAY_AFTER_TRIGGER);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFramesFromStart(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAMES_FROM_START);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getActualTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACTUAL_TIME);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASUREMENT_TIME);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getMeasuredPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_PERIOD);
|
||||
};
|
||||
|
||||
Result<ns> Detector::getMeasuredSubFramePeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_SUBPERIOD);
|
||||
};
|
||||
|
||||
// Erik
|
||||
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
|
||||
@ -635,8 +675,8 @@ Result<bool> Detector::getAutoCompDisable(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setPowerChip(bool on, Positions pos) {
|
||||
if (on && pimpl->getNumberOfDetectors() > 3) {
|
||||
for (int i = 0; i != pimpl->getNumberOfDetectors(); ++i) {
|
||||
if (on && pimpl->size() > 3) {
|
||||
for (int i = 0; i != pimpl->size(); ++i) {
|
||||
pimpl->powerChip(static_cast<int>(on), i);
|
||||
usleep(1000 * 1000);
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getNumberOfDetectors() const { return detectors.size(); }
|
||||
int multiSlsDetector::size() const { return detectors.size(); }
|
||||
|
||||
int multiSlsDetector::getNumberOfDetectors(dimension d) const {
|
||||
return multi_shm()->numberOfDetector[d];
|
||||
@ -747,7 +747,7 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int detPos) {
|
||||
|
||||
int multiSlsDetector::getQuad(int detPos) {
|
||||
int retval = detectors[0]->getQuad();
|
||||
if (retval && getNumberOfDetectors() > 1) {
|
||||
if (retval && size() > 1) {
|
||||
throw RuntimeError("Quad type is available only for 1 Eiger Quad Half "
|
||||
"module, but it Quad is enabled for 1st readout");
|
||||
}
|
||||
@ -755,7 +755,7 @@ int multiSlsDetector::getQuad(int detPos) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::setQuad(const bool enable, int detPos) {
|
||||
if (enable && getNumberOfDetectors() > 1) {
|
||||
if (enable && size() > 1) {
|
||||
throw RuntimeError("Cannot set Quad type as it is available only for 1 "
|
||||
"Eiger Quad Half module.");
|
||||
}
|
||||
@ -2238,7 +2238,7 @@ void multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
||||
ymin = roiLimits[i].ymin;
|
||||
ymax = roiLimits[i].ymax;
|
||||
|
||||
if (getNumberOfDetectors() > 1) {
|
||||
if (size() > 1) {
|
||||
// check roi max values
|
||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
||||
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
||||
@ -2885,7 +2885,7 @@ int multiSlsDetector::powerChip(int ival, int detPos) {
|
||||
}
|
||||
|
||||
// multi delayed call for safety
|
||||
if (ival >= 0 && getNumberOfDetectors() > 3) {
|
||||
if (ival >= 0 && size() > 3) {
|
||||
std::vector<int> r;
|
||||
r.reserve(detectors.size());
|
||||
for (auto &d : detectors) {
|
||||
@ -4160,34 +4160,19 @@ void multiSlsDetector::registerDataCallback(
|
||||
}
|
||||
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = 1, nc = 1, ns = 1;
|
||||
|
||||
Result<int64_t> temp = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1);
|
||||
if (!temp.equal()) {
|
||||
throw RuntimeError("Inconsistent number of frames");
|
||||
}
|
||||
nf = temp.squash();
|
||||
|
||||
temp = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1);
|
||||
if (!temp.equal()) {
|
||||
throw RuntimeError("Inconsistent number of cycles");
|
||||
}
|
||||
nc = temp.squash();
|
||||
|
||||
if (getDetectorTypeAsEnum() == JUNGFRAU) {
|
||||
temp = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1);
|
||||
if (!temp.equal()) {
|
||||
throw RuntimeError("Inconsistent number of additional storage cells");
|
||||
}
|
||||
ns = temp.squash() + 1;
|
||||
}
|
||||
|
||||
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1).tsquash("Inconsistent number of frames");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1).tsquash("Inconsistent number of cycles");
|
||||
if (nf == 0 || nc == 0) {
|
||||
throw RuntimeError("Number of frames or cycles is 0");
|
||||
}
|
||||
|
||||
totalProgress = nf * nc * ns;
|
||||
int ns = 1;
|
||||
if (getDetectorTypeAsEnum() == JUNGFRAU) {
|
||||
ns = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1).tsquash("Inconsistent number of additional storage cells");
|
||||
++ns;
|
||||
}
|
||||
|
||||
totalProgress = nf * nc * ns;
|
||||
FILE_LOG(logDEBUG1) << "nf " << nf << " nc " << nc << " ns " << ns;
|
||||
FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
|
||||
return totalProgress;
|
||||
|
@ -2175,7 +2175,7 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[],
|
||||
if (action == HELP_ACTION) {
|
||||
return helpAcquire(HELP_ACTION);
|
||||
}
|
||||
if (!myDet->getNumberOfDetectors()) {
|
||||
if (!myDet->size()) {
|
||||
FILE_LOG(logERROR) << "This shared memory has no detectors added. Aborting.";
|
||||
return std::string("acquire failed");
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
|
||||
|
||||
int slsDetectorUsers::getNumberOfDetectors() const {
|
||||
return detector.getNumberOfDetectors();
|
||||
int slsDetectorUsers::size() const {
|
||||
return detector.size();
|
||||
}
|
||||
|
||||
int slsDetectorUsers::getMaximumDetectorSize(int &nx, int &ny){
|
||||
|
Reference in New Issue
Block a user