fixed python

This commit is contained in:
Erik Frojdh 2019-08-14 11:54:03 +02:00
parent 5f0a3eaee4
commit 8e2b89d488
4 changed files with 174 additions and 165 deletions

View File

@ -120,11 +120,11 @@ class ExperimentalDetector(multiDetectorApi):
# File # File
@property @property
def fname(self): def fname(self):
return element_if_equal(self.getFileName()) return element_if_equal(self.getFileNamePrefix())
@fname.setter @fname.setter
def fname(self, file_name): def fname(self, file_name):
self.setFileName(file_name) self.setFileNamePrefix(file_name)
@property @property
def fpath(self): def fpath(self):

View File

@ -44,8 +44,8 @@ void init_experimental(py::module &m) {
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
// File // File
.def("getFileName", &Detector::getFileName) .def("getFileNamePrefix", &Detector::getFileNamePrefix)
.def("setFileName", &Detector::setFileName, py::arg(),py::arg() = Positions{}) .def("setFileNamePrefix", &Detector::setFileNamePrefix, py::arg(),py::arg() = Positions{})
.def("getFilePath", &Detector::getFilePath) .def("getFilePath", &Detector::getFilePath)
.def("setFilePath", &Detector::setFilePath, py::arg(),py::arg() = Positions{}) .def("setFilePath", &Detector::setFilePath, py::arg(),py::arg() = Positions{})
.def("setFileWrite", &Detector::setFileWrite, py::arg(), .def("setFileWrite", &Detector::setFileWrite, py::arg(),

View File

@ -24,22 +24,22 @@ class Detector {
Detector(int multi_id = 0); Detector(int multi_id = 0);
~Detector(); ~Detector();
/************************************************** /**************************************************
* * * *
* CONFIGURATIOn * * CONFIGURATIOn *
* * * *
* ************************************************/ * ************************************************/
/**
* Frees the shared memory of this detector and all modules /* Free the shared memory of this detector and all modules
* belonging to it. * belonging to it.*/
*/
void freeSharedMemory(); void freeSharedMemory();
void setConfig(const std::string &fname); void setConfig(const std::string &fname);
Result<std::string> getHostname(Positions pos = {}) const; Result<std::string> getHostname(Positions pos = {}) const;
/**
* Frees shared memory and adds detectors to the list /* Frees shared memory, adds detectors to the list
* Also updates local detector cache */ * and updates local detector cache */
void setHostname(const std::vector<std::string> &value); void setHostname(const std::vector<std::string> &value);
int getMultiId() const; int getMultiId() const;
@ -58,16 +58,13 @@ class Detector {
Result<int64_t> getReceiverSoftwareVersion(Positions pos = {}) const; Result<int64_t> getReceiverSoftwareVersion(Positions pos = {}) const;
/** Get user details of shared memory */
std::string getUserDetailsFromSharedMemory() const; std::string getUserDetailsFromSharedMemory() const;
defs::detectorType getDetectorType() const; Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
Result<defs::detectorType> getDetectorTypeAsEnum(Positions pos = {}) const;
Result<std::string> getDetectorTypeAsString(Positions pos = {}) const; Result<std::string> getDetectorTypeAsString(Positions pos = {}) const;
/** @returns the total number of detectors in the multidetector structure */ /** @returns the total number of detectors */
int size() const; int size() const;
defs::coordinates getNumberOfDetectors() const; defs::coordinates getNumberOfDetectors() const;
@ -86,10 +83,10 @@ class Detector {
*/ */
void setMaxNumberOfChannels(const defs::coordinates value); void setMaxNumberOfChannels(const defs::coordinates value);
/** [Eiger with specific quad hardware] */ /** [Eiger] with specific quad hardware */
Result<bool> getQuad(Positions pos = {}) const; Result<bool> getQuad(Positions pos = {}) const;
/** [Eiger with specific quad hardware] */ /** [Eiger] with specific quad hardware */
void setQuad(const bool enable, Positions pos = {}); void setQuad(const bool enable, Positions pos = {});
/** [Eiger] */ /** [Eiger] */
@ -159,12 +156,15 @@ class Detector {
/** [Not CTB] Sets the detector trimbit/settings directory */ /** [Not CTB] Sets the detector trimbit/settings directory */
void setSettingsDir(const std::string &value, Positions pos = {}); void setSettingsDir(const std::string &value, Positions pos = {});
/** [Not CTB] Loads the modules settings/trimbits reading from a specific file /** [Not CTB] Loads the modules settings/trimbits reading from a specific
* file name extension is automatically generated from detector serial number */ * file
* file name extension is automatically generated from detector serial
* number */
void loadSettingsFile(const std::string &value, Positions pos = {}); void loadSettingsFile(const std::string &value, Positions pos = {});
/** [Not CTB] Saves the modules settings/trimbits to a specific file /** [Not CTB] Saves the modules settings/trimbits to a specific file
* file name extension is automatically generated from detector serial number */ * file name extension is automatically generated from detector serial
* number */
void saveSettingsFile(const std::string &value, Positions pos = {}); void saveSettingsFile(const std::string &value, Positions pos = {});
/** Configures in detector the destination for UDP packets */ /** Configures in detector the destination for UDP packets */
@ -188,8 +188,8 @@ class Detector {
Result<int> getStorageCellStart(Positions pos = {}) const; Result<int> getStorageCellStart(Positions pos = {}) const;
/** /**
* [Jungfrau] Sets the storage cell storing the first acquisition of the series * [Jungfrau] Sets the storage cell storing the first acquisition of the
* Options: 0-15 * series Options: 0-15
*/ */
void setStoragecellStart(int cell, Positions pos = {}); void setStoragecellStart(int cell, Positions pos = {});
@ -219,16 +219,16 @@ class Detector {
/** [Gotthard][Jungfrau] */ /** [Gotthard][Jungfrau] */
void setDelayAfterTrigger(ns value, Positions pos = {}); void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Eiger in 32 bit mode] */ /** [Eiger] in 32 bit mode */
Result<ns> getSubExptime(Positions pos = {}) const; Result<ns> getSubExptime(Positions pos = {}) const;
/** [Eiger in 32 bit mode] */ /** [Eiger] in 32 bit mode */
void setSubExptime(ns t, Positions pos = {}); void setSubExptime(ns t, Positions pos = {});
/** [Eiger in 32 bit mode] */ /** [Eiger] in 32 bit mode */
Result<ns> getSubDeadTime(Positions pos = {}) const; Result<ns> getSubDeadTime(Positions pos = {}) const;
/** [Eiger in 32 bit mode] */ /** [Eiger] in 32 bit mode */
void setSubDeadTime(ns value, Positions pos = {}); void setSubDeadTime(ns value, Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] */
@ -399,19 +399,23 @@ class Detector {
void setDAC(int value, defs::dacIndex index, bool mV, Positions pos = {}); void setDAC(int value, defs::dacIndex index, bool mV, Positions pos = {});
Result<defs::externalCommunicationMode> getTimingMode(Positions pos = {}) const; Result<defs::externalCommunicationMode>
getTimingMode(Positions pos = {}) const;
/** /**
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE] * [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER] * [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
*/ */
void setTimingMode(defs::externalCommunicationMode value, Positions pos = {}); void setTimingMode(defs::externalCommunicationMode value,
Positions pos = {});
/** [Gotthard] */ /** [Gotthard] */
Result<defs::externalSignalFlag> getExternalSignalFlags(Positions pos = {}) const; Result<defs::externalSignalFlag>
getExternalSignalFlags(Positions pos = {}) const;
/** [Gotthard] Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE */ /** [Gotthard] Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE */
void setExternalSignalFlags(defs::externalSignalFlag value, Positions pos = {}); void setExternalSignalFlags(defs::externalSignalFlag value,
Positions pos = {});
/** [Eiger] */ /** [Eiger] */
Result<bool> getParallelMode(Positions pos = {}) const; Result<bool> getParallelMode(Positions pos = {}) const;
@ -428,7 +432,8 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<int> getSignalType(Positions pos = {}) const; Result<int> getSignalType(Positions pos = {}) const;
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL = 2 */ /** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL
* = 2 */
void setSignalType(int value, Positions pos = {}); void setSignalType(int value, Positions pos = {});
/** [Eiger] */ /** [Eiger] */
@ -557,9 +562,10 @@ class Detector {
Result<int> getTransmissionDelayFrame(Positions pos = {}) const; Result<int> getTransmissionDelayFrame(Positions pos = {}) const;
/** /**
* [Jungfrau: Sets the transmission delay of the first UDP packet being streamed out of the module * [Jungfrau: Sets the transmission delay of the first UDP packet being
* Options: 0 - 31, each value represenets 1 ms ] * streamed out of the module Options: 0 - 31, each value represenets 1 ms ]
* [Eiger: Sets the transmission delay of entire frame streamed out for both left and right UDP ports] * [Eiger: Sets the transmission delay of entire frame streamed out for both
* left and right UDP ports]
*/ */
void setTransmissionDelayFrame(int value, Positions pos = {}); void setTransmissionDelayFrame(int value, Positions pos = {});
@ -567,7 +573,8 @@ class Detector {
Result<int> getTransmissionDelayLeft(Positions pos = {}) const; Result<int> getTransmissionDelayLeft(Positions pos = {}) const;
/** /**
* [Eiger] * [Eiger]
* Sets the transmission delay of first packet streamed ut of the left UDP port * Sets the transmission delay of first packet streamed ut of the left UDP
* port
*/ */
void setTransmissionDelayLeft(int value, Positions pos = {}); void setTransmissionDelayLeft(int value, Positions pos = {});
@ -576,7 +583,8 @@ class Detector {
/** /**
* [Eiger] * [Eiger]
* Sets the transmission delay of first packet streamed ut of the right UDP port * Sets the transmission delay of first packet streamed ut of the right UDP
* port
*/ */
void setTransmissionDelayRight(int value, Positions pos = {}); void setTransmissionDelayRight(int value, Positions pos = {});
@ -604,10 +612,12 @@ class Detector {
* else? Use a generic zmq message passing system... * else? Use a generic zmq message passing system...
* For now limiting to all detectors working the same*/ * For now limiting to all detectors working the same*/
/** [Moench: -1 if not found or cannot convert to int] */ /** [Moench: -1 if not found or cannot convert to int] */
Result<int> getDetectorMinMaxEnergyThreshold(const bool isEmax, Positions pos = {}) const; Result<int> getDetectorMinMaxEnergyThreshold(const bool isEmax,
Positions pos = {}) const;
/** [Moench] */ /** [Moench] */
void setDetectorMinMaxEnergyThreshold(const bool isEmax, const int value, Positions pos = {}); void setDetectorMinMaxEnergyThreshold(const bool isEmax, const int value,
Positions pos = {});
/** [Moench: -1 if unknown mode] */ /** [Moench: -1 if unknown mode] */
Result<int> getFrameMode(Positions pos = {}) const; Result<int> getFrameMode(Positions pos = {}) const;
@ -643,7 +653,8 @@ class Detector {
* [Gotthard] subset modules not allowed * [Gotthard] subset modules not allowed
* @param startACQ if start acq after reading counter * @param startACQ if start acq after reading counter
*/ */
void getCounterMemoryBlock(const std::string &fname, bool startACQ, Positions pos = {}); void getCounterMemoryBlock(const std::string &fname, bool startACQ,
Positions pos = {});
/** /**
* [Gotthard] * [Gotthard]
@ -655,7 +666,8 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<bool> getCounterBit(Positions pos = {}) const; Result<bool> getCounterBit(Positions pos = {}) const;
/** [Eiger] If it is set, it resets chips completely (else partially) before an acquisition TODO: if it makes sense */ /** [Eiger] If it is set, it resets chips completely (else partially) before
* an acquisition TODO: if it makes sense */
void setCounterBit(bool value, Positions pos = {}); void setCounterBit(bool value, Positions pos = {});
/** [Gotthard]*/ /** [Gotthard]*/
@ -749,7 +761,8 @@ class Detector {
*/ */
void pulsePixel(int n, int x, int y, Positions pos = {}); void pulsePixel(int n, int x, int y, Positions pos = {});
/** [Eiger] Pulse Pixel n times and move by a relative value of x and y coordinates */ /** [Eiger] Pulse Pixel n times and move by a relative value of x and y
* coordinates */
void pulsePixelNMove(int n, int x, int y, Positions pos = {}); void pulsePixelNMove(int n, int x, int y, Positions pos = {});
/** [Eiger] Pulse chip n times */ /** [Eiger] Pulse chip n times */
@ -800,7 +813,8 @@ class Detector {
* [Jungfrau][Gotthard][CTB] * [Jungfrau][Gotthard][CTB]
* Updates the firmware, detector server and then reboots detector * Updates the firmware, detector server and then reboots detector
* controller blackfin. * controller blackfin.
* @param sname name of detector server binary found on tftp folder of host pc * @param sname name of detector server binary found on tftp folder of host
* pc
* @param hostname name of pc to tftp from * @param hostname name of pc to tftp from
* @param fname programming file name * @param fname programming file name
* @param pos detector positions * @param pos detector positions
@ -866,7 +880,8 @@ class Detector {
* ************************************************/ * ************************************************/
Result<defs::fileFormat> getFileFormat(Positions pos = {}) const; Result<defs::fileFormat> getFileFormat(Positions pos = {}) const;
/** default binary, Options: BINARY, HDF5 (library must be compiled with this option) */ /** default binary, Options: BINARY, HDF5 (library must be compiled with
* this option) */
void setFileFormat(defs::fileFormat f, Positions pos = {}); void setFileFormat(defs::fileFormat f, Positions pos = {});
Result<std::string> getFilePath(Positions pos = {}) const; Result<std::string> getFilePath(Positions pos = {}) const;
@ -901,7 +916,6 @@ class Detector {
void setFramesPerFile(int n, Positions pos = {}); void setFramesPerFile(int n, Positions pos = {});
/************************************************** /**************************************************
* * * *
* RECEIVER CONFIG * * RECEIVER CONFIG *
@ -940,8 +954,8 @@ class Detector {
Result<int> getReceiverStreamingTimer(Positions pos = {}) const; Result<int> getReceiverStreamingTimer(Positions pos = {}) const;
/** /**
* If receiver streaming frequency is 0 (default), then this timer between each * If receiver streaming frequency is 0 (default), then this timer between
* data stream is set. Default is 200 ms. * each data stream is set. Default is 200 ms.
*/ */
void setReceiverStreamingTimer(int time_in_ms, Positions pos = {}); void setReceiverStreamingTimer(int time_in_ms, Positions pos = {});
@ -1016,7 +1030,7 @@ class Detector {
Result<defs::runStatus> getRunStatus(Positions pos = {}); Result<defs::runStatus> getRunStatus(Positions pos = {});
/** Start detector acquisition (Non blocking) */ /** Non blocking */
void startAcquisition(); void startAcquisition();
void stopAcquisition(); void stopAcquisition();
@ -1100,7 +1114,6 @@ class Detector {
* pattern * pattern
*/ */
void setPatternBitMask(uint64_t mask, Positions pos = {}); void setPatternBitMask(uint64_t mask, Positions pos = {});
}; };
} // namespace sls } // namespace sls

View File

@ -62,12 +62,8 @@ Result<int64_t> Detector::getReceiverSoftwareVersion(Positions pos) const {
std::string Detector::getUserDetailsFromSharedMemory() const { return pimpl->getUserDetails(); } std::string Detector::getUserDetailsFromSharedMemory() const { return pimpl->getUserDetails(); }
defs::detectorType Detector::getDetectorType() const {
return pimpl->getDetectorTypeAsEnum();
}
Result<defs::detectorType> Result<defs::detectorType>
Detector::getDetectorTypeAsEnum(Positions pos) const { Detector::getDetectorType(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos); return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos);
} }
@ -487,7 +483,7 @@ Result<int> Detector::getTemp(defs::dacIndex index, Positions pos) const {
throw RuntimeError("Unknown Temperature Index"); throw RuntimeError("Unknown Temperature Index");
} }
auto res = pimpl->Parallel(&slsDetector::getADC, pos, index); auto res = pimpl->Parallel(&slsDetector::getADC, pos, index);
switch (getDetectorType()) { switch (getDetectorType().squash()) {
case defs::EIGER: case defs::EIGER:
case defs::JUNGFRAU: case defs::JUNGFRAU:
for (auto &it : res) { for (auto &it : res) {