This commit is contained in:
maliakal_d 2020-09-23 12:32:51 +02:00
parent a4bdffd0b9
commit bd4299fd15
5 changed files with 97 additions and 40 deletions

View File

@ -221,6 +221,13 @@ class Detector(CppDetectorApi):
@property
@element
def rx_threads(self):
"""
Get thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1].
Note
-----
If no streamer yet or there is no second interface, it gives 0 in its place.
:setter: Not Implemented
"""
return self.getRxThreadIds()
@property
@ -1276,11 +1283,18 @@ class Detector(CppDetectorApi):
@property
@element
def scanerrmsg(self):
"""Gets Scan error message if scan ended in error for non blocking acquisitions."""
return self.getScanErrorMessage()
@property
@element
def rx_zmqstartfnum(self):
"""
The starting frame index to stream out.
Note
----
0 by default, which streams the first frame in an acquisition, and then depending on the rx zmq frequency/ timer.
"""
return self.getRxZmqStartingFrame()
@rx_zmqstartfnum.setter
@ -1307,6 +1321,22 @@ class Detector(CppDetectorApi):
@property
def slowadc(self):
"""
[Ctb] Slow ADC channel in uV of all channels or specific ones from 0-7.
Example
-------
>>> d.slowadc
0: 0 uV
1: 0 uV
2: 0 uV
3: 0 uV
4: 0 uV
5: 0 uV
6: 0 uV
7: 0 uV
>>> d.slowadc[3]
0
"""
return SlowAdcProxy(self)
@property
@ -1340,6 +1370,7 @@ class Detector(CppDetectorApi):
@property
def settingslist(self):
"""List of settings implemented for this detector."""
return self.getSettingsList()
@property
@ -1489,18 +1520,20 @@ class Detector(CppDetectorApi):
@property
def rx_jsonpara(self):
"""
Get the receiver additional json parameter. In case the parameter is different between
the modules a list of strings will be returned. On setting the value is automatically
converted to a string.
Set the receiver additional json parameter.
Note
----
Use only if to be processed by an intermediate user process listening to receiver zmq packets, such as Moench \n
If not found, the pair is appended. Empty value deletes parameter. Max 20 characters for each key/value.\n
On setting the value is automatically, it is converted to a string.
Example
-----------
>>> d.rx_jsonpara['emin']
'4500'
>>> d.rx_jsonpara['emin'] = 5000
>>> d.rx_jsonpara
emax: 30
emin: 5000
"""
return JsonProxy(self)
@ -1508,6 +1541,21 @@ class Detector(CppDetectorApi):
@property
@element
def rx_jsonaddheader(self):
"""
Additional json header to be streamed out from receiver via zmq.
Note
-----
Default is empty. Max 20 characters for each key/value\n
Use only if to be processed by an intermediate user process listening to receiver zmq packets, such as Moench \n
Empty value deletes header.
Example
-------
>>> d.rx_jsonaddheader
{}
>>> d.rx_jsonaddheader = {"key1": "value1", "key2":"value2"}
>>> d.rx_jsonaddheader
{'emax': '30', 'emin': '50'}
"""
return self.getAdditionalJsonHeader()
@rx_jsonaddheader.setter
@ -2213,6 +2261,10 @@ class Detector(CppDetectorApi):
@property
@element
def samples(self):
"""
[CTB] Number of samples (both analog and digitial) expected. \n
[Moench] Number of samples (analog only)
"""
return self.getNumberOfAnalogSamples()
@samples.setter

View File

@ -51,12 +51,12 @@ class SlowAdcProxy:
def __repr__(self):
rstr = ''
for i in range(7):
for i in range(8):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item} mV' for item in r)
rstr += ' '.join(f'{item} uV' for item in r)
else:
rstr += f'{i}: {r} mV\n'
rstr += f'{i}: {r} uV\n'
return rstr.strip('\n')

View File

@ -483,13 +483,15 @@ class Detector {
Result<defs::scanParameters> getScan(Positions pos = {}) const;
/** enables/ disables scans for dac, trimbits [Eiger/ Mythen3]
* TRIMBIT_SCAN. Enabling scan sets number of frames to number of steps in
* receiver. Disabling scan sets number of frames to 1 */
/** enables/ disables scans for dac and trimbits \n
* Enabling scan sets number of frames to number of steps in
* receiver. \n To cancel scan configuration, set dac to '0', which also
* sets number of frames to 1 \n [Eiger/ Mythen3] Trimbits using
* TRIMBIT_SCAN*/
void setScan(const defs::scanParameters t);
/** gets scan error message in case of error during scan in case of non
* blocking acquisition (startDetector, not acquire) */
/** Gets Scan error message if scan ended in error for non blocking
* acquisitions.*/
Result<std::string> getScanErrorMessage(Positions pos = {}) const;
///@{
@ -517,7 +519,7 @@ class Detector {
Result<int> getSelectedUDPInterface(Positions pos = {}) const;
/**
* [Jungfrau:
* [Jungfrau]
* Effective only when number of interfaces is 1.
* Options: 0 (outer, default), 1(inner)] //TODO: enum?
*/
@ -728,6 +730,9 @@ class Detector {
/** Client IP Address that last communicated with the receiver */
Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const;
/** Get thread ids from the receiver in order of [parent, tcp, listener 0,
* processor 0, streamer 0, listener 1, processor 1, streamer 1]. If no
* streamer yet or there is no second interface, it gives 0 in its place. */
Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
getRxThreadIds(Positions pos = {}) const;
///@{
@ -1408,7 +1413,8 @@ class Detector {
* (instead of executing line by line)*/
void setPattern(const std::string &fname, Positions pos = {});
/** [CTB][Moench][Mythen3] */
/** [CTB][Moench][Mythen3] [Ctb][Moench][Mythen3] Saves pattern to file
* (ascii). \n [Ctb][Moench] Also executes pattern.*/
void savePattern(const std::string &fname);
/** [CTB][Moench] */
@ -1487,8 +1493,10 @@ class Detector {
Result<std::map<std::string, std::string>>
getAdditionalJsonHeader(Positions pos = {}) const;
/** [Moench] If empty, reset additional json header. Max 20 characters for
* each key/value */
/** [Moench] If empty, reset additional json header. Default is empty. Max
* 20 characters for each key/value. Empty value deletes header. Use only if
* to be processed by an intermediate user process listening to receiver zmq
* packets such as in Moench */
void setAdditionalJsonHeader(
const std::map<std::string, std::string> &jsonHeader,
Positions pos = {});
@ -1498,9 +1506,9 @@ class Detector {
Positions pos = {}) const;
/**
* [Moench]
* Sets the value for additional json header parameters if found,
* else appends the parameter key and value
* If empty, deletes parameter. Max 20 characters for each key/value
* Sets the value for additional json header parameters. If not found,
* the pair is appended. Empty value deletes parameter. Max 20 characters
* for each key/value.
*/
void setAdditionalJsonParameter(const std::string &key,
const std::string &value,
@ -1630,7 +1638,7 @@ class Detector {
/** lock detector to one client IP. default is unlocked */
void setDetectorLock(bool lock, Positions pos = {});
/** Get last client IP saved on detector server */
/** Client IP Address that last communicated with the detector */
Result<sls::IpAddr> getLastClientIP(Positions pos = {}) const;
/** Execute a command on the detector server console */

View File

@ -1037,14 +1037,12 @@ std::string CmdProxy::Scan(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[dac_name|0|trimbit_scan] [start_val] [stop_val] "
"[step_size] [dac settling time ns|us|ms|s]\n\tConfigures to "
"scan dac and sets number of frames to number of steps. Must "
"acquire after this. \n\tTo cancel the scan configuration "
"set dac to '0' without further arguments, which also sets "
"number "
"of frames back to 1."
"\n\t[Eiger][Mythen3] Use trimbit_scan as dac name for a trimbit "
"scan."
"[step_size] [dac settling time ns|us|ms|s]\n\tEnables/ disables "
"scans for dac and trimbits \n\tEnabling scan sets number of "
"frames to number of steps in receiver. \n\tTo cancel scan "
"configuration, set dac to '0', which also sets number of frames "
"to 1. \n\t[Eiger][Mythen3] Use trimbit_scan as dac name for a "
"trimbit scan."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 0) {
@ -1990,7 +1988,7 @@ std::string CmdProxy::SlowAdc(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_channel (0-7 for channel]\n\t[Ctb] Slow "
"ADC channel in mV"
"ADC channel in uV"
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 1) {
@ -2355,9 +2353,8 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
if (action == defs::HELP_ACTION) {
os << "[key1] [value1] [key2] [value2]...[keyn] [valuen]"
"\n\tAdditional json header to be streamed out from receiver via "
"zmq. "
"Default is empty. Use only if to be processed by an "
"intermediate user process "
"zmq. Default is empty. Max 20 characters for each key/value. "
"Use only if to be processed by an intermediate user process "
"listening to receiver zmq packets. Empty value deletes header. "
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -2391,8 +2388,8 @@ std::string CmdProxy::JsonParameter(int action) {
if (action == defs::HELP_ACTION) {
os << "[key1] [value1]\n\tAdditional json header parameter streamed "
"out from receiver. If not found in header, the pair is "
"appended. "
"An empty values deletes parameter."
"appended. An empty values deletes parameter. Max 20 characters "
"for each key/value."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 1) {

View File

@ -1877,7 +1877,7 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
rx_lock, getRxLock, setRxLock, StringTo<int>,
"[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 "
"unlocks. Default is unlocked. 1: locks");
"unlocks. Default is unlocked.");
GET_COMMAND(
rx_lastclient, getRxLastClientIP,
@ -2282,8 +2282,8 @@ class CmdProxy {
EXECUTE_SET_COMMAND_NOID_1ARG(
savepattern, savePattern,
"[fname]\n\t[Ctb][Moench][Mythen3] Saves pattern to file (ascii). Also "
"executes pattern.");
"[fname]\n\t[Ctb][Moench][Mythen3] Saves pattern to file (ascii). "
"\n\t[Ctb][Moench] Also executes pattern.");
INTEGER_COMMAND_HEX_WIDTH16(patioctrl, getPatternIOControl,
setPatternIOControl, StringTo<uint64_t>,