Merge branch 'eiger' of github.com:slsdetectorgroup/slsDetectorPackage into eiger

This commit is contained in:
maliakal_d 2020-07-31 08:51:04 +02:00
commit bd221fefe5
30 changed files with 229 additions and 102 deletions

View File

@ -12,7 +12,7 @@ hostname bchip007
0:rx_udpip 129.129.202.98
0:rx_hostname pc6898
0:outdir /bigRAID/datadir_gotthard/rec_test_data
0:vhighvoltage 120
0:highvoltage 120
master -1
sync none
outdir /bigRAID/datadir_gotthard/rec_test_data

View File

@ -6,12 +6,12 @@ hostname bchip074+bchip075+
0:extsig:0 trigger_in_rising_edge
0:rx_tcpport 1954
0:rx_udpport 50001
0:vhighvoltage 0
0:highvoltage 0
1:extsig:0 trigger_in_rising_edge
1:rx_tcpport 1955
1:rx_udpport 50002
1:vhighvoltage 0
1:highvoltage 0
##############################################################################
#########
@ -53,5 +53,5 @@ settings veryhighgain
exptime 0.000005
period 0.0001
vhighvoltage 90
highvoltage 90

View File

@ -498,4 +498,4 @@ rx_jsonpara detectorMode analog
reg 0x5e 0x00010000
#powerchip 1
vhighvoltage 90
highvoltage 90

View File

@ -6,7 +6,7 @@ hostname localhost
rx_hostname localhost
#powerchip 1
#vhighvoltage 200
#highvoltage 200
#extsig:0 trigger_in_rising_edge
#timing trigger

View File

@ -17,7 +17,7 @@ hostname bchip048+bchip052+
rx_hostname pcmoench01
powerchip 1
vhighvoltage 200
highvoltage 200
#extsig:0 trigger_in_rising_edge
#timing trigger

View File

@ -56,7 +56,7 @@ rx_discardpolicy discardpartial
adcpipeline 15
powerchip 1
vhighvoltage 90
highvoltage 90
#adcreg 0x14 0x40

View File

@ -19,7 +19,7 @@ hostname bchip007+bchip009+
0:rx_udpip 10.1.1.1
0:rx_hostname 129.129.202.134
0:outdir /data/speedt
0:vhighvoltage 120
0:highvoltage 120
#1:hostname bchip009
@ -37,7 +37,7 @@ hostname bchip007+bchip009+
1:rx_udpip 10.1.2.1
1:rx_hostname 129.129.202.134
1:outdir /data/speedt
1:vhighvoltage 120
1:highvoltage 120
master -1

View File

@ -196,7 +196,7 @@ sls_detector_put 0-parameters setup.det
\end{verbatim}
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{highvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
Other important settings that are configured in the {\tt{setup.det}} file are:
\begin{itemize}
\item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet.
@ -1156,10 +1156,10 @@ In 500k--2M pixel systems there is a hardware temperature safety switch, which w
The HV can also be set and read through the software:
\begin{verbatim}
./sls_detector_put vhighvoltage 150
./sls_detector_get vhighvoltage
./sls_detector_put highvoltage 150
./sls_detector_get highvoltage
\end{verbatim}
Note that the get {\tt{vhighvoltage}} would return the measured HV from the master module only. If getting the vhighvoltage for individual halfmodules, only the master will have a value different from -999.
Note that the get {\tt{highvoltage}} would return the measured HV from the master module only. If getting the highvoltage for individual halfmodules, only the master will have a value different from -999.
\appendix
@ -1411,7 +1411,7 @@ Environment variable SLSDETNAME can be set for using 2 different detectors from
\subsection{Measure the HV}
For every system:
\begin{itemize}
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get vhighvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get highvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
\item Hardware-wise (opening the detector) measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected.
\end{itemize}
@ -1462,7 +1462,7 @@ Scroll up in the terminal till you find:\\
There is also an easier way, that is that only the master module will return the real value of the HV. If you have more than 1 detector system, then you will have more than 1 physical master, as the HV needs to be applied to all the systems.
\begin{verbatim}
for i in $(seq 0 36); do sls_detector_put $i:vhighvoltage; done
for i in $(seq 0 36); do sls_detector_put $i:highvoltage; done
\end{verbatim}
Only the master will return to you a sensible number (150 normally). the others will return -999.
@ -1623,10 +1623,10 @@ ratecorr number
where {\tt{number}} is a string that should be interpreted as a float in s. 0.000000 means correction off. Values above zero are the value of $\tau$ in ns.
\item \begin{verbatim}
sls_detector_get vhighvoltage
vhighvoltage number
sls_detector_get highvoltage
highvoltage number
\end{verbatim}
where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
\item \begin{verbatim}
sls_detector_get busy

View File

@ -142,7 +142,7 @@
"vpreamp"; // sets/get vpreamp value (advanced! Mythen)
"vshaper1"; // sets/get vshaper1 value (advanced! Mythen)
"vshaper2"; // sets/get vshaper2 value (advanced! Mythen)
"vhighvoltage"; // sets/get vhighvoltage value (advanced! Chiptest board and Eiger)
"highvoltage"; // sets/get highvoltage value (advanced! Chiptest board and Eiger)
"vapower"; // sets/get vapower value (advanced! Chiptest board)
"vddpower"; // sets/get vddpower value (advanced! Chiptest board)
"vshpower"; // sets/get vshpower value (advanced! Chiptest board)

View File

@ -335,7 +335,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp n] Sets the DAC value of the preamp feedback to n.
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
\item[vhighvoltage n] Sets the DAC value of the high voltage to n (in V).
\item[highvoltage n] Sets the DAC value of the high voltage to n (in V).
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
@ -648,7 +648,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp] Returns the DAC value of the preamp feedback to n.
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
\item[vhighvoltage] Returns the DAC value of the high voltage to n.
\item[highvoltage] Returns the DAC value of the high voltage to n.
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).
@ -714,7 +714,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
sls_detector_put parameters setup.det
\end{verbatim}
In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{vhighvoltage 150}}.
In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{highvoltage 150}}.
\subsection{Standard acquisition}

View File

@ -322,7 +322,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp n] Sets the DAC value of the preamp feedback to n.
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
\item[vhighvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n.
\item[highvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n.
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
@ -594,7 +594,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp] Returns the DAC value of the preamp feedback to n.
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
\item[vhighvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n.
\item[highvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n.
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).

View File

@ -27,7 +27,7 @@ dr 32
threaded 1
tengiga 0
vhighvoltage 150
highvoltage 150
iodelay 660
#gappixels 1

View File

@ -1 +1 @@
vhighvoltage 200
highvoltage 200

View File

@ -508,11 +508,11 @@ class Detector(CppDetectorApi):
self.setSourceUDPMAC2(MacAddr(mac))
@property
def vhighvoltage(self):
def highvoltage(self):
return element_if_equal(self.getHighVoltage())
@vhighvoltage.setter
def vhighvoltage(self, v):
@highvoltage.setter
def highvoltage(self, v):
self.setHighVoltage(v)
@property

View File

@ -164,18 +164,18 @@ def test_cannot_set_fw_version(d):
def test_get_high_voltage_call_signature(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac')
d.high_voltage
m.assert_called_once_with('vhighvoltage', -1)
m.assert_called_once_with('highvoltage', -1)
def test_get_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac')
m.return_value = 80
assert d.high_voltage == 80
#self._api.setDac('vhighvoltage', -1, voltage)
#self._api.setDac('highvoltage', -1, voltage)
def test_set_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDac')
d.high_voltage = 80
m.assert_called_once_with('vhighvoltage', -1, 80)
m.assert_called_once_with('highvoltage', -1, 80)
def test_decode_hostname_two_names(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getHostname')

View File

@ -170,18 +170,18 @@ def test_set_counters_single(d, mocker):
# def test_get_high_voltage_call_signature(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac')
# d.high_voltage
# m.assert_called_once_with('vhighvoltage', -1)
# m.assert_called_once_with('highvoltage', -1)
# def test_get_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac')
# m.return_value = 80
# assert d.high_voltage == 80
# #self._api.setDac('vhighvoltage', -1, voltage)
# #self._api.setDac('highvoltage', -1, voltage)
# def test_set_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setDac')
# d.high_voltage = 80
# m.assert_called_once_with('vhighvoltage', -1, 80)
# m.assert_called_once_with('highvoltage', -1, 80)
# def test_decode_hostname_two_names(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getHostname')

View File

@ -10,5 +10,5 @@ sls_detector_put exptime 0.000005
sls_detector_put period 0.01
sls_detector_put vhighvoltage 90
sls_detector_put highvoltage 90

View File

@ -86,7 +86,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
@ -108,7 +108,7 @@
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
@ -156,7 +156,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
@ -178,7 +178,7 @@
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>-1</number>

View File

@ -560,9 +560,7 @@ void qTabAdvanced::ClearROI() {
void qTabAdvanced::SetROI() {
slsDetectorDefs::ROI roi;
roi.xmin = spinXmin->value();
roi.xmax = spinXmax->value();
slsDetectorDefs::ROI roi(spinXmin->value(), spinXmax->value());
// set roi
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";

View File

@ -2048,7 +2048,7 @@ void *start_timer(void *arg) {
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
int ntotpixels = 256 * 256 * 4;
LOG(logINFO, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
LOG(logDEBUG1, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
"packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n "
"ntotpixels:%d\n",
dr, bytesPerPixel, tgEnable, datasize, packetsize,
@ -2181,7 +2181,7 @@ void *start_timer(void *arg) {
usleep(eiger_virtual_transmission_delay_right);
sendUDPPacket(1, packetData2, packetsize);
}
LOG(logINFO, ("Sent frame: %d\n", iframes));
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes, (long long unsigned int)(frameNr + iframes)));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));

View File

@ -1559,9 +1559,7 @@ std::string CmdProxy::ROI(int action) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
defs::ROI t;
t.xmin = StringTo<int>(args[0]);
t.xmax = StringTo<int>(args[1]);
defs::ROI t(StringTo<int>(args[0]), StringTo<int>(args[1]));
det->setROI(t, det_id);
os << '[' << t.xmin << ", " << t.xmax << "]\n";
} else {

View File

@ -528,6 +528,7 @@ class CmdProxy {
{"cycles", "triggers"},
{"cyclesl", "triggersl"},
{"clkdivider", "speed"},
{"vhighvoltage", "highvoltage"},
{"digitest", "imagetest"},
/** temperature */
@ -654,7 +655,7 @@ class CmdProxy {
{"clkphase", &CmdProxy::ClockPhase},
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
{"clkdiv", &CmdProxy::ClockDivider},
{"vhighvoltage", &CmdProxy::vhighvoltage},
{"highvoltage", &CmdProxy::highvoltage},
{"powerchip", &CmdProxy::powerchip},
{"imagetest", &CmdProxy::imagetest},
{"extsig", &CmdProxy::ExternalSignal},
@ -1185,7 +1186,7 @@ class CmdProxy {
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the "
"clock to latch digital bits.");
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, StringTo<int>,
INTEGER_COMMAND(highvoltage, getHighVoltage, setHighVoltage, StringTo<int>,
"[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"

View File

@ -793,97 +793,97 @@ TEST_CASE("maxclkphaseshift", "[.cmd][.new]") {
}
}
TEST_CASE("vhighvoltage", "[.cmd][.new]") {
TEST_CASE("highvoltage", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
auto prev_val = det.getHighVoltage();
// selected values
if (det_type == defs::GOTTHARD) {
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("highvoltage", {"50"}, -1, PUT));
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"90"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 90\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 90\n");
proxy.Call("highvoltage", {"90"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 90\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 90\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 0\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 0\n");
proxy.Call("highvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 0\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 0\n");
}
}
// range 0, 60 - 200
else if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
det_type == defs::MOENCH) {
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("highvoltage", {"50"}, -1, PUT));
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"90"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 90\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 90\n");
proxy.Call("highvoltage", {"90"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 90\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 90\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 0\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 0\n");
proxy.Call("highvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 0\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 0\n");
}
}
// full range 0 - 200 (get needs to wait)
else if (det_type == defs::EIGER) {
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"50"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 50\n");
proxy.Call("highvoltage", {"50"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 50\n");
std::this_thread::sleep_for(std::chrono::seconds(2));
proxy.Call("vhighvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 50\n");
proxy.Call("highvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 50\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"120"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 120\n");
proxy.Call("highvoltage", {"120"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 120\n");
std::this_thread::sleep_for(std::chrono::seconds(2));
proxy.Call("vhighvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 120\n");
proxy.Call("highvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 120\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"0"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 0\n");
proxy.Call("highvoltage", {"0"}, 0, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 0\n");
std::this_thread::sleep_for(std::chrono::seconds(2));
proxy.Call("vhighvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 0\n");
proxy.Call("highvoltage", {}, 0, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 0\n");
}
}
// full range 0 - 200
else {
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"50"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 50\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 50\n");
proxy.Call("highvoltage", {"50"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 50\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 50\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"120"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 120\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 120\n");
proxy.Call("highvoltage", {"120"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 120\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 120\n");
}
{
std::ostringstream oss1, oss2;
proxy.Call("vhighvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "vhighvoltage 0\n");
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "vhighvoltage 0\n");
proxy.Call("highvoltage", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "highvoltage 0\n");
proxy.Call("highvoltage", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "highvoltage 0\n");
}
}
for (int i = 0; i != det.size(); ++i) {

View File

@ -7,6 +7,7 @@
#include "ToString.h"
#include "ZmqSocket.h" //just for the zmq port define
#include "file_utils.h"
#include "masterFileAttributes.h"
#include <cerrno> //eperm
#include <chrono>

View File

@ -0,0 +1,116 @@
#pragma once
#include "sls_detector_defs.h"
#include "logger.h"
#include "ToString.h"
// versions
#define HDF5_WRITER_VERSION (6.1) // 1 decimal places
#define BINARY_WRITER_VERSION (6.1) // 1 decimal places
class masterFileAttributes {
public:
double version{0.0};
slsDetectorDefs::detectorType detType{slsDetectorDefs::GENERIC};
uint32_t imageSize{0};
slsDetectorDefs::xy nPixels{};
uint32_t maxFramesPerFile{0};
uint64_t totalFrames{0};
uint64_t exptimeNs{0};
uint64_t periodNs{0};
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t subExptimeNs{0};
uint64_t subPeriodNs{0};
uint32_t quadEnable{0};
uint32_t adcmask{0};
uint32_t analogFlag{0};
uint32_t digitalFlag{0};
uint32_t dbitoffset{0};
uint64_t dbitlist{0};
slsDetectorDefs::ROI roi{};
uint64_t exptime1Ns{0};
uint64_t exptime2Ns{0};
uint64_t exptime3Ns{0};
uint64_t gateDelay1Ns{0};
uint64_t gateDelay2Ns{0};
uint64_t gateDelay3Ns{0};
uint32_t gates;
/*
double version{0.0};
slsDetectorDefs::detectorType myDetectorType{slsDetectorDefs::GENERIC};
uint32_t imageSize{0};
uint32_t nPixelsX{0};
uint32_t nPixelsY{0};
uint32_t maxFramesPerFile{0};
uint64_t totalFrames{0};
uint64_t exptimeNs{0};
uint64_t periodNs{0};
*/
/* eiger
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t subExptimeNs{0};
uint64_t subPeriodNs{0};
uint32_t quadEnable{0};
*/
/** moench
uint32_t tenGiga{0};
uint32_t adcmask{0};
*/
/* ctb
uint32_t tenGiga{0};
uint32_t adcmask{0};
uint32_t analogFlag{0};
uint32_t digitalFlag{0};
uint32_t dbitoffset{0};
uint64_t dbitlist{0};
*/
/* gotthard
uint32_t roiXmin{0};
uint32_t roiXmax{0};
*/
/* mythen3
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t exptime1Ns{0};
uint64_t exptime2Ns{0};
uint64_t exptime3Ns{0};
uint64_t gateDelay1Ns{0};
uint64_t gateDelay2Ns{0};
uint64_t gateDelay3Ns{0};
uint32_t gates;
*/
masterFileAttributes(){};
virtual ~masterFileAttributes(){};
std::string GetBinaryMasterFileAttributes() {
std::ostringstream oss;
oss << "Version : " << std::setprecision(2) << version << '\n'
<< "Detector Type : " << sls::ToString(detType) << '\n'
<< "Image Size : " << imageSize << " bytes" << '\n'
<< "nPixels : " << sls::ToString(nPixels) << " pixels" << '\n'
<< "Max Frames Per File : " << maxFramesPerFile << '\n'
<< "Total Frames : " << totalFrames << '\n'
<< "Exptime (ns) : " << exptimeNs << '\n'
<< "Period (ns) : " << periodNs << '\n';
return oss.str();
};
// hdf5
};
class GotthardMasterFileAttributes : public masterFileAttributes {
public:
GotthardMasterFileAttributes() {};
std::string GetBinaryMasterFileAttributes() {
std::ostringstream oss;
oss << masterFileAttributes::GetBinaryMasterFileAttributes()
<< "Roi (xmin, xmax) : " << sls::ToString(roi) << '\n';
return oss.str();
};
};

View File

@ -39,10 +39,6 @@
// hdf5
#define MAX_CHUNKED_IMAGES (1)
// versions
#define HDF5_WRITER_VERSION (6.0) // 1 decimal places
#define BINARY_WRITER_VERSION (6.0) // 1 decimal places
// parameters to calculate fifo depth
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
#define MAX_EIGER_ROWS_PER_READOUT (256)
@ -57,6 +53,9 @@
#define STREAMER_PRIORITY (10)
#define TCP_PRIORITY (10)
#define HDF5_WRITER_VERSION (6.1) // 1 decimal places
#define BINARY_WRITER_VERSION (6.1) // 1 decimal places
struct masterAttributes {
double version;
uint32_t detectorType;

View File

@ -39,6 +39,8 @@ std::string ToString(const std::vector<defs::dacIndex> &vec);
std::string ToString(const defs::burstMode s);
std::string ToString(const defs::timingSourceType s);
std::string ToString(const slsDetectorDefs::xy &coord);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
std::string ToString(const slsDetectorDefs::ROI &roi);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
std::string ToString(const slsDetectorDefs::rxParameters &r);

View File

@ -160,6 +160,8 @@ class slsDetectorDefs {
struct ROI {
int xmin{-1};
int xmax{-1};
ROI() = default;
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax){};
} __attribute__((packed));
#else
typedef struct {

View File

@ -3,6 +3,16 @@
namespace sls {
std::string ToString(const slsDetectorDefs::xy &coord) {
std::ostringstream oss;
oss << '[' << coord.x << ", " << coord.y << ']';
return oss.str();
}
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord) {
return os << ToString(coord);
}
std::string ToString(const slsDetectorDefs::ROI &roi) {
std::ostringstream oss;
oss << '[' << roi.xmin << ", " << roi.xmax << ']';
@ -492,7 +502,7 @@ std::string ToString(const defs::dacIndex s) {
case defs::TRIMBIT_SCAN:
return std::string("trimbit_scan");
case defs::HIGH_VOLTAGE:
return std::string("vhighvoltage");
return std::string("highvoltage");
case defs::IO_DELAY:
return std::string("iodelay");
default:
@ -850,7 +860,7 @@ template <> defs::dacIndex StringTo(const std::string &s) {
return defs::IBIAS_SFP;
if (s == "trimbit_scan")
return defs::TRIMBIT_SCAN;
if (s == "vhighvoltage")
if (s == "highvoltage")
return defs::HIGH_VOLTAGE;
if (s == "iodelay")
return defs::IO_DELAY;

View File

@ -221,13 +221,13 @@ TEST_CASE("Detector type") {
}
TEST_CASE("Formatting slsDetectorDefs::ROI") {
slsDetectorDefs::ROI roi{5, 159};
slsDetectorDefs::ROI roi(5, 159);
REQUIRE(ToString(roi) == "[5, 159]");
}
TEST_CASE("Streaming of slsDetectorDefs::ROI") {
using namespace sls;
slsDetectorDefs::ROI roi{-10, 1};
slsDetectorDefs::ROI roi(-10, 1);
std::ostringstream oss;
oss << roi;
REQUIRE(oss.str() == "[-10, 1]");