mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
WIP
This commit is contained in:
@ -156,7 +156,7 @@ class DetectorPythonInterface {
|
|||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumberOfDetectors() { return det.getNumberOfDetectors(); }
|
int getNumberOfDetectors() { return det.size(); }
|
||||||
|
|
||||||
std::string getRunStatus() {
|
std::string getRunStatus() {
|
||||||
auto s = det.getRunStatus();
|
auto s = det.getRunStatus();
|
||||||
@ -234,7 +234,7 @@ class DetectorPythonInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setRateCorrection(std::vector<double> tau) {
|
void setRateCorrection(std::vector<double> tau) {
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i)
|
for (size_t i = 0; i < det.size(); ++i)
|
||||||
det.setRateCorrection(tau[i], i);
|
det.setRateCorrection(tau[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ class DetectorPythonInterface {
|
|||||||
|
|
||||||
std::vector<double> getMeasuredPeriod() {
|
std::vector<double> getMeasuredPeriod() {
|
||||||
std::vector<double> mp;
|
std::vector<double> mp;
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_PERIOD, i);
|
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_PERIOD, i);
|
||||||
mp.push_back(static_cast<double>(t) * 1E-9);
|
mp.push_back(static_cast<double>(t) * 1E-9);
|
||||||
}
|
}
|
||||||
@ -342,7 +342,7 @@ class DetectorPythonInterface {
|
|||||||
}
|
}
|
||||||
std::vector<double> getMeasuredSubPeriod() {
|
std::vector<double> getMeasuredSubPeriod() {
|
||||||
std::vector<double> mp;
|
std::vector<double> mp;
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_SUBPERIOD, i);
|
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_SUBPERIOD, i);
|
||||||
mp.push_back(static_cast<double>(t) * 1E-9);
|
mp.push_back(static_cast<double>(t) * 1E-9);
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ class DetectorPythonInterface {
|
|||||||
|
|
||||||
std::vector<std::string> getDetectorType() {
|
std::vector<std::string> getDetectorType() {
|
||||||
std::vector<std::string> detector_type;
|
std::vector<std::string> detector_type;
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
detector_type.push_back(det.getDetectorTypeAsString(i));
|
detector_type.push_back(det.getDetectorTypeAsString(i));
|
||||||
}
|
}
|
||||||
return detector_type;
|
return detector_type;
|
||||||
@ -577,8 +577,8 @@ class DetectorPythonInterface {
|
|||||||
// detectors return a vector of strings
|
// detectors return a vector of strings
|
||||||
std::vector<int> getReceiverStreamingPort() {
|
std::vector<int> getReceiverStreamingPort() {
|
||||||
std::vector<int> vec;
|
std::vector<int> vec;
|
||||||
vec.reserve(det.getNumberOfDetectors());
|
vec.reserve(det.size());
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
vec.push_back(det.getReceiverStreamingPort(i));
|
vec.push_back(det.getReceiverStreamingPort(i));
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
@ -590,8 +590,8 @@ class DetectorPythonInterface {
|
|||||||
|
|
||||||
std::vector<int> getReceiverUDPPort() {
|
std::vector<int> getReceiverUDPPort() {
|
||||||
std::vector<int> vec;
|
std::vector<int> vec;
|
||||||
vec.reserve(det.getNumberOfDetectors());
|
vec.reserve(det.size());
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
vec.push_back(det.getReceiverUDPPort(i));
|
vec.push_back(det.getReceiverUDPPort(i));
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
@ -599,8 +599,8 @@ class DetectorPythonInterface {
|
|||||||
|
|
||||||
std::vector<int> getReceiverUDPPort2() {
|
std::vector<int> getReceiverUDPPort2() {
|
||||||
std::vector<int> vec;
|
std::vector<int> vec;
|
||||||
vec.reserve(det.getNumberOfDetectors());
|
vec.reserve(det.size());
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
vec.push_back(det.getReceiverUDPPort2(i));
|
vec.push_back(det.getReceiverUDPPort2(i));
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
@ -990,7 +990,7 @@ void DetectorPythonInterface::setReadoutFlag(const std::string flag_name) {
|
|||||||
|
|
||||||
std::vector<double> DetectorPythonInterface::getRateCorrection() {
|
std::vector<double> DetectorPythonInterface::getRateCorrection() {
|
||||||
std::vector<double> rate_corr;
|
std::vector<double> rate_corr;
|
||||||
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
|
for (size_t i = 0; i < det.size(); ++i) {
|
||||||
rate_corr.push_back(det.getRateCorrection(i));
|
rate_corr.push_back(det.getRateCorrection(i));
|
||||||
}
|
}
|
||||||
return rate_corr;
|
return rate_corr;
|
||||||
|
@ -1113,9 +1113,31 @@ class Detector {
|
|||||||
int setDetectorMinMaxEnergyThreshold(const int index, int value);
|
int setDetectorMinMaxEnergyThreshold(const int index, int value);
|
||||||
|
|
||||||
void setAdditionalJsonHeader(const std::string &jsonheader,
|
void setAdditionalJsonHeader(const std::string &jsonheader,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
Result<std::string> getAdditionalJsonHeader(Positions pos = {}) const;
|
Result<std::string> getAdditionalJsonHeader(Positions pos = {}) const;
|
||||||
|
|
||||||
|
Result<std::string> getAdditionalJsonParameter(const std::string &key,
|
||||||
|
Positions pos = {}) const;
|
||||||
|
|
||||||
|
void setAdditionalJsonParameter(const std::string &key,
|
||||||
|
const std::string &value,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
|
// TODO these should probably be the same
|
||||||
|
Result<std::string> getReceiverStreamingIP(Positions pos = {}) const;
|
||||||
|
|
||||||
|
void setReceiverDataStreamingOutIP(const std::string &ip,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
|
Result<std::string> getClientStreamingIP(Positions pos = {}) const;
|
||||||
|
|
||||||
|
// TODO these should probably be the same
|
||||||
|
void setClientDataStreamingInIP(const std::string &ip, Positions pos = {});
|
||||||
|
|
||||||
|
Result<int> getReceiverStreamingPort(Positions pos = {}) const;
|
||||||
|
|
||||||
|
// void setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
@ -381,7 +381,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* Returns the number of detectors in the multidetector structure
|
* Returns the number of detectors in the multidetector structure
|
||||||
* @returns number of detectors
|
* @returns number of detectors
|
||||||
*/
|
*/
|
||||||
int size() const;//
|
size_t size() const;//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of detectors in dimension d
|
* Returns number of detectors in dimension d
|
||||||
@ -1225,7 +1225,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
*/
|
*/
|
||||||
void setClientDataStreamingInIP(const std::string &ip = "",
|
void setClientDataStreamingInIP(const std::string &ip = "",
|
||||||
int detPos = -1);
|
int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client zmq ip
|
* Returns the client zmq ip
|
||||||
@ -1234,7 +1234,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the client zmq ip
|
* @returns the client zmq ip
|
||||||
*/
|
*/
|
||||||
std::string getClientStreamingIP(int detPos = -1);
|
std::string getClientStreamingIP(int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (advanced users)
|
* (advanced users)
|
||||||
@ -1244,7 +1244,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
*/
|
*/
|
||||||
void setReceiverDataStreamingOutIP(const std::string &ip = "",
|
void setReceiverDataStreamingOutIP(const std::string &ip = "",
|
||||||
int detPos = -1);
|
int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver zmq ip
|
* Returns the receiver zmq ip
|
||||||
@ -1253,7 +1253,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the receiver zmq ip
|
* @returns the receiver zmq ip
|
||||||
*/
|
*/
|
||||||
std::string getReceiverStreamingIP(int detPos = -1);
|
std::string getReceiverStreamingIP(int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the transmission delay for left, right or entire frame
|
* Sets the transmission delay for left, right or entire frame
|
||||||
@ -1264,7 +1264,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @returns transmission delay
|
* @returns transmission delay
|
||||||
*/
|
*/
|
||||||
int setDetectorNetworkParameter(networkParameter index, int delay,
|
int setDetectorNetworkParameter(networkParameter index, int delay,
|
||||||
int detPos = -1);
|
int detPos = -1); //maybe not needed in API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the additional json header
|
* Sets the additional json header
|
||||||
@ -1273,14 +1273,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
* @returns additional json header, default is empty
|
* @returns additional json header, default is empty
|
||||||
*/
|
*/
|
||||||
std::string setAdditionalJsonHeader(const std::string &jsonheader,
|
std::string setAdditionalJsonHeader(const std::string &jsonheader,
|
||||||
int detPos = -1);
|
int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the additional json header
|
* Returns the additional json header
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the additional json header, default is empty
|
* @returns the additional json header, default is empty
|
||||||
*/
|
*/
|
||||||
std::string getAdditionalJsonHeader(int detPos = -1);
|
std::string getAdditionalJsonHeader(int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for the additional json header parameter if found, else
|
* Sets the value for the additional json header parameter if found, else
|
||||||
|
@ -142,9 +142,7 @@ Result<std::string> Detector::getDetectorTypeAsString(Positions pos) const {
|
|||||||
return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos);
|
return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Detector::size() const {
|
int Detector::size() const { return pimpl->size(); }
|
||||||
return pimpl->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
defs::coordinates Detector::getNumberOfDetectors() const {
|
defs::coordinates Detector::getNumberOfDetectors() const {
|
||||||
defs::coordinates coord;
|
defs::coordinates coord;
|
||||||
@ -432,7 +430,8 @@ Result<int64_t> Detector::getNumberOfCyclesLeft(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACQUISITION_TIME);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::ACQUISITION_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
||||||
@ -440,11 +439,13 @@ Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
|
Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::DELAY_AFTER_TRIGGER);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::DELAY_AFTER_TRIGGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64_t> Detector::getNumberOfFramesFromStart(Positions pos) const {
|
Result<int64_t> Detector::getNumberOfFramesFromStart(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAMES_FROM_START);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::FRAMES_FROM_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getActualTime(Positions pos) const {
|
Result<ns> Detector::getActualTime(Positions pos) const {
|
||||||
@ -452,15 +453,18 @@ Result<ns> Detector::getActualTime(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASUREMENT_TIME);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::MEASUREMENT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<ns> Detector::getMeasuredPeriod(Positions pos) const {
|
Result<ns> Detector::getMeasuredPeriod(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_PERIOD);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::MEASURED_PERIOD);
|
||||||
};
|
};
|
||||||
|
|
||||||
Result<ns> Detector::getMeasuredSubFramePeriod(Positions pos) const {
|
Result<ns> Detector::getMeasuredSubFramePeriod(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_SUBPERIOD);
|
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||||
|
defs::MEASURED_SUBPERIOD);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Erik
|
// Erik
|
||||||
@ -929,4 +933,43 @@ Result<std::string> Detector::getAdditionalJsonHeader(Positions pos) const {
|
|||||||
return pimpl->Parallel(&slsDetector::getAdditionalJsonHeader, pos);
|
return pimpl->Parallel(&slsDetector::getAdditionalJsonHeader, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<std::string> Detector::getAdditionalJsonParameter(const std::string &key,
|
||||||
|
Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::getAdditionalJsonParameter, pos, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setAdditionalJsonParameter(const std::string &key,
|
||||||
|
const std::string &value,
|
||||||
|
Positions pos) {
|
||||||
|
pimpl->Parallel(&slsDetector::setAdditionalJsonParameter, pos, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<std::string> Detector::getReceiverStreamingIP(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::getReceiverStreamingIP, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setReceiverDataStreamingOutIP(const std::string &ip,
|
||||||
|
Positions pos) {
|
||||||
|
// TODO! probably in one call
|
||||||
|
pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip);
|
||||||
|
pimpl->Parallel(&slsDetector::enableDataStreamingFromReceiver, pos, 0);
|
||||||
|
pimpl->Parallel(&slsDetector::enableDataStreamingFromReceiver, pos, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<std::string> Detector::getClientStreamingIP(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::getClientStreamingIP, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setClientDataStreamingInIP(const std::string &ip,
|
||||||
|
Positions pos) {
|
||||||
|
// TODO! probably in one call
|
||||||
|
pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip);
|
||||||
|
pimpl->enableDataStreamingToClient(0);
|
||||||
|
pimpl->enableDataStreamingToClient(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getReceiverStreamingPort(Positions pos) const{
|
||||||
|
return pimpl->Parallel(&slsDetector::getReceiverStreamingPort, pos);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
@ -660,7 +660,7 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
|
|||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::size() const { return detectors.size(); }
|
size_t multiSlsDetector::size() const { return detectors.size(); }
|
||||||
|
|
||||||
int multiSlsDetector::getNumberOfDetectors(dimension d) const {
|
int multiSlsDetector::getNumberOfDetectors(dimension d) const {
|
||||||
return multi_shm()->numberOfDetector[d];
|
return multi_shm()->numberOfDetector[d];
|
||||||
@ -1946,6 +1946,7 @@ void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
|
Reference in New Issue
Block a user