removed roflags from python

This commit is contained in:
Erik Frojdh 2019-09-17 09:32:22 +02:00
parent 400e69cef2
commit c3c3f78c59
4 changed files with 101 additions and 101 deletions

View File

@ -332,43 +332,43 @@ class Detector:
""" """
return self._api.getFirmwareVersion() return self._api.getFirmwareVersion()
@property # @property
def flags(self): # def flags(self):
"""Read and set flags. Accepts both single flag as # """Read and set flags. Accepts both single flag as
string or list of flags. # string or list of flags.
Raises # Raises
-------- # --------
RuntimeError # RuntimeError
If flag not recognized # If flag not recognized
Examples # Examples
---------- # ----------
:: # ::
#Eiger # #Eiger
detector.flags # detector.flags
>> ['storeinram', 'parallel'] # >> ['storeinram', 'parallel']
detector.flags = 'nonparallel' # detector.flags = 'nonparallel'
detector.flags # detector.flags
>> ['storeinram', 'nonparallel'] # >> ['storeinram', 'nonparallel']
detector.flags = ['continous', 'parallel'] # detector.flags = ['continous', 'parallel']
""" # """
return self._api.getReadoutFlags() # return self._api.getReadoutFlags()
@flags.setter # @flags.setter
def flags(self, flags): # def flags(self, flags):
if isinstance(flags, str): # if isinstance(flags, str):
self._api.setReadoutFlag(flags) # self._api.setReadoutFlag(flags)
elif isinstance(flags, Iterable): # elif isinstance(flags, Iterable):
for f in flags: # for f in flags:
self._api.setReadoutFlag(f) # self._api.setReadoutFlag(f)
@property @property
def frames_caught(self): def frames_caught(self):

View File

@ -428,10 +428,10 @@ class DetectorPythonInterface {
return det.getADC(adc, mod_id); return det.getADC(adc, mod_id);
} }
std::vector<std::string> getReadoutFlags(); // std::vector<std::string> getReadoutFlags();
// note singular // // note singular
void setReadoutFlag(const std::string flag_name); // void setReadoutFlag(const std::string flag_name);
// name to enum transltion of dac // name to enum transltion of dac
int getDacVthreshold() { int getDacVthreshold() {
@ -900,75 +900,75 @@ slsDetectorDefs::dacIndex DetectorPythonInterface::dacNameToEnum(std::string dac
// overflow of single subframes */ // overflow of single subframes */
// }; // };
std::vector<std::string> DetectorPythonInterface::getReadoutFlags() { // std::vector<std::string> DetectorPythonInterface::getReadoutFlags() {
std::vector<std::string> flags; // std::vector<std::string> flags;
auto r = det.setReadOutFlags(); // auto r = det.setReadOutFlags();
if (r & slsDetectorDefs::readOutFlags::STORE_IN_RAM) // if (r & slsDetectorDefs::readOutFlags::STORE_IN_RAM)
flags.push_back("storeinram"); // flags.push_back("storeinram");
if (r & slsDetectorDefs::readOutFlags::READ_HITS) // if (r & slsDetectorDefs::readOutFlags::READ_HITS)
flags.push_back("readhits"); // flags.push_back("readhits");
if (r & slsDetectorDefs::readOutFlags::ZERO_COMPRESSION) // if (r & slsDetectorDefs::readOutFlags::ZERO_COMPRESSION)
flags.push_back("zerocompression"); // flags.push_back("zerocompression");
if (r & slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE) // if (r & slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE)
flags.push_back("pumpprobe"); // flags.push_back("pumpprobe");
if (r & slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS) // if (r & slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS)
flags.push_back("backgroundcorrections"); // flags.push_back("backgroundcorrections");
if (r & slsDetectorDefs::readOutFlags::TOT_MODE) // if (r & slsDetectorDefs::readOutFlags::TOT_MODE)
flags.push_back("tot"); // flags.push_back("tot");
if (r & slsDetectorDefs::readOutFlags::CONTINOUS_RO) // if (r & slsDetectorDefs::readOutFlags::CONTINOUS_RO)
flags.push_back("continous"); // flags.push_back("continous");
if (r & slsDetectorDefs::readOutFlags::PARALLEL) // if (r & slsDetectorDefs::readOutFlags::PARALLEL)
flags.push_back("parallel"); // flags.push_back("parallel");
if (r & slsDetectorDefs::readOutFlags::NONPARALLEL) // if (r & slsDetectorDefs::readOutFlags::NONPARALLEL)
flags.push_back("nonparallel"); // flags.push_back("nonparallel");
if (r & slsDetectorDefs::readOutFlags::DIGITAL_ONLY) // if (r & slsDetectorDefs::readOutFlags::DIGITAL_ONLY)
flags.push_back("digital"); // flags.push_back("digital");
if (r & slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL) // if (r & slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL)
flags.push_back("analog_digital"); // flags.push_back("analog_digital");
if (r & slsDetectorDefs::readOutFlags::DUT_CLK) // if (r & slsDetectorDefs::readOutFlags::DUT_CLK)
flags.push_back("dutclk"); // flags.push_back("dutclk");
if (r & slsDetectorDefs::readOutFlags::NOOVERFLOW) // if (r & slsDetectorDefs::readOutFlags::NOOVERFLOW)
flags.push_back("nooverflow"); // flags.push_back("nooverflow");
if (r & slsDetectorDefs::readOutFlags::SHOW_OVERFLOW) // if (r & slsDetectorDefs::readOutFlags::SHOW_OVERFLOW)
flags.push_back("overflow"); // flags.push_back("overflow");
return flags; // return flags;
} // }
// note singular // // note singular
void DetectorPythonInterface::setReadoutFlag(const std::string flag_name) { // void DetectorPythonInterface::setReadoutFlag(const std::string flag_name) {
if (flag_name == "none") // if (flag_name == "none")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::NORMAL_READOUT); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::NORMAL_READOUT);
else if (flag_name == "storeinram") // else if (flag_name == "storeinram")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::STORE_IN_RAM); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::STORE_IN_RAM);
else if (flag_name == "readhits") // else if (flag_name == "readhits")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::READ_HITS); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::READ_HITS);
else if (flag_name == "zerocompression") // else if (flag_name == "zerocompression")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::ZERO_COMPRESSION); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::ZERO_COMPRESSION);
else if (flag_name == "pumpprobe") // else if (flag_name == "pumpprobe")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE);
else if (flag_name == "backgroundcorrections") // else if (flag_name == "backgroundcorrections")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS);
else if (flag_name == "tot") // else if (flag_name == "tot")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::TOT_MODE); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::TOT_MODE);
else if (flag_name == "continous") // else if (flag_name == "continous")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::CONTINOUS_RO); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::CONTINOUS_RO);
else if (flag_name == "parallel") // else if (flag_name == "parallel")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::PARALLEL); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::PARALLEL);
else if (flag_name == "nonparallel") // else if (flag_name == "nonparallel")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::NONPARALLEL); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::NONPARALLEL);
else if (flag_name == "digital") // else if (flag_name == "digital")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::DIGITAL_ONLY); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::DIGITAL_ONLY);
else if (flag_name == "analog_digital") // else if (flag_name == "analog_digital")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL);
else if (flag_name == "dutclk") // else if (flag_name == "dutclk")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::DUT_CLK); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::DUT_CLK);
else if (flag_name == "nooverflow") // else if (flag_name == "nooverflow")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::NOOVERFLOW); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::NOOVERFLOW);
else if (flag_name == "overflow") // else if (flag_name == "overflow")
det.setReadOutFlags(slsDetectorDefs::readOutFlags::SHOW_OVERFLOW); // det.setReadOutFlags(slsDetectorDefs::readOutFlags::SHOW_OVERFLOW);
else // else
throw std::runtime_error("Flag name not recognized"); // throw std::runtime_error("Flag name not recognized");
} // }
std::vector<double> DetectorPythonInterface::getRateCorrection() { std::vector<double> DetectorPythonInterface::getRateCorrection() {
std::vector<double> rate_corr; std::vector<double> rate_corr;

View File

@ -293,8 +293,8 @@ PYBIND11_MODULE(_sls_detector, m) {
.def("getReceiverLock", &DetectorPythonInterface::getReceiverLock) .def("getReceiverLock", &DetectorPythonInterface::getReceiverLock)
.def("setReceiverLock", &DetectorPythonInterface::setReceiverLock) .def("setReceiverLock", &DetectorPythonInterface::setReceiverLock)
.def("getReadoutFlags", &DetectorPythonInterface::getReadoutFlags) // .def("getReadoutFlags", &DetectorPythonInterface::getReadoutFlags)
.def("setReadoutFlag", &DetectorPythonInterface::setReadoutFlag) // .def("setReadoutFlag", &DetectorPythonInterface::setReadoutFlag)
.def("setFileFormat", &DetectorPythonInterface::setFileFormat) .def("setFileFormat", &DetectorPythonInterface::setFileFormat)
.def("getFileFormat", &DetectorPythonInterface::getFileFormat) .def("getFileFormat", &DetectorPythonInterface::getFileFormat)

View File

@ -2,7 +2,7 @@
using dt = slsDetectorDefs::detectorType; using dt = slsDetectorDefs::detectorType;
using di = slsDetectorDefs::dacIndex; using di = slsDetectorDefs::dacIndex;
using ti = slsDetectorDefs::timerIndex; using ti = slsDetectorDefs::timerIndex;
using ro = slsDetectorDefs::readOutFlags; // using ro = slsDetectorDefs::readOutFlags;
using sv = slsDetectorDefs::speedVariable; using sv = slsDetectorDefs::speedVariable;
using defs = slsDetectorDefs; using defs = slsDetectorDefs;