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
@property
def fname(self):
return element_if_equal(self.getFileName())
return element_if_equal(self.getFileNamePrefix())
@fname.setter
def fname(self, file_name):
self.setFileName(file_name)
self.setFileNamePrefix(file_name)
@property
def fpath(self):

View File

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

View File

@ -24,22 +24,22 @@ class Detector {
Detector(int multi_id = 0);
~Detector();
/**************************************************
* *
* CONFIGURATIOn *
* *
* ************************************************/
/**
* Frees the shared memory of this detector and all modules
* belonging to it.
*/
/* Free the shared memory of this detector and all modules
* belonging to it.*/
void freeSharedMemory();
void setConfig(const std::string &fname);
Result<std::string> getHostname(Positions pos = {}) const;
/**
* Frees shared memory and adds detectors to the list
* Also updates local detector cache */
/* Frees shared memory, adds detectors to the list
* and updates local detector cache */
void setHostname(const std::vector<std::string> &value);
int getMultiId() const;
@ -58,23 +58,20 @@ class Detector {
Result<int64_t> getReceiverSoftwareVersion(Positions pos = {}) const;
/** Get user details of shared memory */
std::string getUserDetailsFromSharedMemory() const;
defs::detectorType getDetectorType() const;
Result<defs::detectorType> getDetectorTypeAsEnum(Positions pos = {}) const;
Result<defs::detectorType> getDetectorType(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;
defs::coordinates getNumberOfDetectors() const;
Result<defs::coordinates> getNumberOfChannels(Positions pos = {}) const;
Result<defs::coordinates>
Result<defs::coordinates>
getNumberOfChannelsInclGapPixels(Positions pos = {}) const;
defs::coordinates getMaxNumberOfChannels() const;
@ -86,22 +83,22 @@ class Detector {
*/
void setMaxNumberOfChannels(const defs::coordinates value);
/** [Eiger with specific quad hardware] */
/** [Eiger] with specific quad hardware */
Result<bool> getQuad(Positions pos = {}) const;
/** [Eiger with specific quad hardware] */
/** [Eiger] with specific quad hardware */
void setQuad(const bool enable, Positions pos = {});
/** [Eiger] */
Result<int> getReadNLines(Positions pos = {}) const;
/** [Eiger] Number of lines to read out per half module
* Options: 0 - 256. Depending on dynamic range and
* 10 GbE enabled, only specific values are accepted
*/
/** [Eiger] Number of lines to read out per half module
* Options: 0 - 256. Depending on dynamic range and
* 10 GbE enabled, only specific values are accepted
*/
void setReadNLines(const int value, Positions pos = {});
Result<int> getControlPort(Positions pos = {}) const;
Result<int> getControlPort(Positions pos = {}) const;
/** Detector Control TCP port (for client communication with Detector
* control server) */
@ -159,12 +156,15 @@ class Detector {
/** [Not CTB] Sets the detector trimbit/settings directory */
void setSettingsDir(const std::string &value, Positions pos = {});
/** [Not CTB] Loads the modules settings/trimbits reading from a specific file
* file name extension is automatically generated from detector serial number */
/** [Not CTB] Loads the modules settings/trimbits reading from a specific
* file
* file name extension is automatically generated from detector serial
* number */
void loadSettingsFile(const std::string &value, Positions pos = {});
/** [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 = {});
/** Configures in detector the destination for UDP packets */
@ -188,8 +188,8 @@ class Detector {
Result<int> getStorageCellStart(Positions pos = {}) const;
/**
* [Jungfrau] Sets the storage cell storing the first acquisition of the series
* Options: 0-15
* [Jungfrau] Sets the storage cell storing the first acquisition of the
* series Options: 0-15
*/
void setStoragecellStart(int cell, Positions pos = {});
@ -219,16 +219,16 @@ class Detector {
/** [Gotthard][Jungfrau] */
void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Eiger in 32 bit mode] */
/** [Eiger] in 32 bit mode */
Result<ns> getSubExptime(Positions pos = {}) const;
/** [Eiger in 32 bit mode] */
/** [Eiger] in 32 bit mode */
void setSubExptime(ns t, Positions pos = {});
/** [Eiger in 32 bit mode] */
/** [Eiger] in 32 bit mode */
Result<ns> getSubDeadTime(Positions pos = {}) const;
/** [Eiger in 32 bit mode] */
/** [Eiger] in 32 bit mode */
void setSubDeadTime(ns value, Positions pos = {});
/** [Jungfrau] */
@ -259,7 +259,7 @@ class Detector {
/** [Jungfrau][CTB] Get time from detector start */
Result<ns> getActualTime(Positions pos = {}) const;
/** [Jungfrau][CTB] Get timestamp at a frame start */
/** [Jungfrau][CTB] Get timestamp at a frame start */
Result<ns> getMeasurementTime(Positions pos = {}) const;
/** [Eiger] Get measured period between previous two frames */
@ -399,19 +399,23 @@ class Detector {
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]
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
*/
void setTimingMode(defs::externalCommunicationMode value, Positions pos = {});
void setTimingMode(defs::externalCommunicationMode value,
Positions pos = {});
/** [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 */
void setExternalSignalFlags(defs::externalSignalFlag value, Positions pos = {});
void setExternalSignalFlags(defs::externalSignalFlag value,
Positions pos = {});
/** [Eiger] */
Result<bool> getParallelMode(Positions pos = {}) const;
@ -428,7 +432,8 @@ class Detector {
/** [CTB] */
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 = {});
/** [Eiger] */
@ -557,9 +562,10 @@ class Detector {
Result<int> getTransmissionDelayFrame(Positions pos = {}) const;
/**
* [Jungfrau: Sets the transmission delay of the first UDP packet being 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]
* [Jungfrau: Sets the transmission delay of the first UDP packet being
* 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]
*/
void setTransmissionDelayFrame(int value, Positions pos = {});
@ -567,7 +573,8 @@ class Detector {
Result<int> getTransmissionDelayLeft(Positions pos = {}) const;
/**
* [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 = {});
@ -576,7 +583,8 @@ class Detector {
/**
* [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 = {});
@ -604,10 +612,12 @@ class Detector {
* else? Use a generic zmq message passing system...
* For now limiting to all detectors working the same*/
/** [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] */
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] */
Result<int> getFrameMode(Positions pos = {}) const;
@ -643,7 +653,8 @@ class Detector {
* [Gotthard] subset modules not allowed
* @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]
@ -655,7 +666,8 @@ class Detector {
/** [Eiger] */
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 = {});
/** [Gotthard]*/
@ -722,7 +734,7 @@ class Detector {
/** [Eiger]
* @returns -1 if they are all different
*/
*/
Result<int> getAllTrimbits(Positions pos = {}) const;
/**[Eiger] */
@ -749,7 +761,8 @@ class Detector {
*/
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 = {});
/** [Eiger] Pulse chip n times */
@ -789,7 +802,7 @@ class Detector {
/**
* Copy detector server fname from tftp folder of hostname to detector
* Also changes respawn server, which is effective after a reboot.
*/
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
@ -800,7 +813,8 @@ class Detector {
* [Jungfrau][Gotthard][CTB]
* Updates the firmware, detector server and then reboots detector
* 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 fname programming file name
* @param pos detector positions
@ -866,7 +880,8 @@ class Detector {
* ************************************************/
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 = {});
Result<std::string> getFilePath(Positions pos = {}) const;
@ -901,7 +916,6 @@ class Detector {
void setFramesPerFile(int n, Positions pos = {});
/**************************************************
* *
* RECEIVER CONFIG *
@ -940,8 +954,8 @@ class Detector {
Result<int> getReceiverStreamingTimer(Positions pos = {}) const;
/**
* If receiver streaming frequency is 0 (default), then this timer between each
* data stream is set. Default is 200 ms.
* If receiver streaming frequency is 0 (default), then this timer between
* each data stream is set. Default is 200 ms.
*/
void setReceiverStreamingTimer(int time_in_ms, Positions pos = {});
@ -1016,7 +1030,7 @@ class Detector {
Result<defs::runStatus> getRunStatus(Positions pos = {});
/** Start detector acquisition (Non blocking) */
/** Non blocking */
void startAcquisition();
void stopAcquisition();
@ -1100,7 +1114,6 @@ class Detector {
* pattern
*/
void setPatternBitMask(uint64_t mask, Positions pos = {});
};
} // namespace sls

View File

@ -62,12 +62,8 @@ Result<int64_t> Detector::getReceiverSoftwareVersion(Positions pos) const {
std::string Detector::getUserDetailsFromSharedMemory() const { return pimpl->getUserDetails(); }
defs::detectorType Detector::getDetectorType() const {
return pimpl->getDetectorTypeAsEnum();
}
Result<defs::detectorType>
Detector::getDetectorTypeAsEnum(Positions pos) const {
Detector::getDetectorType(Positions pos) const {
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");
}
auto res = pimpl->Parallel(&slsDetector::getADC, pos, index);
switch (getDetectorType()) {
switch (getDetectorType().squash()) {
case defs::EIGER:
case defs::JUNGFRAU:
for (auto &it : res) {