Merge branch 'jungfrau1.1' into j6mode

This commit is contained in:
2021-08-02 08:55:46 +02:00
10 changed files with 172 additions and 76 deletions

View File

@ -1144,7 +1144,7 @@ class Detector {
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
/** [Jungfrau] Advanced \n
* Options: 0 - 15. Default: 0. \n
* Only for chipv1.0. Options: 0 - 15. Default: 0. \n
* The #images = #frames x #triggers x (#storagecells + 1) */
void setNumberOfAdditionalStorageCells(int value);
@ -1152,7 +1152,7 @@ class Detector {
Result<int> getStorageCellStart(Positions pos = {}) const;
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
* of the series. Options: 0-15. Default: 15.
* of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1.
*/
void setStorageCellStart(int cell, Positions pos = {});
@ -1160,7 +1160,8 @@ class Detector {
Result<ns> getStorageCellDelay(Positions pos = {}) const;
/** [Jungfrau] Advanced \n Additional time delay between 2 consecutive
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)\n
* Only applicable for chipv1.0.
*/
void setStorageCellDelay(ns value, Positions pos = {});
///@{

View File

@ -1850,21 +1850,21 @@ class CmdProxy {
INTEGER_COMMAND_SET_NOID_GET_ID(
storagecells, getNumberOfAdditionalStorageCells,
setNumberOfAdditionalStorageCells, StringTo<int>,
"[0-15]\n\t[Jungfrau] Number of additional storage cells. Default is "
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage cells. Default is "
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
"(#storagecells + 1).");
INTEGER_COMMAND_VEC_ID(
storagecell_start, getStorageCellStart, setStorageCellStart,
StringTo<int>,
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition "
"of the series. Default is 15. For advanced users only.");
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. For advanced users only.");
TIME_COMMAND(
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
"Additional time delay between 2 consecutive exposures in burst mode "
"(resolution of 25ns). For advanced users only.");
"(resolution of 25ns). Only applicable for chipv1.0. For advanced users only.");
/* Gotthard Specific */
TIME_GET_COMMAND(exptimel, getExptimeLeft,

View File

@ -288,30 +288,38 @@ TEST_CASE("storagecells", "[.cmd]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
"inconsistent #additional storage cells to test");
{
std::ostringstream oss;
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 1\n");
// chip version 1.0
if (det.getChipVersion().squash()*10 == 10) {
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
"inconsistent #additional storage cells to test");
{
std::ostringstream oss;
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 1\n");
}
{
std::ostringstream oss;
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 15\n");
}
{
std::ostringstream oss;
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 0\n");
}
{
std::ostringstream oss;
proxy.Call("storagecells", {}, -1, GET, oss);
REQUIRE(oss.str() == "storagecells 0\n");
}
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
det.setNumberOfAdditionalStorageCells(prev_val);
}
// chip version 1.1
else {
// cannot set number of addl. storage cells
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
}
{
std::ostringstream oss;
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 15\n");
}
{
std::ostringstream oss;
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 0\n");
}
{
std::ostringstream oss;
proxy.Call("storagecells", {}, -1, GET, oss);
REQUIRE(oss.str() == "storagecells 0\n");
}
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
det.setNumberOfAdditionalStorageCells(prev_val);
} else {
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
@ -329,10 +337,19 @@ TEST_CASE("storagecell_start", "[.cmd]") {
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_start 1\n");
}
{
// chip version 1.0
if (det.getChipVersion().squash()*10 == 10) {
std::ostringstream oss;
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_start 15\n");
}
// chip version 1.1
else {
// max is 3
REQUIRE_THROWS(proxy.Call("storagecell_start", {"15"}, -1, PUT));
std::ostringstream oss;
proxy.Call("storagecell_start", {"3"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_start 3\n");
}
{
std::ostringstream oss;
@ -359,25 +376,33 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getStorageCellDelay();
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
}
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {}, -1, GET, oss);
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
}
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_delay 0\n");
}
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setStorageCellDelay(prev_val[i], {i});
// chip version 1.0
if (det.getChipVersion().squash()*10 == 10) {
auto prev_val = det.getStorageCellDelay();
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
}
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {}, -1, GET, oss);
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
}
{
std::ostringstream oss;
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecell_delay 0\n");
}
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setStorageCellDelay(prev_val[i], {i});
}
}
// chip version 1.1
else {
// cannot set storage cell delay
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
}
} else {
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));