Compare commits

..

458 Commits

Author SHA1 Message Date
a0c222b3c6 constructor 2020-01-20 14:23:28 +01:00
66b837eb59 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-01-16 16:57:12 +01:00
6170c42618 explicit also in MacAddr 2020-01-16 16:57:04 +01:00
69dd5f3b5e Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-01-16 16:37:44 +01:00
c1fac7cdb7 fixed conversion for IpAddr 2020-01-16 16:31:11 +01:00
de57146e1b Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-01-16 16:14:11 +01:00
fb75986c55 mythne3: counters fixed 2020-01-16 16:13:40 +01:00
f3598c1f39 nullptr 2020-01-16 14:17:57 +01:00
9ac08ad5c9 clang-tidy header include order 2020-01-16 14:00:43 +01:00
bcb4942793 cleaning 2020-01-16 12:26:22 +01:00
4b69ac5cfc const string& in exceptions constructor 2020-01-16 11:44:01 +01:00
7a00732fa8 various minor things from clang-tidy 2020-01-16 11:39:35 +01:00
30a4a1740f added Mythen3 2020-01-15 17:56:08 +01:00
39ec29c0e6 added counters to python 2020-01-15 17:26:07 +01:00
de53747ddd Counters (#71)
* mythen3: adding counters mask, firmware still takes only number of counters for now

* mythen3: checking if module attached before powering on chip

* bug fix: loop inital declaration not allowed in c

* fix scope eiger test

* mythen3: renamed setCounters to setCounterMask and getCounterMask in API

* mythen3 replacing counting bits with popcount

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2020-01-14 17:40:46 +01:00
70c54f4315 added jungfrau again 2020-01-13 18:26:24 +01:00
a709384fbb renamed python detector 2020-01-13 16:33:02 +01:00
a1abd7587c Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-01-13 16:13:52 +01:00
8c8d213b56 python funcs 2020-01-13 16:13:47 +01:00
7b31fbc002 eiger virtual server bug fix: increasing subdeadtime 2020-01-13 14:18:43 +01:00
db9aa7589a tests fix 2020-01-13 12:07:30 +01:00
28f8a76dcc updated binaries 2020-01-10 09:05:26 +01:00
dac5ecd123 dbit 2020-01-08 16:44:42 +01:00
71b0ed271e CTB 2020-01-08 15:33:28 +01:00
c223f00511 Eiger 2020-01-08 14:55:16 +01:00
639ed52d65 pybind 2.4 2020-01-07 16:30:59 +01:00
6943763e3d Updated pybind11 to 2.4.3 2020-01-07 16:30:12 +01:00
4b3b518401 asamples dsamples 2020-01-07 16:18:36 +01:00
7379b1e2ef added python3.8 2020-01-07 15:48:38 +01:00
ed2a69744b Auto generating Python bindings (#70)
Auto generating python bindings
2020-01-07 15:47:38 +01:00
086cbacd84 mythen3: connected busy signal insttead of timer 2019-12-10 11:03:27 +01:00
af9b25fd67 eiger: validate trimval range 2019-12-10 10:32:28 +01:00
504fc2d095 ctb: validate asampes and dsamples > 0 for romode; client: exception caught in acquire to stop receiver and clear busy flag 2019-12-10 10:25:14 +01:00
5cf1502287 ctb bug fix: 10g adc enable mask 2019-12-09 11:30:54 +01:00
8881542156 ctb bug fix: clkioctrl not taken in hex 2019-12-05 17:15:31 +01:00
d9ae9a8cc6 eiger test 2019-12-05 11:00:55 +01:00
6765eb0c94 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-12-04 10:25:25 +01:00
be3d82b7b4 format 2019-12-04 10:25:17 +01:00
4e0d1fa711 ctb rxr for pawel: updated packetsize to 8192 (datasize to 8144) 2019-12-03 17:25:39 +01:00
619106e05f eiger tests 2019-12-03 11:47:49 +01:00
9bc60518d8 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-12-03 10:12:58 +01:00
12d168a6ef const strref 2019-12-03 10:12:47 +01:00
1a8337540a rxr: switched to threads for threadObject (from pthread), moved priorities to threadObject, mutex 2019-11-29 16:19:02 +01:00
16bec25b0c rxr: pthread to thread and created and destroyed tcp thread in constructor and destructor 2019-11-29 15:17:41 +01:00
f178b0da39 Merge branch 'rxr' into developer 2019-11-29 11:10:05 +01:00
2ece6b945e rxr: warnings shouldnt throw exception 2019-11-29 11:09:41 +01:00
1d6be74ee5 rxr: removed return ok or fail and replaced with exceptions 2019-11-29 10:29:36 +01:00
07455bb11e Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 18:42:27 +01:00
f4cdd759b0 clang-tidy 2019-11-27 18:42:16 +01:00
796890d1c8 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 18:25:14 +01:00
3486137de3 bfin warnings fixed 2019-11-27 18:22:33 +01:00
d53082c615 clang-tidy empty() 2019-11-27 18:15:55 +01:00
c94f6a2bf2 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 17:56:02 +01:00
2364364697 minor 2019-11-27 17:55:50 +01:00
ad0fb44573 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 17:29:26 +01:00
9455a5fba1 ctb: adcenable10g included, 10g readout enables included 2019-11-27 17:28:57 +01:00
a28fa66e54 renamed CmdLineParser to CmdParser 2019-11-27 13:56:14 +01:00
e996068328 more tests 2019-11-27 13:39:06 +01:00
1bbd77536c Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 11:35:16 +01:00
ace105a268 more tests 2019-11-27 11:35:00 +01:00
f299a34e59 ctb server binary update 2019-11-27 11:31:30 +01:00
b1c93bb3df Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-27 11:12:43 +01:00
9e8a874e39 rxr bug fix: update shm when updating rxr 2019-11-27 11:12:31 +01:00
2c7b730987 more tests 2019-11-27 11:12:18 +01:00
4fe1a2c6df eiger dacs 2019-11-27 08:41:23 +01:00
1322cff405 some eiger dacs 2019-11-26 21:37:57 +01:00
7f3d5e8a7e WIP 2019-11-26 20:34:17 +01:00
bf199767dc more rx tests 2019-11-25 16:32:12 +01:00
eaae54ebf5 fixed script for py36 2019-11-25 15:13:48 +01:00
6889741480 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-25 14:56:24 +01:00
3030c262f1 rx tests 2019-11-25 14:56:15 +01:00
6b391a34dc gotthard2: bug fix adconfiguration initialization 2019-11-25 14:14:05 +01:00
a2dd35ae38 minor 2019-11-25 13:01:07 +01:00
e00c5068af added list of tests 2019-11-25 12:53:45 +01:00
c951b10b0f fixed public header list 2019-11-25 12:11:23 +01:00
c5012a2d5a moving some tests 2019-11-25 12:08:27 +01:00
58050f72da moved headers 2019-11-25 11:58:45 +01:00
eae1fb6609 WIP 2019-11-25 11:42:21 +01:00
5b5e0f109b Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-25 11:20:33 +01:00
f2e69fb5a3 WIP 2019-11-25 11:20:24 +01:00
adf6a4c471 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-25 10:54:39 +01:00
94382c1ece m3 and g2: while setting clock freq, change phase only if there is a change in phase (removing more printouts, will still only set if needed ) 2019-11-25 10:54:30 +01:00
28f1f6c1cd more tests 2019-11-24 17:48:08 +01:00
a95ab1e13e servers: default compile not update versionign 2019-11-22 17:23:07 +01:00
5e9d70948b Merge branch 'userid' into developer 2019-11-22 17:03:17 +01:00
b0073597f7 rxr: effective userid option in rxr 2019-11-22 17:03:08 +01:00
c4675da0c3 m3: reset fixed 2019-11-22 16:40:43 +01:00
ba008db29a m3 ang g2: reset not yet imple 2019-11-22 11:54:45 +01:00
950096daf9 m3 ang g2: reset not yet imple 2019-11-22 11:54:30 +01:00
d07873ee39 mythen3 and gotthard2: wait request not needed, reset to be implemented 2019-11-22 11:29:24 +01:00
f8df11886a ctb: change in phase done in degrees (phase reset due to change in frequency) 2019-11-21 15:08:38 +01:00
d976c9fcf9 gotthard2: phase direction like mythen3 2019-11-21 14:41:54 +01:00
c4ae32b216 mythen3: setting clk frequecy and phase shifts work 2019-11-21 14:36:37 +01:00
c689b8b954 Merge branch 'developer' into rxr 2019-11-21 13:51:19 +01:00
fea94b15d5 mythen3:forgot binary 2019-11-21 13:48:39 +01:00
955bc74a91 mythen3: change vco freq to 1.25GHz 2019-11-21 13:38:54 +01:00
8727a93e3e WIP 2019-11-21 12:35:07 +01:00
83221ee955 Rxr: rearrangng in implementation 2019-11-21 12:23:32 +01:00
398f3734ec rxr: missing packets, stopacquistion lets rxr know to calculate missing packets from last frame caught 2019-11-20 16:16:14 +01:00
f96f716f39 rxr: stop printing forever about weird carry flag frame 2019-11-20 12:13:35 +01:00
781e8fc67f mythen3: workaround for busy signal 2019-11-20 11:57:14 +01:00
66e9b80995 gui: discard bits loop only when discard bits enabled 2019-11-20 10:58:32 +01:00
7bde337d58 minor: changed interrupted acq help (clearbusy), gui look in mythen3 developer tab 2019-11-19 18:19:54 +01:00
1cea6af590 mythen3, gotthard2: change phase, change freq bugfix 2019-11-19 17:57:28 +01:00
1539326fda mythen3 gui: discard bits option for debugging 2019-11-18 18:33:16 +01:00
dfc886a65b mythen3 gui 2019-11-18 17:57:19 +01:00
c4e7086d99 rxr: renamed files, removed unnecessary comments 2019-11-18 16:19:46 +01:00
5ce79ec9fa WIP 2019-11-18 15:20:58 +01:00
dc78e23449 rxr: removed slsReceiverUsers, start() and stop() 2019-11-18 15:16:20 +01:00
f2c0ff7f98 rxr: removed char array memebers in rxrimplementation 2019-11-18 14:29:01 +01:00
32cf46a8a3 moved cmdlineparser.h to includes, Paralel calls edited to throw exception if no detector added 2019-11-18 11:00:25 +01:00
fa2c842745 New command line app and removing slsDetectorCommand (#69)
* WIP

* WIP

* WIP

* WIP

* config2 working

* removed slsDetectorCommand

* WIP

* added test file

* more tests
2019-11-18 09:29:17 +01:00
6a27207875 gotthard2: vetoref, burstmode 2019-11-15 18:59:27 +01:00
a62d6a2fb8 gotthard2: veto reference, better code for byte aligment in server 2019-11-15 11:58:23 +01:00
5518531620 gotthard2: veto reference 2019-11-14 19:01:10 +01:00
fd631ebb71 tests fixed for inj_ch 2019-11-13 16:54:20 +01:00
21d23be522 gotthard2: inejct channel done 2019-11-13 16:49:35 +01:00
28a5aa8342 injectchannel WIP 2019-11-13 15:11:11 +01:00
5ee3f5cf4c rxr bug fix: if no rxr, shm variables should remember so that there is no order to rxr commands in config file 2019-11-13 13:56:09 +01:00
72ac2745ea gotthard2: server fix enum for onchip dac 2019-11-12 12:11:52 +01:00
206041989f mythen3, reading dr back fix 2019-11-11 18:33:59 +01:00
2fff9f5bfe merge 2019-11-11 18:03:13 +01:00
90c34e4942 gotthard2, dacs and onchip dacs from config file 2019-11-11 18:02:08 +01:00
bb26b993ea servers, firmware check message to init message, minor 2019-11-11 12:00:04 +01:00
d7ad995dd1 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-11 11:40:27 +01:00
f53d260202 mythen3: change vph and vpl 2019-11-11 11:40:06 +01:00
35556e96d1 mythen3 channels size 2019-11-11 11:31:03 +01:00
2123fb47a5 mythen3: config reg enable all counters, dr 2019-11-11 10:41:42 +01:00
38ad5d7931 mythen3 rxr 2019-11-08 18:11:27 +01:00
aaeaeab576 gotthard2 on chip dacs: -1 should set for all chips 2019-11-08 17:20:47 +01:00
03ec2c53ab WIP 2019-11-08 17:10:28 +01:00
d7e2ab8ec4 gotthard2: on chip dacs 2019-11-08 17:09:57 +01:00
a92d931a8f mythen3 frequency fixes 2019-11-07 14:35:13 +01:00
615b3b2557 WIP 2019-11-06 19:07:00 +01:00
1797d39216 updated mythen3 to configure phase, freq, delay left, period left, actual time, measurement time, framesfrom start and othe register mappings 2019-11-06 18:58:22 +01:00
0f9fd5cd73 rename of clkdivider to clkfrequency in servers 2019-11-06 16:58:34 +01:00
73b5c3ac57 merge 2019-11-06 16:46:00 +01:00
18b8720c17 separated parameters and versions 2019-11-06 16:43:59 +01:00
7de9401bc7 powerchip for mythen3 2019-11-06 11:50:09 +01:00
705ddb7f42 WIP 2019-11-06 11:11:57 +01:00
8eb04c33b5 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-11-06 11:09:56 +01:00
cd5d327988 virtual servers updated 2019-11-06 11:09:48 +01:00
c3180737ed fixed jungfau virtual server as well 2019-11-06 11:05:02 +01:00
ba37a51858 eiger virtual server exptime fixed 2019-11-06 10:54:33 +01:00
2417f9cd7b enums 2019-11-06 10:26:21 +01:00
b61ca18967 unrequired enum 2019-11-05 18:57:05 +01:00
567e821569 updated ieger server 2019-11-05 18:52:51 +01:00
1f64d2a4e2 speed separated 2019-11-05 18:50:35 +01:00
96d64778ee eiger virtual server bug fix, detectorip and detectormac of hostpc 2019-11-05 14:46:58 +01:00
2f2e4da628 Moved CmdLineProxy 2019-11-05 11:07:07 +01:00
b3587bcee5 new enums 2019-11-05 10:20:25 +01:00
40572b6b23 WIP 2019-11-04 16:48:40 +01:00
031241ae28 timer split up 2019-11-04 16:40:11 +01:00
f9fff97f8a mythen3 register mix up 2019-10-31 14:48:53 +01:00
6c5c4f00b3 mythen3 calc checksum 2019-10-31 12:31:51 +01:00
ba9a0c7917 removed unused multi functions 2019-10-30 18:20:16 +01:00
ba3bc9c408 starting of users class 2019-10-30 15:13:16 +01:00
026771f42d bug fix:temp in gui 2019-10-30 13:58:37 +01:00
d05be2519a WIP 2019-10-30 12:32:50 +01:00
11ea071543 adcinvert for jungfrau, gui for jungfrau dacs 2019-10-30 12:28:51 +01:00
4aba8b6ac0 daclist and dacvalues for ctb as well 2019-10-30 11:38:29 +01:00
82570bc084 daclist and dacvalues 2019-10-30 11:09:34 +01:00
fe467cdf70 jungfrau dacs named 2019-10-29 18:11:16 +01:00
925a750f9a WIP 2019-10-29 14:46:45 +01:00
eb2040f0a7 fixed effects of scan 2019-10-29 14:43:51 +01:00
4b2cb7ecc1 WIP 2019-10-29 11:35:25 +01:00
badff47663 WIP 2019-10-29 11:05:20 +01:00
1084e5361b WIP 2019-10-29 10:49:05 +01:00
828859838b WIP 2019-10-29 10:44:10 +01:00
9b7ef84515 WIP 2019-10-29 10:29:30 +01:00
aa8610fb04 WIP 2019-10-29 10:11:36 +01:00
798f221764 WIP 2019-10-29 10:07:07 +01:00
4155e301b8 WIP 2019-10-28 16:48:13 +01:00
8c279695de WIP 2019-10-28 16:27:20 +01:00
bc7ebd45df WIP 2019-10-28 15:59:18 +01:00
3fdae431b0 WIP 2019-10-28 15:47:18 +01:00
7b59b7e7d5 WIP 2019-10-28 12:26:30 +01:00
19b85b8e40 WIP 2019-10-28 11:56:15 +01:00
61d7c76d55 WIP 2019-10-28 11:34:58 +01:00
93bb0c9aed WIP 2019-10-28 11:17:27 +01:00
f9d832bf34 WIP 2019-10-24 19:39:58 +02:00
8e771c48bd WIP 2019-10-24 19:30:58 +02:00
5a49182626 WIP 2019-10-24 19:20:55 +02:00
f4a0780b51 patloops done 2019-10-24 18:59:23 +02:00
f73a15e786 tests made to pass ctb 2019-10-24 11:32:58 +02:00
fa84d17a19 gotthard tests passed 2019-10-22 17:07:38 +02:00
12c7389b8d tests made to check for nothrow 2019-10-22 16:17:43 +02:00
8006043a97 bug fixes for tests 2019-10-22 15:46:28 +02:00
45012df95b jungfrau registers updated 2019-10-22 14:02:52 +02:00
8c6da7da1b jungfrau storage cell bug fix 2019-10-22 13:38:17 +02:00
f2fc187f13 better testing for eiger 2019-10-21 15:10:31 +02:00
fee110c73a bugfix: flowcontrol10g cmdline typo 2019-10-21 10:59:52 +02:00
995f0924e5 Commandline (#66)
* WIP

* WIP

* removed status to string from defs

* WIP

* WIP

* WIP removed unused functions in multi

* WIP

* print hex in a terrible way

* WIP, loadconfig error

* WIP, type to string

* WIP

* fix to conversion

* WIP, hostname doesnt work

* WIP

* WIP

* WIP

* WIP, threshold

* WIP, threshold

* WIP

* WIP, triggers

* WIP, cycles to triggers

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* rx_udsocksize fx, WIP

* WIP

* WIP

* WIP

* file index (64 bit), WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* merge

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* New python mod
2019-10-21 10:29:06 +02:00
eebc1109b0 python 2019-10-18 15:02:39 +02:00
97d1c520e6 python 2019-10-18 12:24:17 +02:00
3822258dfa Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-10-17 18:30:45 +02:00
df4f37efc6 gotthard2, change clock, remember in degrees, and max clock divider is 512 2019-10-17 18:29:57 +02:00
107234f4c5 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-10-17 17:09:09 +02:00
59a7a462ab python 2019-10-17 17:09:01 +02:00
e16212bd23 tests for clk for gotthard2 2019-10-17 16:51:40 +02:00
be50344b45 set clock divider, phase and get clock freq for gotthard2, priliminary 2019-10-17 16:39:41 +02:00
0a3905802f removed dacs not required for mythen3 2019-10-09 16:59:34 +02:00
833c07707f gotthard2 dac commands removed in merge, added back 2019-10-09 16:56:34 +02:00
9b4fc02b0e start/stop statemachine for my3 (#68)
* start/stop statemachine for my3

* runStatus, readFrame, runBusy (use CONTROL_REG) for mythen3

* registers for Pavel

* change dac names Mythen3
2019-10-09 13:52:07 +02:00
b109ea8d7d jungfrau vref_prech, dac enum similar to mainenum 2019-10-08 18:00:22 +02:00
29a7e227a3 merge 2019-10-08 17:17:44 +02:00
cfd3680176 gotthard2 dacs 2019-10-08 17:10:36 +02:00
87aa5099f2 eiger python 2019-10-08 12:15:57 +02:00
030cfacc9b WIP 2019-10-08 10:57:07 +02:00
b318f8126d more python funcs 2019-10-07 17:24:28 +02:00
17295bf662 Update slsDetectorCommand.cpp
complete description of the Mythen3 DACs
2019-10-07 14:39:52 +02:00
58cadefa61 fixed enum 2019-10-07 14:30:16 +02:00
e0d10d0e01 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-10-07 14:18:06 +02:00
6964326c7f python 2019-10-07 14:17:54 +02:00
6cda61a612 Update slsDetectorCommand.cpp
help comments for the mythen3 dacs (not complete yet)
2019-10-07 13:44:41 +02:00
7a66dd08a3 help for dacs mythen3 2019-10-07 12:30:28 +02:00
5f94b5c246 Dac (#67)
* dac WIP

* dacs WIP

* DACs are working with names

* namechanges of vrfsh->vshaper, vrfshnpol->vshaperneg

* pattern for MY3, configure MAC for MY3
2019-10-07 12:13:25 +02:00
16f7b42533 python 2019-10-07 10:23:40 +02:00
1b06edac9b FixedCapacityContainer fix for clang 2019-10-04 16:54:53 +02:00
d597636c1e Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-10-01 17:35:03 +02:00
0f99dd141e gotthard 2 server test bus 2019-10-01 17:34:52 +02:00
da630a8e05 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-10-01 17:29:47 +02:00
cfb017f66a fixed order 2019-10-01 17:29:36 +02:00
b3ff825ce8 updated gotthard2 api etc 2019-10-01 16:26:42 +02:00
c6fd13e49c removed default case 2019-10-01 14:54:57 +02:00
e6472da5f1 error on missing return type 2019-10-01 14:35:25 +02:00
5de5884341 pass by reference 2019-10-01 14:31:00 +02:00
b4f3c0586f string to detector type 2019-10-01 13:56:35 +02:00
aaade64e0b ToString of runStatus 2019-10-01 12:34:03 +02:00
ffa9bbe8d2 fix for string to string conversion 2019-10-01 12:18:06 +02:00
3c6d7ca4a5 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-09-30 15:00:11 +02:00
7242a6901a python compiles 2019-09-30 15:00:03 +02:00
2a40c7f48e recompiled all servers 2019-09-30 14:54:31 +02:00
ca054626e6 Removeudpcache (#65)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* solved eiger 1-10g issue

* some fixes for remove udp cache to work

* bug fix virtual

* removed special handling of rx_udpip
2019-09-30 14:46:25 +02:00
6e6fcec698 MY3.0:read and write Registers, frames, cycles, delay (#64)
* MY3.0:read and write Registers, frames, cycles, delay

* write pattern seems to work

* done all corrections. added default clks: run_clk=125MHz, tick_clk=20MHz (fix), sampling_clk=80MHz (from Carlos)

* clk check for aquistition time

* clk check for aquistition time

* Update slsDetectorServer_defs.h

* Update slsDetectorFunctionList.c
2019-09-30 14:36:33 +02:00
3d52a2f169 minor chnages 2019-09-27 16:39:46 +02:00
8a4a6c7004 hvdac location change 2019-09-27 16:17:01 +02:00
288b59d292 gotthard2 changes for first firmware version 2019-09-26 14:10:11 +02:00
296518819e Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-09-25 12:14:41 +02:00
2a48f70320 Fixed all warning in moenchZmqProcess 2019-09-25 12:14:15 +02:00
07f71d3886 more funcs 2019-09-20 17:46:52 +02:00
dde24559f3 python bindings 2019-09-20 17:01:37 +02:00
b591a42ae7 add 2019-09-20 15:33:07 +02:00
032b4117dd auto generate py enums 2019-09-20 15:28:14 +02:00
af9c67539f more tests 2019-09-20 10:46:28 +02:00
27d223d199 testing 2019-09-19 12:12:25 +02:00
26bc737445 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-09-18 13:22:00 +02:00
61c495f218 multithreading fixed for gain map, common mode and ghosting 2019-09-18 13:21:47 +02:00
c3c3f78c59 removed roflags from python 2019-09-17 09:32:22 +02:00
400e69cef2 Added define for high z cluster finder and fixed gainmap (t.b.t.) 2019-09-10 16:34:29 +02:00
1cf5033c99 depreciated flags to romode, not readout 2019-09-03 12:53:22 +02:00
21ce0055b2 gotthard2: soft limit to list 2019-09-03 09:41:54 +02:00
4b987abf41 Niosmarie (#63)
* HV for Mythen3 server

* HV for mythen3 server

* corrected upstreams

* missing endif
2019-09-03 09:36:02 +02:00
40b62ef5a4 recompiled binaries 2019-09-02 19:31:36 +02:00
5bcde789ac Readoutflags (#61)
* WIP

* eiger binary back wih versioning

* fixed readout flag in ctbgui, added speedLevel enum

* ctbgui: fixed a print out error

* ctb readout bug fix

* WIP

* WIP

* WIP
2019-09-02 19:27:27 +02:00
221bb65c0e gotthard2: bfin instead of nios (not using registers yet) 2019-09-02 13:11:07 +02:00
02634abbbc gotthard2:virtual server fix, server recompile 2019-09-02 13:05:28 +02:00
bd95126da2 gotthard2:hv 2019-09-02 12:57:24 +02:00
4a112104ad gotthard2, removed .gdb, removed warnings 2019-08-30 18:08:16 +02:00
9bc6c44e51 hv for strip 2019-08-30 17:53:04 +02:00
8c15b52b87 nios 2019-08-30 17:28:18 +02:00
9e7a133422 gotthard2: nios server 2019-08-30 16:44:11 +02:00
cb8c7eea54 updated binaries 2019-08-30 11:26:23 +02:00
0d35b966ff Separate headers (#57)
* WIP, ctb

* WIP, eiger

* WIP, gotthard

* WIP, jungfrau

* WIP, gotthard2

* WIP, mythen3

* WIP, moench

* fixed gotthard apiversioning mismatch with gotthard2
2019-08-30 11:17:37 +02:00
49d47e633d gui: adc invert at any time 2019-08-29 11:52:03 +02:00
e23b3b0471 Ctbgui det (#58)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* defs added

* ctb gui: tengiga bug fix

* WIP

* WIP
2019-08-29 11:39:29 +02:00
4f0634fe62 adc invert for highz (#59) 2019-08-29 10:12:10 +02:00
1980a7d80c python fix 2019-08-28 14:19:54 +02:00
014b8cf9a6 fixed problem with dbitpipeline in ctb gui 2019-08-28 12:05:45 +02:00
f123a280bb added save pattern, printout of some of the pattern for command line 2019-08-27 16:41:38 +02:00
7abb18e5c8 added load paramaters to detector.h 2019-08-27 11:24:53 +02:00
fc0b25cfa7 gui bug fix: hostname print out and acquisition index 2019-08-27 09:25:10 +02:00
aafe049a9b Guidetector (#54)
* WIP

* dacWidget

* main WIP

* advanced WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* works

* updated gui to chrono

* review fixes

* unitque ptrs in gui
2019-08-26 19:14:22 +02:00
7a4c1161ab add default period for mythen3 (#56) 2019-08-26 12:03:20 +02:00
94013a7fad delay not implemented for mythen3 and gotthad2 2019-08-26 11:58:34 +02:00
aecf3bb7db gotthard udp fix 2019-08-26 11:47:28 +02:00
3497175b15 merge resovled 2019-08-26 10:55:44 +02:00
298e1dd1fe udp virtual of gotthard2 2019-08-26 10:54:01 +02:00
f981825172 virtual UDP for mythen3 (#55) 2019-08-26 10:53:17 +02:00
3b2feba3b2 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-26 09:59:52 +02:00
386b6601a8 initial version of gotthard2 2019-08-26 09:59:27 +02:00
9a48d9b832 Intcmd (#53)
* migrated more

* more
2019-08-23 17:39:41 +02:00
2c5ff0e9bf fixed output 2019-08-23 15:44:47 +02:00
e89b65002a minor 2019-08-23 15:11:57 +02:00
5866e330c1 fixed test 2019-08-23 14:43:58 +02:00
5c06549982 Cleanup of the CmdProxy and migrated some commands (#52)
* migrated rx_fifodepth

* Moved and cleand CmdProxy

* rx_slient

* new commands

* examples

* fixed result string print
2019-08-23 14:32:44 +02:00
975a5a4cab moench03T1ZmqData added 2019-08-23 12:05:19 +02:00
57ac5c0dab moved CmdLineParser to sls:: 2019-08-23 10:42:35 +02:00
6a20a780fe Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-23 10:28:57 +02:00
7afe0c510e multiSlsDetectorClient.cpp added .h cleaned 2019-08-23 10:28:50 +02:00
8ec0ac4eb3 client bug fix: was configuring mac even for a get of tengiga enable 2019-08-23 10:21:20 +02:00
322970ebed ctb gui option in cmk.sh enabled 2019-08-23 10:18:45 +02:00
9e40c06786 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-23 09:30:45 +02:00
caedfbebd5 removed two doxy.config 2019-08-23 09:30:38 +02:00
3ca52176b7 CMake support for CTB Gui (#51)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP builds...

* clean up

* root 6.18 support
2019-08-22 21:21:04 +02:00
867bce8b38 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-22 15:59:24 +02:00
170db19f48 initial functions for mythen3 2019-08-22 15:58:32 +02:00
4b7ab98135 initial functions for mythen3 2019-08-22 15:55:27 +02:00
72362b0334 first version of mythen3 2019-08-22 12:34:06 +02:00
794b6f8090 added detector type 2019-08-22 10:58:03 +02:00
7fd5d7c610 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-21 20:25:08 +02:00
199ecbce80 transmission delays 2019-08-21 20:24:59 +02:00
d4a2af1693 CTB fixed 10Gb data structures for the GUI (to be tested) 2019-08-21 17:31:25 +02:00
e247605b76 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-21 17:20:18 +02:00
0735f890a3 Modified waveform plots for 10Gb (to be tested) 2019-08-21 17:19:54 +02:00
3d78b7b6a7 updated al the binaries 2019-08-21 17:10:20 +02:00
1b5e939748 Added 10Gb data structures for moench04 (to be tested) 2019-08-21 16:57:54 +02:00
2ef9aa0ea0 fixed conflict 2019-08-21 16:28:45 +02:00
cadb4cff93 moench02 common mode moved to new structure 2019-08-21 16:27:14 +02:00
e04242c5fa ctb gui progress call back fix 2019-08-21 15:40:19 +02:00
434aa78a04 Merge branch 'developer' into apidhanya 2019-08-21 15:36:08 +02:00
cf045d8a1d ctb gui fix 2019-08-21 15:18:50 +02:00
a98271f0c2 merge resolved 2019-08-21 14:25:21 +02:00
5c393e6204 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2019-08-21 13:23:38 +02:00
5eaea5fb8d updated ctb server 2019-08-21 13:22:43 +02:00
f0ba8a06ce ctb 10g fix for old reciever 2019-08-21 13:21:35 +02:00
4b0fb5029f WIP 2019-08-21 12:45:08 +02:00
b4c207fc4e Less data race in slsReceiver (#50)
* removed some data races

* non needed mutex

* removed extra include
2019-08-21 12:02:06 +02:00
f77b6ab068 WIP 2019-08-21 11:32:45 +02:00
0daada9266 version 2019-08-21 11:15:10 +02:00
422a928be4 ctb rxr: changing to old header (like moench) 2019-08-21 11:13:17 +02:00
156ce0df00 ctb fix:fifo print between frames, pattern length change 2019-08-21 11:09:41 +02:00
62c4bfab64 WIP 2019-08-21 09:23:32 +02:00
28963e313b removed gotthard functions not used 2019-08-20 18:18:34 +02:00
11c1fb0e11 Added roi to master file 2019-08-20 13:42:26 +02:00
9ebff9c8a8 updated gui to have the timer/freq 2019-08-20 13:30:22 +02:00
ad907a43be Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-20 13:20:35 +02:00
ea5ac6ad03 WIP 2019-08-20 13:20:25 +02:00
d1ea74120d added string concat to ToString 2019-08-20 12:17:42 +02:00
0c4ae89cd9 WIP 2019-08-20 11:20:12 +02:00
38b7e23ac4 WIP 2019-08-20 10:55:55 +02:00
08ac9b4ce8 other detectors made to cmake 2019-08-20 09:12:32 +02:00
51a3f3fd4d changed logger.h to clogger.h for c files 2019-08-20 08:48:12 +02:00
29c788b9f7 WIP 2019-08-19 21:28:53 +02:00
0f37481972 WIP 2019-08-19 21:17:52 +02:00
0d787788ea WIP ctb 2019-08-19 21:14:45 +02:00
498a8bda9f WIP 2019-08-19 21:09:44 +02:00
3e874a3650 removed symlinks in jf server (#49) 2019-08-19 20:40:50 +02:00
3881e2cd21 WIP 2019-08-19 20:36:42 +02:00
ee4aa94bbe WIP 2019-08-19 18:03:19 +02:00
d2e8c3bebc WIP 2019-08-19 16:33:53 +02:00
0d2598bd77 WIP 2019-08-19 16:00:23 +02:00
eebd1552f2 WIP 2019-08-19 15:55:42 +02:00
26958e99ef WIP 2019-08-19 10:48:05 +02:00
7457c56533 slsmultireceiver copied to slsreceiver/src cmake 2019-08-19 09:08:10 +02:00
d10d9462a3 virtual servers using command virtual numdet port 2019-08-16 19:31:26 +02:00
c6dddaba97 allowed virtual servers 2019-08-16 18:49:08 +02:00
a0bdfcdae3 WIP 2019-08-16 17:38:41 +02:00
d3e60eba80 eiger binary 2019-08-16 17:08:11 +02:00
10ce82fc5f WIP 2019-08-16 17:07:30 +02:00
b59d69325e updated minor 10g ctb 2019-08-16 15:35:23 +02:00
336f8ceb50 WIP 2019-08-16 10:46:42 +02:00
947252c852 WIP 2019-08-16 09:45:49 +02:00
e635ff035c receiver master file includes quad, gap pixels enable, version updated for binary and hdf5, parallel, analog, digital, adc, dbitofset, dbitlist 2019-08-14 21:14:06 +02:00
8dae9243a5 t puMerge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-14 17:49:38 +02:00
ce14435c68 WIP 2019-08-14 17:49:32 +02:00
ba0c6ff286 eiger bug fix: quad gap pixels 2019-08-14 17:49:09 +02:00
d14fdc3a3f WIP 2019-08-14 17:40:30 +02:00
8e2b89d488 fixed python 2019-08-14 11:54:03 +02:00
5f0a3eaee4 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-14 10:36:27 +02:00
a23a3f4467 prepare private 2019-08-14 10:36:19 +02:00
7f5640dd4e updated multi shm 2019-08-14 10:32:56 +02:00
d191cee548 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-14 09:31:51 +02:00
97192c5342 removed prepare acq 2019-08-14 09:31:42 +02:00
f7893f7f79 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-14 09:21:01 +02:00
d4d8cbe9bc gotthard fixed roi only xmin and xmax.remove updateoffsets 2019-08-14 09:20:50 +02:00
7b1cb517c0 removed emplace_back test 2019-08-14 09:08:23 +02:00
2fe06c7163 WIP 2019-08-13 11:19:25 +02:00
6f6ee19906 WIP 2019-08-13 09:16:29 +02:00
c2f57f5ab0 WIP 2019-08-12 19:55:42 +02:00
160ce17a91 WIP 2019-08-12 19:54:44 +02:00
9686f78300 doesnt compile 2019-08-12 19:13:33 +02:00
25eccdffab WIP 2019-08-12 18:57:53 +02:00
f99ebc7f21 WIP 2019-08-12 18:38:56 +02:00
935f7bc960 WIP 2019-08-12 17:17:13 +02:00
b52a8d2d61 added missing const 2019-08-12 16:43:17 +02:00
4bff894782 merge fix 2019-08-12 16:38:16 +02:00
1008944a6a ROI workaroud 2019-08-12 16:34:59 +02:00
99dc9bd44d Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-12 15:58:04 +02:00
0a34192a8d WIP 2019-08-12 15:57:55 +02:00
09684518c5 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-12 14:23:21 +02:00
8e2494729b WIP 2019-08-12 14:23:12 +02:00
d9be3250ad Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-12 14:15:34 +02:00
95751766cd WIP 2019-08-12 14:15:25 +02:00
c36dfc3992 even more tests 2019-08-12 12:09:44 +02:00
f78a98797f more testing 2019-08-12 11:53:23 +02:00
151c3ee062 tests for Result 2019-08-12 11:29:38 +02:00
f982a59a7c minor 2019-08-09 18:02:12 +02:00
100d748154 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 17:19:19 +02:00
b2d39d4785 WIP done 2019-08-09 17:19:12 +02:00
c350b53b7f Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 16:35:33 +02:00
6a89e3e1a5 WIP 2019-08-09 16:35:26 +02:00
cac353748e Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 16:16:25 +02:00
4a97dd0eba WIP 2019-08-09 16:16:15 +02:00
dea402a7e7 WIP 2019-08-09 16:12:26 +02:00
206740efd6 WIP 2019-08-09 15:35:33 +02:00
56703c4886 WIP 2019-08-09 15:20:53 +02:00
1bd1d0d64d fixed merge 2019-08-09 14:48:01 +02:00
6b363a16fe WIP 2019-08-09 14:45:07 +02:00
6691680091 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 14:28:42 +02:00
2ac421365d WIP 2019-08-09 14:28:32 +02:00
9913194774 WIP 2019-08-09 14:28:18 +02:00
a084ea2d0f Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 14:08:29 +02:00
2f61764fd7 WIP 2019-08-09 14:08:21 +02:00
1a60b59a48 size 2019-08-09 12:11:42 +02:00
a3c5c16417 WIP 2019-08-09 12:01:01 +02:00
8c40c02fc5 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-09 11:55:34 +02:00
bdfdd5dbda WIP 2019-08-09 11:55:27 +02:00
1f549d51fa fixed merge 2019-08-09 11:45:06 +02:00
fc78bb9384 Parallel returns Result 2019-08-09 11:40:57 +02:00
a6e8be2d67 merge resolved 2019-08-09 11:12:31 +02:00
5a483eaf29 WIP, new eiger serveR 2019-08-09 11:11:29 +02:00
dfbf7ab39a tsquash 2019-08-09 11:00:12 +02:00
5292075a0a WIP 2019-08-09 09:35:02 +02:00
0bd6563e45 WIP 2019-08-08 18:09:38 +02:00
b0f34f2d4b Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-08 18:08:41 +02:00
6080e90bbb WIP 2019-08-08 18:08:33 +02:00
e76900ca9a WIP 2019-08-08 17:40:35 +02:00
cc0f1d9fcd WIP 2019-08-08 17:34:25 +02:00
dc24cfb9c3 fixed merge2 2019-08-08 17:16:02 +02:00
869eee4d98 fixed merge 2019-08-08 17:14:54 +02:00
c34190f9f2 WIP 2019-08-08 17:13:25 +02:00
d1d730b779 WIP 2019-08-08 17:13:02 +02:00
b73b98ce3f Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-08 16:55:44 +02:00
ca2c284017 WIP 2019-08-08 16:55:37 +02:00
ce9f76d017 WIP 2019-08-08 16:48:03 +02:00
40bc498e9a WIP 2019-08-08 16:44:52 +02:00
eaf0d8668b WIP 2019-08-08 16:39:25 +02:00
dddd8eb849 merge resolved 2019-08-08 16:20:00 +02:00
a77964e1dd WIP 2019-08-08 16:18:04 +02:00
9d5cff3b34 WIP 2019-08-08 16:09:29 +02:00
23ea16f4b8 not compiling 2019-08-08 15:59:51 +02:00
ca4618d8f4 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-08 15:58:14 +02:00
ddfb66e999 not compiling 2019-08-08 15:58:00 +02:00
7721787748 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-08 15:51:29 +02:00
e6349d0312 WIP 2019-08-08 15:51:21 +02:00
373cfad645 Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya 2019-08-08 15:51:06 +02:00
d79447ed3a WIP 2019-08-08 15:50:56 +02:00
0b006b5080 WIP 2019-08-08 15:36:03 +02:00
6a780de22f WIP 2019-08-08 15:06:08 +02:00
d9ecec9bf7 merge resolved 2019-08-08 14:55:36 +02:00
8740e4f683 WIP 2019-08-08 14:49:13 +02:00
79d6ea614a WIP 2019-08-08 14:30:02 +02:00
f0e106f94f WIP 2019-08-08 13:49:28 +02:00
1bdff2b681 WIP 2019-08-08 12:02:36 +02:00
553b7d8568 WIP 2019-08-08 11:11:08 +02:00
e7e4bf13c3 WIP 2019-08-08 11:07:41 +02:00
095a7eac05 more ctb 2019-08-08 10:18:21 +02:00
bba6e1667b some ctb funcs 2019-08-07 18:00:25 +02:00
21046bcae0 multidet to multi shm 2019-08-07 16:32:12 +02:00
eec7b22582 compiles 2019-08-07 16:11:42 +02:00
e246a33269 Merge branch 'developer' into apidhanya 2019-08-07 15:54:17 +02:00
0a2a5933da WIP 2019-08-07 15:51:25 +02:00
dc1e01b444 multidettype in one place 2019-08-07 15:33:55 +02:00
6a71e61c12 WIP 2019-08-07 15:23:58 +02:00
615835f03d WIP 2019-08-07 12:32:59 +02:00
dd6a95d041 first one 2019-08-07 12:02:59 +02:00
cff4d162c1 commenting headers already done, adding positions for filename and filepath, pos instead of Positions{} 2019-08-07 11:52:03 +02:00
440 changed files with 42846 additions and 36850 deletions

View File

@ -16,7 +16,8 @@ Checks: '*,
-hicpp-braces-around-statements,
-google-runtime-references,
-google-readability-todo,
-google-readability-braces-around-statements'
-google-readability-braces-around-statements,
-modernize-use-trailing-return-type'
HeaderFilterRegex: \.h
AnalyzeTemporaryDtors: false

4
.gitignore vendored
View File

@ -12,6 +12,10 @@ build
RELEASE.txt
Testing/
ctbDict.cpp
ctbDict.h
*.pyc
*/__pycache__/*

View File

@ -8,6 +8,7 @@ env:
matrix:
- CONDA_PY=3.6
- CONDA_PY=3.7
- CONDA_PY=3.8
dist: trusty
@ -46,5 +47,5 @@ deploy:
provider: script
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on:
branch: filip1
branch: developer

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.11)
project(slsDetectorPackage)
set(PROJECT_VERSION 5.0.0)
include(CheckIPOSupported)
@ -42,6 +41,9 @@ option (SLS_USE_TESTS "TESTS" OFF)
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
option(SLS_USE_PYTHON "Python bindings" OFF)
option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -66,6 +68,7 @@ target_compile_options(slsProjectWarnings INTERFACE
-Wredundant-decls
# -Wconversion
-Wdouble-promotion
-Werror=return-type
)
@ -103,7 +106,6 @@ endif()
if(SLS_USE_SANITIZER)
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
#target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
@ -152,8 +154,7 @@ if (SLS_USE_RECEIVER)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
endif (SLS_USE_HDF5)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
add_subdirectory(slsReceiverSoftware)
endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI)
@ -177,15 +178,21 @@ if (SLS_USE_PYTHON)
add_subdirectory(python)
endif(SLS_USE_PYTHON)
if (SLS_USE_CTBGUI)
add_subdirectory(ctbGui)
endif(SLS_USE_CTBGUI)
configure_file( .clang-tidy
${CMAKE_BINARY_DIR}/.clang-tidy
)
if (SLS_BUILD_EXAMPLES)
add_subdirectory(sample)
endif(SLS_BUILD_EXAMPLES)
add_subdirectory(sample)
add_subdirectory(docs)
if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)

21
cmk.sh
View File

@ -10,6 +10,7 @@ DEBUG=0
PYTHON=0
TESTS=0
SIMULATOR=0
CTBGUI=0
CLEAN=0
@ -18,7 +19,7 @@ CMAKE_PRE=""
CMAKE_POST=""
usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
@ -29,6 +30,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j]
-r: Build/Rebuilds only receiver
-g: Build/Rebuilds only gui
-s: Simulator
-u: Chip Test Gui
-j: Number of threads to compile through
-e: Debug mode
-i: Builds tests
@ -67,7 +69,7 @@ For rebuilding only certain sections
" ; exit 1; }
while getopts ":bpchd:j:trgeis" opt ; do
while getopts ":bpchd:j:trgeisu" opt ; do
case $opt in
b)
echo "Building of CMake files Required"
@ -122,6 +124,10 @@ while getopts ":bpchd:j:trgeis" opt ; do
echo "Compiling Options: Simulator"
SIMULATOR=1
;;
u)
echo "Compiling Options: Chip Test Gui"
CTBGUI=1
;;
\?)
echo "Invalid option: -$OPTARG"
usage
@ -149,7 +155,7 @@ if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
echo "Enabling Compile Option: TextClient, Receiver and GUI"
else
if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=OFF "
echo "Enabling Compile Option: TextClient"
fi
if [ $RECEIVER -eq 1 ]; then
@ -188,14 +194,19 @@ fi
#Simulator
if [ $SIMULATOR -eq 1 ]; then
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SIMULATOR=ON "
CMAKE_POST+=" -DSLS_USE_SIMULATOR=ON "
echo "Simulator Option enabled"
fi
#Chip Test Gui
if [ $CTBGUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
echo "CTB Gui Option enabled"
fi
#Tests
if [ $TESTS -eq 1 ]; then
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
CMAKE_POST+=" -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
echo "Tests Option enabled"
fi

View File

@ -1,7 +1,7 @@
package:
name: sls_detector_software
version: "filip1"
version: "developer"
source:
- path: ..
@ -65,10 +65,10 @@ outputs:
- setuptools
- sls_detector_lib
- pyzmq
- pybind11 2.2
- pybind11 2.4
host:
- python
- pybind11 2.2
- pybind11 2.4
- pyzmq
- sls_detector_lib
- libstdcxx-ng
@ -76,7 +76,7 @@ outputs:
run:
- python
- numpy
- sls_detector_lib=filip1
- sls_detector_lib=developer
- pyzmq
- libstdcxx-ng
- libgcc-ng

83
ctbGui/CMakeLists.txt Normal file
View File

@ -0,0 +1,83 @@
find_package(ROOT CONFIG REQUIRED COMPONENTS Core Gui)
find_package(TIFF REQUIRED)
target_include_directories(ROOT::Core INTERFACE "${ROOT_INCLUDE_DIRS}")
add_library(ROOT::Flags_CXX IMPORTED INTERFACE)
separate_arguments(ROOT_CXX_FLAGS)
target_compile_options(ROOT::Flags_CXX INTERFACE ${ROOT_CXX_FLAGS})
separate_arguments(ROOT_DEFINITIONS)
target_compile_definitions(ROOT::Flags_CXX INTERFACE ${ROOT_DEFINITIONS})
# This fixes a bug in the linker flags
string(REPLACE "-L " "-L" ROOT_EXE_LINKER_FLAGS "${ROOT_EXE_LINKER_FLAGS}")
separate_arguments(ROOT_EXE_LINKER_FLAGS)
# Stuck into using old property method due to separate -L and -l arguments
# (A full path to -l is better!)
set_property(TARGET ROOT::Flags_CXX PROPERTY
INTERFACE_LINK_LIBRARIES ${ROOT_EXE_LINKER_FLAGS})
set_property(TARGET ROOT::Core PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
add_executable(ctbGui
ctbGui.cpp
ctbMain.cpp
ctbDacs.cpp
ctbPowers.cpp
ctbSlowAdcs.cpp
ctbSignals.cpp
ctbAdcs.cpp
ctbPattern.cpp
ctbAcquisition.cpp
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
)
#TODO! Replace with target
target_include_directories(ctbGui PRIVATE
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
)
# Headders needed for ROOT dictionary generation
set( HEADERS
ctbDefs.h
ctbMain.h
ctbDacs.h
ctbPattern.h
ctbSignals.h
ctbAdcs.h
ctbAcquisition.h
ctbPowers.h
ctbSlowAdcs.h
)
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# ROOT dictionary generation
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
add_library(ctbRootLib SHARED ctbDict.cxx)
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ctbRootLib PUBLIC
ROOT::Core
slsDetectorShared
slsSupportLib
${ROOT_LIBRARIES}
${ROOT_EXE_LINKER_FLAGS}
)
target_link_libraries(ctbGui PUBLIC
slsDetectorShared
slsSupportLib
ctbRootLib
${TIFF_LIBRARIES}
)
set_target_properties(ctbGui PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

View File

@ -1,17 +1,17 @@
INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
SRC= $(SRC:.h=.cpp) ctbDict.cpp
SRC= $(INCS:.h=.cpp) ctbDict.cpp
LINKDEF=ctbLinkDef.h
ZMQLIB=../slsReceiverSoftware/include
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
LDFLAG=-L../bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
#
MAIN=ctbGui.cpp
DESTDIR?=../bin
DESTDIR?=../build/bin
OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
@ -30,13 +30,13 @@ ctbDict.cpp: $(INCS) $(LINKDEF)
%.o : %.cpp
echo $@
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
mv ctbGui $(DESTDIR)
clean:

View File

@ -24,7 +24,8 @@
#include <fstream>
#include "ctbAcquisition.h"
#include "multiSlsDetector.h"
#include "ctbDefs.h"
#include "Detector.h"
#include "sls_detector_defs.h"
#include "ctbMain.h"
#include "moench03CtbData.h"
@ -39,6 +40,7 @@
#include "Mythen3_02_jctbData.h"
#include "adcSar2_jctbData.h"
#include "moench04CtbZmqData.h"
#include "moench04CtbZmq10GbData.h"
#include "deserializer.h"
#include "detectorData.h"
@ -47,7 +49,7 @@ using namespace std;
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), tenG(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
adcFit=NULL;
bitPlot=NULL;
@ -70,8 +72,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
cFileSave->SetTextJustify(kTextRight);
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
std::string temp = "run";
try {
temp = myDet->getFileNamePrefix().tsquash("Different values");
} CATCH_DISPLAY ("Could not get file name prefix.", "ctbAcquisition::ctbAcquisition")
eFname = new TGTextEntry(hframe, temp.c_str());
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
eFname->MapWindow();
@ -112,7 +117,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
eOutdir = new TGTextEntry(hframe, (myDet->getFilePath()).c_str());
temp = "/tmp/";
try {
temp = myDet->getFilePath().tsquash("Different values");
} CATCH_DISPLAY ("Could not get file path.", "ctbAcquisition::ctbAcquisition")
eOutdir = new TGTextEntry(hframe, temp.c_str());
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
eOutdir->MapWindow();
@ -596,21 +605,12 @@ hframe=new TGHorizontalFrame(this, 800,50);
acqThread = new TThread("acqThread",
ctbAcquisition::ThreadHandle,(void*)this);
// acqThread->Run();
cout <<"Registering progress callback" << endl;
try {
myDet->registerProgressCallback(&progressCallback,(void*)this);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
cout <<"Registering data callback" << endl;
try{
try {
myDet->registerDataCallback(&dataCallback, (void*)this);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
cout <<"Done" << endl;
// mgAdcs=new TMultiGraph();
@ -663,10 +663,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
countsHisto[i]=h1;
}
int nx,ny;
int csize=3;
int nsigma=5;
dataStructure=NULL;
commonMode=NULL;
photonFinder=NULL;
@ -770,7 +766,7 @@ void ctbAcquisition::canvasClicked() {
void ctbAcquisition::setCanvas(TCanvas* c) {
myCanvas=c;
myCanvas->cd();
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%x)->canvasClicked()",this));
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
// myCanvas->AddExec("ex","canvasClicked()");
}
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
@ -805,8 +801,6 @@ digital:
sample0 (dbit0 + dbit1 +...)
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
if (action == PUT_ACTION) {
std::vector <int> dbitlist;
@ -844,19 +838,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
//#endif
int ig=0;
int i, ii, ich=0, ib, vv;
int i, ii, ib;
// TList *l= adcStack->GetHists();
// TList *l1= countsStack->GetHists();
TH1F *h;
TH1F *h1;
TH1F *hb;
int nb, x,y;
int x;
double ped=0;
int vv1,vv2;
int dsize=-1;
int *val=NULL;
int nx=1, ny=1, jj;
short unsigned int *va;
int nx=1, ny=1;
if (dataStructure) {
dataStructure->getDetectorSize(nx,ny);
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
@ -872,7 +865,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
int nadc;
int ndbit;
tenG = 0;
@ -893,8 +886,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
}
} else
ndbit=dbitlist.size();
dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
if (tenG){
if (nDigitalSamples && nAnalogSamples){
if (nDigitalSamples>nAnalogSamples)
dsize=nDigitalSamples*(32*2+8);
else
dsize=nAnalogSamples*(32*2+8);
} else
dsize=32*2*nAnalogSamples+8*nDigitalSamples;
} else
dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
cout << "dataBytes is " << data->databytes << " expected " << dsize << endl;
@ -905,7 +908,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
i=0;
char *d_data= data->data+2*nadc*nAnalogSamples;
char *d_data;
if (tenG)
d_data= data->data;
else
d_data = data->data+2*nadc*nAnalogSamples;
char dval;
@ -967,7 +974,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
ig=ii;
else
ig=adclist.at(ii);
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
// if (tenG)
// aval=data->getChannel(i);
// else
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
if (plotFlag[ig]) {
@ -979,10 +990,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
// cout << data->getChannel(i) << endl;
h->SetBinContent(ip+1,aval);
h1->Fill(aval);
}
}
i++;
}
}
if (tenG) i+=4;
}
@ -992,8 +1004,10 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
if (dbitlist.empty()) {
for (ip=0; ip<nDigitalSamples; ip++) {
for (ig=0; ig<8; ig++) {
dval=*(d_data+ip*8+ig);
if (tenG)
dval=*(d_data+ip*(8+32*2)+32*2+ig);
else
dval=*(d_data+ip*8+ig);
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
if (bitPlotFlag[ib]) {
@ -1010,7 +1024,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
} else {
ii=0;
int iii=0;
int nb=dbitlist.size();
for (const auto &value : dbitlist) {
ib=value;
hb=bitHisto[ib];
@ -1176,10 +1189,10 @@ void ctbAcquisition::changeDetector(){
photonFinder=NULL;
dataStructure=NULL;
commonMode=NULL;
TH2F *h2DMapOld=h2DMapAn;
// TH2F *h2ScanOld=h2Scan;
TH1F *h1DMapOld=h1DMap;
int dim=2;
int nx,ny;
int csize=3;
int nsigma=5;
@ -1197,7 +1210,16 @@ void ctbAcquisition::changeDetector(){
// commonMode=new moench03CommonMode();
break;
case MOENCH04:
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
try {
auto retval = myDet->getTenGiga().tsquash("Different values");
if (retval) {
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
} else {
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
}
} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
cout << "MOENCH 0.4!" << endl;
commonMode=new moench03CommonMode();
break;
@ -1411,7 +1433,7 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
float off=0;
for (int ii=0; ii<NSIGNALS; ii++) {
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
off+=1.5;
off+=static_cast<float>(1.5);
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
}
}
@ -1426,74 +1448,65 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
void ctbAcquisition::setOutdir() {
try {
myDet->setFilePath(eOutdir->GetText());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
// // cout << "setting dac! "<< id << endl;
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
// getValue();
myDet->setFilePath(eOutdir->GetText());
} CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
}
void ctbAcquisition::setFname() {
try {
myDet->setFileName(eFname->GetText());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
// int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
// char s[100];
// sprintf(s,"%d",val);
// dacsValue->SetText(s);
// return val;
myDet->setFileNamePrefix(eFname->GetText());
} CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
}
void ctbAcquisition::setFindex() {
try {
myDet->setFileIndex(eFindex->GetNumber());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->setAcquisitionIndex(eFindex->GetNumber());
} CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
}
void ctbAcquisition::setFsave(Bool_t b) {
try {
myDet->setFileWrite(b);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eFname->SetState(b);
eOutdir->SetState(b);
myDet->setFileWrite(b);
eFname->SetState(b);
eOutdir->SetState(b);
} CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
}
void ctbAcquisition::update() {
try {
auto retval = myDet->getFileNamePrefix().tsquash("Different values");
eFname->SetText(retval.c_str());
} CATCH_DISPLAY ("Could not get file name prefix", "ctbAcquisition::update")
try {
auto retval = myDet->getAcquisitionIndex().tsquash("Different values");
eFindex->SetNumber(retval);
} CATCH_DISPLAY ("Could not get acquisition index", "ctbAcquisition::update")
try {
auto retval = myDet->getFileWrite().tsquash("Different values");
cFileSave->SetOn(retval);
} CATCH_DISPLAY ("Could not get file write", "ctbAcquisition::update")
eFname->SetText((myDet->getFileName()).c_str());
eOutdir->SetText((myDet->getFilePath()).c_str());
eFindex->SetNumber(myDet->getFileIndex());
cFileSave->SetOn(myDet->getFileWrite());
eFname->SetState(cFileSave->IsOn());
eOutdir->SetState(cFileSave->IsOn());
eFindex->SetState(cFileSave->IsOn());
// eMeasurements->SetNumber(myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
roMode=myDet->setReadOutFlags();
setReadoutMode(roMode);
//nChannels=myDet->getTotalNumberOfChannels();
try {
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
setAnalogSamples(retval);
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
try {
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
setDigitalSamples(retval);
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
try {
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
setReadoutMode(roMode);
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
updateChans();
if (dataStructure) {
@ -1507,7 +1520,14 @@ void ctbAcquisition::update() {
}
}
dBitOffset=myDet->getReceiverDbitOffset();
try {
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
try {
tenG = myDet->getTenGiga().tsquash("Different values");
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
// char aargs[10][100];
// char *args[10];
@ -1568,10 +1588,8 @@ void ctbAcquisition::loadPattern() {
cout << "Load: " << fname << endl;
try {
myDet->retrieveDetectorSetup(fname);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->loadParameters(fname);
} CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
}
}
@ -1582,15 +1600,25 @@ void ctbAcquisition::toggleAcquisition() {
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
/** update all infos useful for the acquisition! */
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
dBitOffset=myDet->getReceiverDbitOffset();
roMode=myDet->setReadOutFlags();
try {
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
setAnalogSamples(retval);
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::toggleAcquisition")
try {
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
setDigitalSamples(retval);
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
try {
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
try {
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
setReadoutMode(roMode);
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
// iScanStep=0;
cout << "Run" << endl;
bStatus->SetText("Stop");
@ -1641,11 +1669,9 @@ void ctbAcquisition::toggleAcquisition() {
} else {
StopFlag=1;
try {
myDet->stopAcquisition();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->stopDetector();
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
stop=1;
bStatus->SetText("Start");
// acqThread->Kill();
@ -1662,27 +1688,30 @@ void ctbAcquisition::acquisitionFinished() {
void ctbAcquisition::startAcquisition(){
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
stop=0;
try {
tenG = myDet->getTenGiga().tsquash("Different values");
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
for (int im=0; im<eMeasurements->GetNumber(); im++) {
try {
myDet->acquire();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->acquire();
} CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
cout << im << endl;
if (stop) break;
if (stop)
break;
}
}
void* ctbAcquisition::ThreadHandle(void *arg)
{
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
int i=0;
acq->startAcquisition();
acq->acquisitionFinished();
return nullptr;
}
void ctbAcquisition::progressCallback(double f,void* arg) {
@ -1715,12 +1744,6 @@ void ctbAcquisition::setPatternCompiler(const char* t) {
}
void ctbAcquisition::setMeasurements() {
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eMeasurements->GetNumber());
}
void ctbAcquisition::setAnalogSamples(int n) {
@ -1775,11 +1798,11 @@ void ctbAcquisition::setDigitalSamples(int n) {
void ctbAcquisition::setReadoutMode(int f) {
roMode=f;
slsDetectorDefs::readOutFlags flags=(slsDetectorDefs::readOutFlags)f;
if (flags&slsDetectorDefs::DIGITAL_ONLY) {
slsDetectorDefs::readoutMode flag=(slsDetectorDefs::readoutMode)f;
if (flag == slsDetectorDefs::DIGITAL_ONLY) {
nAnalogSamples=0;
adclist.clear();
} else if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
} else if (flag ==slsDetectorDefs::ANALOG_AND_DIGITAL) {
;
}
else {
@ -1825,46 +1848,32 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
void ctbAcquisition::updateChans() {
/** dbitlist updated */
std::vector <int> dbl;
try {
dbl = myDet->getReceiverDbitList();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
dbitlist.clear();
if (dbl.empty())
;
else {
for (const auto &value : dbl)
dbitlist.push_back(value);
}
uint32_t reg;
try {
reg=myDet->getADCEnableMask();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
/* adc updated */
adclist.clear();
// // updateChans();
if (reg!=0xffffffff) {
for (int i=0; i<NADCS; i++) {
if (reg&(1<<i))
adclist.push_back(i);
// // else enableFlag[i]=1;
// dbit list
try {
auto retval = myDet->getRxDbitList().tsquash("Different values");
dbitlist.clear();
if (!retval.empty()) {
for (const auto &value : retval)
dbitlist.push_back(value);
}
}
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
// adc mask
try {
auto retval = myDet->getADCEnableMask().tsquash("Different values");
adclist.clear();
if (retval!=0xffffffff) {
for (int i=0; i<NADCS; i++) {
if (retval&(1<<i)) {
adclist.push_back(i);
}
}
}
} CATCH_DISPLAY ("Could not get adc enable mask.", "ctbAcquisition::updateChans")
}
void ctbAcquisition::resetPedestal() {
if (photonFinder) {
photonFinder->newDataSet();

View File

@ -23,7 +23,10 @@ class TH1F;
class TGLabel;
class TGTextButton;
class multiSlsDetector;
namespace sls
{
class Detector;
};
class detectorData;
template <class dataType> class slsDetectorData;
@ -112,7 +115,7 @@ class ctbAcquisition : public TGGroupFrame {
// TH1I *plotAdc[NADCS];
multiSlsDetector* myDet;
sls::Detector* myDet;
int plotFlag[NADCS];
int bitPlotFlag[NSIGNALS];
@ -151,6 +154,7 @@ class ctbAcquisition : public TGGroupFrame {
int globalPlot;
int adcPlot;
int dbitPlot;
int tenG;
int nAnalogSamples, nDigitalSamples;
// int iScanStep;
@ -168,7 +172,7 @@ class ctbAcquisition : public TGGroupFrame {
int deserializer;
public:
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
ctbAcquisition(TGVerticalFrame*, sls::Detector*);
void setOutdir();
void setFname();
void setMeasurements();

View File

@ -24,14 +24,14 @@
#include <fstream>
#include "ctbAdcs.h"
#include "multiSlsDetector.h"
#include "slsDetectorCommand.h"
#include "ctbDefs.h"
#include "Detector.h"
using namespace std;
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det)
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det)
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
TGHorizontalFrame *hframe=this;
@ -155,7 +155,7 @@ void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
string ctbAdc::getAdcAlias() {
char line[1000];
sprintf(line,"ADC%d %s %d %x\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
sprintf(line,"ADC%d %s %d %lx\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
return string(line);
}
@ -264,7 +264,7 @@ void ctbAdc::setPlot(Bool_t b){
ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
ctbAdcs::ctbAdcs(TGVerticalFrame *page, sls::Detector *det)
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
@ -272,7 +272,6 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
char tit[100];
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
@ -415,108 +414,41 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
int ctbAdcs::setEnable(int reg) {
// char aargs[10][100];
// char *args[10];
string retval;
int retreg;
// for (int i=0; i<10; i++) args[i]=aargs[i];
// sprintf(args[0],"adcenable");
// sprintf(args[1],"%x",reg);
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
// if (reg>-1) {
// retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
// }
if (reg>-1) {
try {
myDet->setADCEnableMask(reg);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
}
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
// cout <<"enable: " << retval << endl;;
// delete cmd;
// sscanf(retval.c_str(),"%x",&retreg);
try {
retreg=myDet->getADCEnableMask();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eEnableMask->SetHexNumber(retreg);
if (reg > -1) {
myDet->setADCEnableMask(reg);
}
auto retval = myDet->getADCEnableMask().tsquash("Different values");
eEnableMask->SetHexNumber(retval);
return retval;
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
return retreg;
return -1;
}
int ctbAdcs::setInvert(int reg) {
// char aargs[10][100];
// char *args[10];
string retval;
int retreg;
// for (int i=0; i<10; i++) args[i]=aargs[i];
//sprint// f(args[0],"adcinvert");
// sprintf(args[1],"%x",reg);
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
if (reg>-1) {
try {
myDet->setADCInvert(reg);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
//retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
}
try {
retreg=myDet->getADCInvert();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
// cout <<"invert: " << retval << endl;;
// delete cmd;
// sscanf(retval.c_str(),"%x",&retreg);
eInversionMask->SetHexNumber(retreg);
return retreg;
if (reg > -1) {
myDet->setADCInvert(reg);
}
auto retval = myDet->getADCInvert().tsquash("Different values");
eInversionMask->SetHexNumber(retval);
return retval;
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
return -1;
}
void ctbAdcs::update() {
Int_t invreg;//=myDet->readRegister(67);//(120);
Int_t disreg;//=myDet->readRegister(120);//(94);
// for (int i=0; i<10; i++)
// args[i]=aargs[i];
// string retval;
// sprintf(args[0],"adcenable");
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
// delete cmd;
// // cout << retval << endl;
// sscanf(retval.c_str(),"adcenable %x",&disreg);
// eInversionMask->SetHexNumber(invreg);
// eEnableMask->SetHexNumber(disreg);
Int_t invreg;
Int_t disreg;
disreg=setEnable();
invreg=setInvert();
for (int is=0; is<NADCS; is++) {
sAdc[is]->setAdcAlias(NULL,-1,-1);
if (invreg & (1<<is) )
@ -528,42 +460,29 @@ void ctbAdcs::update() {
sAdc[is]->setEnable(kTRUE);
else
sAdc[is]->setEnable(kFALSE);
}
Emit("AdcEnable(Int_t)", disreg);
}
string ctbAdcs::getAdcParameters() {
ostringstream line;
ostringstream line;
line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
// line << "reg "<< hex << 67 << " " << myDet->readRegister(67) << "# ADC invert reg" << dec << endl;
// line << "reg "<< hex << 120 << " " << myDet->readRegister(120) << " # ADC enable reg"<< dec << endl;
// // line << "reg "<< hex << 94 << " " << myDet->readRegister(94) << " # ADC enable reg"<< dec << endl;
return line.str();
}
void ctbAdcs::CheckAll() {
for (int is=0; is<NADCS; is++){
sAdc[is]->setPlot(kTRUE);
// sAdc[is]->setEnabled(kTRUE);
}
}
void ctbAdcs::RemoveAll() {
for (int is=0; is<NADCS; is++) {
// sAdc[is]->setEnabled(kFALSE);
sAdc[is]->setPlot(kFALSE);
}
}
@ -571,51 +490,32 @@ void ctbAdcs::RemoveAll() {
void ctbAdcs::CheckHalf0() {
for (int is=0; is<NADCS/2; is++) {
sAdc[is]->setPlot(kTRUE);
// sAdc[is]->setEnabled(kTRUE)
}
}
void ctbAdcs::RemoveHalf0() {
for (int is=0; is<NADCS/2; is++){
// sAdc[is]->setEnabled(kFALSE);
sAdc[is]->setPlot(kFALSE);
}
}
void ctbAdcs::CheckHalf1() {
for (int is=NADCS/2; is<NADCS; is++){
sAdc[is]->setPlot(kTRUE);
// sAdc[is]->setEnabled(kTRUE)
}
}
void ctbAdcs::RemoveHalf1() {
for (int is=NADCS/2; is<NADCS; is++){
// sAdc[is]->setEnabled(kFALSE);
sAdc[is]->setPlot(kFALSE);
}
}
// TGraph* ctbAdcs::getGraph(int i) {
// if (i>=0 && i<NADCS)
// return sAdc[i]->getGraph();
// return NULL;
// }
int ctbAdcs::setAdcAlias(string line) {
int is=-1, plot=0, color=-1;
@ -657,33 +557,23 @@ void ctbAdcs::AdcEnable(Int_t b){
void ctbAdcs::ToggledAdcEnable(Int_t b){
Int_t oreg=setEnable();//myDet->readRegister(67);
Int_t oreg=setEnable();
Int_t m=1<<b;
if (sAdc[b]->getEnable())
oreg|=m;
else
oreg&=~m;
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
setEnable(oreg);//)writeRegister(67, oreg);
//oreg=setEnable();//myDet->readRegister(67);
setEnable(oreg);
Emit("AdcEnable(Int_t)", oreg);
//cout << "enable!" << endl;
// Emit("ToggledAdcPlot(Int_t)", b);
}
void ctbAdcs::ToggledAdcInvert(Int_t b){
// char val[1000];
Int_t oreg=setInvert();//myDet->readRegister(67);
Int_t oreg=setInvert();
Int_t m=1<<b;
@ -692,15 +582,7 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
else
oreg&=~m;
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
setInvert(oreg);//)writeRegister(67, oreg);
// oreg=setInvert();//myDet->readRegister(67);
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
//sprintf(val,"%X",oreg);
//eInversionMask->SetHexNumber(oreg);
setInvert(oreg);
}
@ -710,22 +592,23 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
Pixel_t ctbAdcs::getColor(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getColor();
return static_cast<Pixel_t>(-1);
}
Bool_t ctbAdcs::getEnabled(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getEnabled();
return static_cast<Bool_t>(-1);
}
Bool_t ctbAdcs::getEnable(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getEnable();
return static_cast<Bool_t>(-1);
}
Bool_t ctbAdcs::getPlot(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getPlot();
return static_cast<Bool_t>(-1);
}

View File

@ -28,7 +28,10 @@ class TGTab;
class TGraph;
class multiSlsDetector;
namespace sls
{
class Detector;
};
#include <string>
using namespace std;
@ -49,10 +52,10 @@ class ctbAdc : public TGHorizontalFrame {
// TGraph *gADC;
int id;
multiSlsDetector *myDet;
sls::Detector *myDet;
public:
ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
void setAdcAlias(char *tit, int plot, int color);
@ -89,7 +92,7 @@ class ctbAdcs : public TGGroupFrame {
private:
ctbAdc *sAdc[NADCS];
multiSlsDetector *myDet;
sls::Detector *myDet;
TGTextButton *bCheckAll;
@ -115,7 +118,7 @@ private:
public:
ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
int setAdcAlias(string line);
string getAdcAlias();
string getAdcParameters();

View File

@ -9,17 +9,14 @@
#include <TGButton.h>
#include "ctbDacs.h"
#include "multiSlsDetector.h"
#include "ctbDefs.h"
#include "Detector.h"
#include "sls_detector_defs.h"
using namespace std;
ctbDac::ctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
TGHorizontalFrame *hframe=this;
@ -104,12 +101,9 @@ int ctbDac::setLabel(char *tit, int mv) {
}
string ctbDac::getLabel() {
ostringstream line;
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
return line.str();
}
@ -119,65 +113,45 @@ void ctbDac::setValue(Long_t a) {setValue();}
void ctbDac::setValue() {
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
try {
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn()); } catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
getValue();
}
void ctbDac::setOn(Bool_t b) {
// cout << "setting dac! "<< id << endl;
if ( dacsLabel->IsOn()) {
setValue();
} else {
try {
myDet->setDAC(-100, (slsDetectorDefs::dacIndex)id, 0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
}
getValue();
}
int ctbDac::getValue() {
int val;
try {
val=myDet->setDAC(-1,(slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
char s[100];
cout << "dac " << id << " " << val << endl;
sprintf(s,"%d",val);
dacsValue->SetText(s);
if (val>=0) {
dacsLabel->SetOn(kTRUE);
} else {
dacsLabel->SetOn(kFALSE);
}
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
cout << "dac " << id << " " << val << endl;
dacsValue->SetText(to_string(val).c_str());
if (val >= 0) {
dacsLabel->SetOn(kTRUE);
} else {
dacsLabel->SetOn(kFALSE);
}
return val;
} CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
return val;
return -1;
}
ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
@ -192,14 +166,12 @@ ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(
}
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
dacs[NDACS]->setLabel("ADC Vpp",2);
dacs[NDACS+1]->setLabel("High Voltage",3);
dacs[NDACS]->setLabel((char*)"ADC Vpp",2);
dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
}
int ctbDacs::setDacAlias(string line) {
int is=-1, mv=0;
char tit[100];
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
@ -217,7 +189,6 @@ string ctbDacs::getDacAlias() {
for (int i=0; i<NDACS; i++)
line << dacs[i]->getLabel() << endl;
return line.str();
}
@ -225,8 +196,6 @@ string ctbDacs::getDacAlias() {
string ctbDacs::getDacParameters() {
ostringstream line;
for (int i=0; i<NDACS; i++) {
@ -234,18 +203,12 @@ string ctbDacs::getDacParameters() {
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
}
return line.str();
}
void ctbDacs::update() {
for (int idac=0; idac<NDACS+1; idac++) {
dacs[idac]->getValue();
}
}

View File

@ -15,7 +15,10 @@ class TGNumberEntry;
class TGCheckButton;
class multiSlsDetector;
namespace sls
{
class Detector;
};
#include <string>
using namespace std;
@ -32,9 +35,9 @@ class ctbDac : public TGHorizontalFrame {
TGLabel *dacsValue;
int id;
multiSlsDetector* myDet;
sls::Detector* myDet;
public:
ctbDac(TGGroupFrame*, int , multiSlsDetector*);
ctbDac(TGGroupFrame*, int , sls::Detector*);
void setValue();
void setValue(Long_t);
int getValue();
@ -55,10 +58,10 @@ private:
ctbDac *dacs[NDACS+2];
multiSlsDetector* myDet;
sls::Detector* myDet;
public:
ctbDacs(TGVerticalFrame *page, multiSlsDetector*);
ctbDacs(TGVerticalFrame *page, sls::Detector*);
int setDacAlias(string line);
// int setDacAlias(string line);

84
ctbGui/ctbDefs.h Executable file
View File

@ -0,0 +1,84 @@
#pragma once
#include <string>
#include <stdexcept>
#include <chrono>
//#include "sls_detector_exceptions.h"
//#include "ansi.h"
#define RED "\x1b[31m"
#define RESET "\x1b[0m"
#define BOLD "\x1b[1m"
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
#define CATCH_DISPLAY(m, s) catch(...) { ctbDefs::DisplayExceptions(m, s); }
#define CATCH_HANDLE(...) catch(...) { ctbDefs::HandleExceptions(__VA_ARGS__); }
class ctbDefs {
public:
/**
* Empty Constructor
*/
ctbDefs(){};
// convert double seconds to chrono ns
static std::chrono::nanoseconds ConvertDoubleStoChronoNS(double timeS) {
using std::chrono::duration;
using std::chrono::duration_cast;
using std::chrono::nanoseconds;
return duration_cast<nanoseconds>(duration<double>(timeS));
}
// convert chrono ns to doubel s
static double ConvertChronoNStoDoubleS(std::chrono::nanoseconds timeNs) {
using std::chrono::duration;
using std::chrono::duration_cast;
return duration_cast<duration<double>>(timeNs).count();
}
static void DisplayExceptions(std::string emsg, std::string src) {
try {
throw;
} /* catch (const sls::SocketError &e) {
throw;
} catch (const sls::SharedMemoryError &e) {
throw;
} */catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
}
};
template <class CT> struct NonDeduced { using type = CT; };
template <class S, typename RT, typename... CT>
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
RT (S::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
throw;
} /*catch (const sls::SocketError &e) {
throw;
} catch (const sls::SharedMemoryError &e) {
throw;
} */catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
(s->*somefunc)(Args...);
}
};
static void ExceptionMessage(std::string message,
std::string exceptionMessage,
std::string source) {
// because sls_detector_exceptions cannot be included
if (exceptionMessage.find("hared memory")) {
throw;
}
if (exceptionMessage.find("annot connect")) {
throw;
}
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
};
};

View File

@ -9,11 +9,11 @@
#include <fstream>
#include <string>
#include "multiSlsDetector.h"
#include "Detector.h"
#include "sls_detector_defs.h"
//#include "sls_receiver_defs.h"
#include "ctbMain.h"
#include "ctbDefs.h"
using namespace std;
@ -45,9 +45,9 @@ int main(int argc, char **argv) {
} else if (strcmp(argv[ia],"-par")==0) {
if (ia+1<argc) {
pfname=argv[ia+1];
pfname=argv[ia+1];
ia++;
pf=1;
pf=1;
}
@ -61,31 +61,27 @@ int main(int argc, char **argv) {
cout << " *** " << endl;
/****** Create detector ****************/
multiSlsDetector *myDet=new multiSlsDetector(id);
// myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
//cout << id << " " << myDet << " " << myDet->setOnline() << endl;
if (cf) {
myDet->readConfigurationFile(cfname);
} else
cout << "No config file specified" << endl;
cout << "aa" << endl;
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
cout << "bb" << endl;
if (pf) {
myDet->retrieveDetectorSetup(pfname);
} else
cout << "No parameter file specified" << endl;
sls::Detector *myDet = nullptr;
try {
/****** Create detector ****************/
myDet=new sls::Detector(id);
cout << "Created multi detector id " << id << endl;
if (cf) {
myDet->loadConfig(cfname);
cout << "Config file loaded successfully" << endl;
} else {
cout << "No config file specified" << endl;
}
cout << "hostname " << myDet->getHostname() << endl;
if (pf) {
myDet->loadParameters(pfname);
cout << "Loaded parameter file successfully" << endl;
} else{
cout << "No parameter file specified" << endl;
}
} CATCH_DISPLAY ("Could not create detector/ load config/parameters.", "ctbGui::main")
/***********Create GUI stuff *******************/
TApplication theApp("App",&argc,argv);
@ -141,7 +137,7 @@ int main(int argc, char **argv) {
gROOT->ForceStyle();
ctbMain *mf=new ctbMain(gClient->GetRoot(),myDet);
ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
cout << " *** " << argc << endl;
for (int ia=0; ia<argc; ia++)

View File

@ -29,15 +29,13 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "multiSlsDetector.h"
#include "Detector.h"
#include "ctbDefs.h"
#include "ctbMain.h"
#include "ctbDacs.h"
#include "ctbSlowAdcs.h"
@ -52,7 +50,7 @@ using namespace std;
ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
: TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
myDet=det;
@ -147,7 +145,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
tf = mtab->AddTab("Power Supplies");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
pwrs=new ctbPowers(page, myDet);
pwrs=new ctbPowers(page, myDet);
i_pwrs=i_page++;
@ -155,7 +153,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
tf = mtab->AddTab("Sense");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
senses=new ctbSlowAdcs(page, myDet);
senses=new ctbSlowAdcs(page, myDet);
i_senses=i_page++;
@ -304,7 +302,7 @@ void ctbMain::HandleMenu(Int_t id)
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
if (fi.fFilename)
loadAlias(fi.fFilename);
@ -320,13 +318,12 @@ void ctbMain::HandleMenu(Int_t id)
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Save file: %s (dir: %s)\n", fi.fFilename);
printf("Save file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
if (fi.fFilename)
saveAlias(fi.fFilename);
}
break;
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
cout << "Open Parameters" << endl;
{
@ -343,23 +340,7 @@ void ctbMain::HandleMenu(Int_t id)
}
break;
case 3: //fMenuFile->AddEntry("Save Parameters", im++);
cout << "Save Parameters" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
if (fi.fFilename)
saveParameters(fi.fFilename);
}
break;
case 4: // fMenuFile->AddEntry("Open Configuration", im++);
case 3: // fMenuFile->AddEntry("Open Configuration", im++);
cout << "Open configuration" << endl;
{
static TString dir(".");
@ -375,23 +356,7 @@ void ctbMain::HandleMenu(Int_t id)
}
break;
case 5: // fMenuFile->AddEntry("Save Configuration", im++);
cout << "Save configuration" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
if (fi.fFilename)
saveConfiguration(fi.fFilename);
}
break;
case 6: //fMenuFile->AddEntry("Open Pattern", im++);
case 4: //fMenuFile->AddEntry("Open Pattern", im++);
cout << "Open pattern" << endl;
{
static TString dir(".");
@ -407,7 +372,7 @@ void ctbMain::HandleMenu(Int_t id)
}
break;
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
case 5: //fMenuFile->AddEntry("Save Pattern", im++);
cout << "Save pattern" << endl;
{
static TString dir(".");
@ -419,11 +384,11 @@ void ctbMain::HandleMenu(Int_t id)
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
if (fi.fFilename)
saveParameters(fi.fFilename);
savePattern(fi.fFilename);
}
break;
case 8: // fMenuFile->AddEntry("Exit", im++);
case 6: // fMenuFile->AddEntry("Exit", im++);
CloseWindow();
default:
@ -439,7 +404,7 @@ int ctbMain::setADCPlot(Int_t i) {
// cout << "ADC " << i << " plot or color toggled" << endl;
// acq->setGraph(i,adcs->getGraph(i));
acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
return -1;
}
@ -448,120 +413,31 @@ int ctbMain::setSignalPlot(Int_t i) {
// cout << "ADC " << i << " plot or color toggled" << endl;
// acq->setGraph(i,adcs->getGraph(i));
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
return -1;
}
int ctbMain::loadConfiguration(string fname) {
myDet->readConfigurationFile(fname);
// string line;
// int i;
// ifstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// while ( getline (myfile,line) )
// {
// }
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
void ctbMain::loadConfiguration(string fname) {
try{
myDet->loadConfig(fname);
} CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
}
int ctbMain::saveConfiguration(string fname) {
myDet->writeConfigurationFile(fname);
// string line;
// int i;
// ofstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
void ctbMain::loadParameters(string fname) {
try{
myDet->loadParameters(fname);
} CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
}
int ctbMain::loadParameters(string fname) {
myDet->retrieveDetectorSetup(fname);
// string line;
// int i;
// ifstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// while ( getline (myfile,line) )
// {
// }
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
void ctbMain::savePattern(string fname) {
try{
myDet->savePattern(fname);
} CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
}
int ctbMain::saveParameters(string fname) {
string line;
int i;
myDet->dumpDetectorSetup(fname);
// ofstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// myfile << dacs->getDacParameters();
// myfile << sig->getSignalParameters();
// myfile << adcs->getAdcParameters();
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
}
int ctbMain::loadAlias(string fname) {
@ -589,7 +465,7 @@ int ctbMain::loadAlias(string fname) {
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
pat->setPatternAlias(line);
// cout << "---------" << line<< endl;
} else if (sscanf(line.c_str(),"V%s",&i)>0) {
} else if (sscanf(line.c_str(),"V%s",aaaa)>0) {
if (pwrs) pwrs->setPwrAlias(line);
// cout << "+++++++++" << line<< endl;
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
@ -615,7 +491,6 @@ int ctbMain::saveAlias(string fname) {
string line;
int i;
ofstream myfile (fname.c_str());
if (myfile.is_open())
{

View File

@ -33,7 +33,10 @@ class ctbPowers;
class ctbSignals;
class multiSlsDetector;
namespace sls
{
class Detector;
};
class ctbPattern;
class ctbAdcs;
@ -47,7 +50,7 @@ class ctbMain : public TGMainFrame {
private:
multiSlsDetector *myDet;
sls::Detector *myDet;
@ -96,15 +99,14 @@ private:
public:
ctbMain(const TGWindow *p, multiSlsDetector *det);
ctbMain(const TGWindow *p, sls::Detector *det);
int loadAlias(string fname);
int saveAlias(string fname);
int loadParameters(string fname);
int saveParameters(string fname);
int loadConfiguration(string fname);
int saveConfiguration(string fname);
void loadParameters(string fname);
void savePattern(string fname);
void loadConfiguration(string fname);
void tabSelected(Int_t);
int setADCPlot(Int_t);
int setSignalPlot(Int_t);

View File

@ -24,15 +24,16 @@
#include <fstream>
#include "ctbPattern.h"
#include "multiSlsDetector.h"
#include "ctbDefs.h"
#include "Detector.h"
#include <chrono>
using namespace std;
ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
TGHorizontalFrame *hframe=this;
@ -116,47 +117,29 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
}
void ctbLoop::setNLoops() {
int start, stop, n;
start=-1;
stop=-1;
n=eLoopNumber->GetNumber();
try{
myDet->setPatternLoops(id,start, stop,n);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setPatternLoopCycles(id, eLoopNumber->GetNumber());
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
}
void ctbLoop::update() {
try{
int start, stop, n;
std::array<int, 3> loop;
auto loop = myDet->getPatternLoopCycles(id).tsquash("Different values");
eLoopNumber->SetNumber(loop);
auto loopaddr = myDet->getPatternLoopAddresses(id).tsquash("Different values");
eLoopStartAddr->SetHexNumber(loopaddr[0]);
eLoopStopAddr->SetHexNumber(loopaddr[1]);
try {
loop=myDet->getPatternLoops(id);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eLoopStartAddr->SetHexNumber(loop[0]);
eLoopStopAddr->SetHexNumber(loop[1]);
eLoopNumber->SetNumber(loop[2]);
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
}
ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
ctbWait::ctbWait(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
char tit[100];
TGHorizontalFrame *hframe=this;
@ -211,41 +194,25 @@ ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
void ctbWait::setWaitTime() {
Long64_t t=eWaitTime->GetNumber();
try{
t=myDet->setPatternWaitTime(id,t);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->setPatternWaitTime(id, eWaitTime->GetNumber());
} CATCH_DISPLAY ("Could not set pattern wait time for level " + to_string(id) + ".", "ctbWait::setWaitTime")
}
void ctbWait::update() {
try{
auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
auto addr = myDet->getPatternWaitAddr(id).tsquash("Different values");
int start, stop, n, addr;
Long64_t t=-1;
try{
t=myDet->setPatternWaitTime(id,t);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
addr=myDet->setPatternWaitAddr(id,-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eWaitAddr->SetHexNumber(addr);
eWaitTime->SetNumber(t);
eWaitTime->SetNumber(time);
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbWait::update")
}
@ -256,7 +223,7 @@ void ctbWait::update() {
ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
@ -490,7 +457,7 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
hframe->MapWindow();
sprintf(tit, "Number of cycles: ");
sprintf(tit, "Number of triggers: ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
@ -500,14 +467,14 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
eCycles = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
eTriggers = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( eCycles,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eCycles->MapWindow();
eCycles->Resize(150,30);
e= eCycles->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","ctbPattern",this,"setCycles()");
hframe->AddFrame( eTriggers,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eTriggers->MapWindow();
eTriggers->Resize(150,30);
e= eTriggers->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","ctbPattern",this,"setTriggers()");
// sprintf(tit, "Number of measurements: ");
@ -809,134 +776,64 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
}
void ctbPattern::update() {
try{
auto retval = myDet->getRUNClock().tsquash("Different values");
eRunClkFreq->SetNumber(retval);
} CATCH_DISPLAY ("Could not get run clock.", "ctbPattern::update")
int start, stop, n, addr;
Long_t t;
try{
auto retval = myDet->getADCClock().tsquash("Different values");
eAdcClkFreq->SetNumber(retval);
} CATCH_DISPLAY ("Could not get adc clock.", "ctbPattern::update")
try {
n=myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
auto retval = myDet->getADCPhase().tsquash("Different values");
eAdcClkPhase->SetNumber(retval);
} CATCH_DISPLAY ("Could not get adc phase shift.", "ctbPattern::update")
eRunClkFreq->SetNumber(n);
try{
auto retval = myDet->getADCPipeline().tsquash("Different values");
eAdcPipeline->SetNumber(retval);
} CATCH_DISPLAY ("Could not get adc pipeline.", "ctbPattern::update")
try {
n=myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
auto retval = myDet->getDBITClock().tsquash("Different values");
eDBitClkFreq->SetNumber(retval);
} CATCH_DISPLAY ("Could not get dbit clock.", "ctbPattern::update")
eAdcClkFreq->SetNumber(n);
try{
auto retval = myDet->getDBITPhase().tsquash("Different values");
eDBitClkPhase->SetNumber(retval);
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
try {
n=myDet->setSpeed(slsDetectorDefs::ADC_PHASE,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
auto retval = myDet->getDBITPipeline().tsquash("Different values");
eDBitPipeline->SetNumber(retval);
} CATCH_DISPLAY ("Could not get dbit pipeline.", "ctbPattern::update")
eAdcClkPhase->SetNumber(n);
try{
auto retval = myDet->getNumberOfFrames().tsquash("Different values");
eFrames->SetNumber(retval);
} CATCH_DISPLAY ("Could not get number of frames.", "ctbPattern::update")
try {
n=myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
auto timeNs = myDet->getPeriod().tsquash("Different values");
ePeriod->SetNumber(ctbDefs::ConvertChronoNStoDoubleS(timeNs));
} CATCH_DISPLAY ("Could not get period.", "ctbPattern::update")
try{
auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
eTriggers->SetNumber(retval);
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
eAdcPipeline->SetNumber(n);
try{
auto retval = myDet->getPatternLoopAddresses(-1).tsquash("Different values");
eStartAddr->SetHexNumber(retval[0]);
eStopAddr->SetHexNumber(retval[1]);
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
try {
n=myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eDBitClkFreq->SetNumber(n);
try {
n=myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,-1,0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eDBitClkPhase->SetNumber(n);
try {
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,0,-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eDBitPipeline->SetNumber(n);
try {
n=myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eFrames->SetNumber(n);
try {
n=myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
ePeriod->SetNumber(((Double_t)n)*1E-9);
try {
n=myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eCycles->SetNumber(n);
// try {
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
// } catch (...) {
// cout << "Do nothing for this error" << endl;
// }
// eMeasurements->SetNumber(n);
start=-1;
stop=-1;
n=-1;
std::array<int, 3> loop;
try {
loop=myDet->getPatternLoops(-1);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eStartAddr->SetHexNumber(loop[0]);
eStopAddr->SetHexNumber(loop[1]);
for (int iloop=0; iloop<NLOOPS; iloop++) {
eLoop[iloop]->update();
eLoop[iloop]->update();
}
for (int iwait=0; iwait<NWAITS; iwait++) {
@ -946,8 +843,9 @@ try {
getAnalogSamples();
getDigitalSamples();
getReadoutMode();
}
void ctbPattern::setFile() {
patternFileChanged(patternFile->GetText());
@ -984,7 +882,8 @@ void ctbPattern::setPatternAlias(string line){
string ctbPattern::getPatternAlias() {
char line[100000];
sprintf("PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
sprintf(line, "PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
return line;
}
@ -1032,154 +931,103 @@ string ctbPattern::getPatternFile() {
}
void ctbPattern::setFrames() {
try {
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setNumberOfFrames(eFrames->GetNumber());
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
}
void ctbPattern::setCycles() {
try {
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,eFrames->GetNumber());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
void ctbPattern::setTriggers() {
try{
myDet->setNumberOfTriggers(eTriggers->GetNumber());
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setTriggers")
}
// void ctbPattern::setMeasurements() {
// try {
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eFrames->GetNumber());
// } catch (...) {
// cout << "Do nothing for this error" << endl;
// }
// }
void ctbPattern::setPeriod() {
try {
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,ePeriod->GetNumber()*1E9);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
using std::chrono::duration;
using std::chrono::duration_cast;
using std::chrono::nanoseconds;
try{
auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
myDet->setPeriod(timeNs);
} CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
}
void ctbPattern::setAdcFreq() {
try {
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setADCClock(eAdcClkFreq->GetNumber());
} CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
}
void ctbPattern::setRunFreq() {
try{
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
myDet->setRUNClock(eRunClkFreq->GetNumber());
} CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
}
void ctbPattern::setDBitFreq() {
// cout <<"Not setting dbit frequency to " << eDBitClkFreq->GetNumber()<< endl;
try {
myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,eDBitClkFreq->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setDBITClock(eDBitClkFreq->GetNumber());
} CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
}
void ctbPattern::setAdcPhase() {
try {
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
void ctbPattern::setAdcPhase() {
try{
myDet->setADCPhase(eAdcClkPhase->GetNumber());
} CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
}
void ctbPattern::setDBitPhase() {
// cout <<"Not setting dbit phase to " << eDBitClkPhase->GetNumber()<< endl;
try {
myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,eDBitClkPhase->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setDBITPhase(eDBitClkPhase->GetNumber());
} CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
}
void ctbPattern::setAdcPipeline() {
try {
myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,eAdcPipeline->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setADCPipeline(eAdcPipeline->GetNumber());
} CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
}
void ctbPattern::setDBitPipeline() {
// cout <<"Not setting dbit pipeline to " << eDBitPipeline->GetNumber() << endl;
try {
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,eDBitPipeline->GetNumber(),0);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setDBITPipeline(eDBitPipeline->GetNumber());
} CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
}
void ctbPattern::setAnalogSamples() {
try {
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,eAnalogSamples->GetNumber());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
} CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
analogSamplesChanged(eAnalogSamples->GetNumber());
}
void ctbPattern::setDigitalSamples() {
try {
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,eDigitalSamples->GetNumber());
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
} CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
digitalSamplesChanged(eDigitalSamples->GetNumber());
}
void ctbPattern::setReadoutMode(Bool_t) {
// cout << "Set readout mode to be implemented" << endl;
slsDetectorDefs::readOutFlags flags;
if (cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::ANALOG_AND_DIGITAL;
else if (~cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::DIGITAL_ONLY;
else if (cbAnalog->IsOn() && ~cbDigital->IsOn()) flags=slsDetectorDefs::NORMAL_READOUT;
else flags=slsDetectorDefs::GET_READOUT_FLAGS;
try {
myDet->setReadOutFlags(flags);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
cout << "Set readout flags " << hex << flags << dec << endl;
slsDetectorDefs::readoutMode flag = slsDetectorDefs::ANALOG_ONLY;
if (cbAnalog->IsOn() && cbDigital->IsOn())
flag=slsDetectorDefs::ANALOG_AND_DIGITAL;
else if (~cbAnalog->IsOn() && cbDigital->IsOn())
flag=slsDetectorDefs::DIGITAL_ONLY;
else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
flag=slsDetectorDefs::ANALOG_ONLY;
else {
throw runtime_error("unkown readout flag");
}
myDet->setReadoutMode(flag);
cout << "Set readout flag: " << flag << endl;
} CATCH_DISPLAY ("Could not set readout flag", "ctbPattern::setReadoutMode")
getReadoutMode();
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
//samplesChanged(eSamples->GetNumber());
}
void ctbPattern::readoutModeChanged(int flags) {
@ -1188,72 +1036,57 @@ void ctbPattern::readoutModeChanged(int flags) {
}
int ctbPattern::getReadoutMode() {
// cout << "Get readout mode to be implemented" << endl;
slsDetectorDefs::readOutFlags flags;
try {
flags=(slsDetectorDefs::readOutFlags) myDet->setReadOutFlags();
} catch (...) {
cout << "Do nothing for this error" << endl;
}
try{
auto retval = myDet->getReadoutMode().tsquash("Different values");
switch(retval) {
case slsDetectorDefs::ANALOG_AND_DIGITAL:
cout << "analog and digital" << endl;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kTRUE);
break;
case slsDetectorDefs::DIGITAL_ONLY:
cout << "digital only" << endl;
cbAnalog->SetOn(kFALSE);
cbDigital->SetOn(kTRUE);
break;
case slsDetectorDefs::ANALOG_ONLY:
cout << "analog only" << endl;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kFALSE);
break;
default:
throw("unknown readout flag");
}
Emit("readoutModeChanged(int)",static_cast<int>(retval));
return retval;
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
cout << "++++++++++++++++++++"<< hex << flags << dec << endl;
if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
cout << "analog and digital" << hex << slsDetectorDefs::ANALOG_AND_DIGITAL << dec<< endl;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kTRUE);
} else if (flags&slsDetectorDefs::DIGITAL_ONLY) {
cout << "digital only" << hex << slsDetectorDefs::DIGITAL_ONLY << dec << endl;
cbAnalog->SetOn(kFALSE);
cbDigital->SetOn(kTRUE);
}// else if (flags==slsDetectorDefs::NORMAL_READOUT) {
// cbAnalog->SetOn(kTRUE);
// cbDigital->SetOn(kFALSE);
// }
else {
cout << "analog only" << endl;
flags=slsDetectorDefs::NORMAL_READOUT;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kFALSE);
}
Emit("readoutModeChanged(int)",(int)flags);
return (int)flags;
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
//samplesChanged(eSamples->GetNumber());
return -1;
}
int ctbPattern::getAnalogSamples() {
int n;
try {
n=(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eAnalogSamples->SetNumber((Double_t)n);
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
return eAnalogSamples->GetNumber();
try{
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
eAnalogSamples->SetNumber((Double_t)retval);
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
return eAnalogSamples->GetNumber();
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
return -1;
}
int ctbPattern::getDigitalSamples() {
int n;
try {
try{
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
eDigitalSamples->SetNumber((Double_t)retval);
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
return eDigitalSamples->GetNumber();
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
n=(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
} catch (...) {
cout << "Do nothing for this error" << endl;
}
eDigitalSamples->SetNumber(((Double_t)n));
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
return eDigitalSamples->GetNumber();
return -1;
}
void ctbPattern::analogSamplesChanged(const int t){
Emit("analogSamplesChanged(const int)", t);
}

View File

@ -27,7 +27,10 @@ class energyCalibration;
class TGTextButton;
class TGTab;
class multiSlsDetector;
namespace sls
{
class Detector;
};
#include <string>
@ -46,10 +49,10 @@ class ctbLoop : public TGHorizontalFrame {
int id;
multiSlsDetector *myDet;
sls::Detector *myDet;
public:
ctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
void setNLoops();
void update();
@ -67,10 +70,10 @@ class ctbWait : public TGHorizontalFrame {
int id;
multiSlsDetector *myDet;
sls::Detector *myDet;
public:
ctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
void setWaitTime();
void update();
@ -99,7 +102,7 @@ private:
TGNumberEntry *eStopAddr;
TGNumberEntry *eFrames;
TGNumberEntry *ePeriod;
TGNumberEntry *eCycles;
TGNumberEntry *eTriggers;
// TGNumberEntry *eMeasurements;
TGNumberEntry *eAdcPipeline;
TGNumberEntry *eDBitPipeline;
@ -122,11 +125,11 @@ private:
char pat[PATLEN*8];
multiSlsDetector *myDet;
sls::Detector *myDet;
public:
ctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
ctbPattern(TGVerticalFrame *page, sls::Detector *det);
void update();
void setAdcFreq();
@ -138,7 +141,7 @@ public:
void setAdcPipeline();
void setDBitPipeline();
void setFrames();
void setCycles();
void setTriggers();
// void setMeasurements();
void setPeriod();

View File

@ -10,61 +10,48 @@
#include <iostream>
#include <fstream>
#include "ctbDefs.h"
#include "ctbDacs.h"
#include "ctbPowers.h"
#include "multiSlsDetector.h"
#include "Detector.h"
#include "sls_detector_defs.h"
using namespace std;
ctbPower::ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d)
ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
: ctbDac(f, i, d)
{
cout << "****************************************************************power " << i << endl;
dacsUnit->SetOn(kTRUE);
dacsUnit->SetEnabled(kFALSE);
int ii=0;
switch(i) {
case slsDetectorDefs::V_POWER_IO:
dacsLabel->SetText("VIO");
ii=slsDetectorDefs::I_POWER_IO;
break;
case slsDetectorDefs::V_POWER_A:
dacsLabel->SetText("VA");
ii=slsDetectorDefs::I_POWER_A;
break;
case slsDetectorDefs::V_POWER_B:
dacsLabel->SetText("VB");
ii=slsDetectorDefs::I_POWER_B;
break;
case slsDetectorDefs::V_POWER_C:
dacsLabel->SetText("VC");
ii=slsDetectorDefs::I_POWER_C;
break;
case slsDetectorDefs::V_POWER_D:
dacsLabel->SetText("VD");
ii=slsDetectorDefs::I_POWER_D;
break;
case slsDetectorDefs::V_POWER_CHIP:
dacsLabel->SetText("VCHIP");
dacsLabel->SetEnabled(kFALSE);
ii=-1;
break;
default:
dacsLabel->SetText("Bad index");
ii=-1;
break;
};
// ctbSlowAdc *vm=new ctbSlowAdc(f,i,d);
// vm->setLabel("V: ");
// if (ii>=0) {
// ctbSlowAdc *im=new ctbSlowAdc(f,ii,d);
// im->setLabel("I: ");
// }
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
e->Disconnect ("ReturnPressed()");
@ -104,44 +91,45 @@ string ctbPower::getLabel() {
}
line << " " << dacsLabel->GetText() << endl;
return line.str();
}
void ctbPower::setValue(Long_t a) {ctbPower::setValue();}
void ctbPower::setValue(Long_t a) {cout << "ssssssssss" << endl; ctbPower::setValue();}
void ctbPower::setValue() {
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, 1);
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
try {
myDet->setVoltage(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber());
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
getValue();
}
int ctbPower::getValue() {
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, 1);
char s[100];
cout << "****************************Getting power " << val << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
sprintf(s,"%d",val);
dacsValue->SetText(s);
if (val>0) {
if (id!=slsDetectorDefs::V_POWER_CHIP)
try {
int val = myDet->getVoltage(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
dacsValue->SetText(to_string(val).c_str());
if (val > 0) {
if (id != static_cast<int>(slsDetectorDefs::V_POWER_CHIP))
dacsLabel->SetOn(kTRUE);
} else {
dacsLabel->SetOn(kFALSE);
}
return val;
} CATCH_DISPLAY ("Could not get power " + to_string(id) + ".", "ctbPower::getValue")
return -1;
}
ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
ctbPowers::ctbPowers(TGVerticalFrame* page, sls::Detector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
SetTitlePos(TGGroupFrame::kLeft);
@ -159,9 +147,8 @@ ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFr
int ctbPowers::setPwrAlias(string line) {
int is=-1, mv=0;
int is=-1;
char tit[100];
int narg;
if (sscanf(line.c_str(),"VA %s",tit)) {
dacs[0]->setLabel(tit,1);
@ -212,7 +199,6 @@ string ctbPowers::getPwrAlias() {
string ctbPowers::getPwrParameters() {
ostringstream line;
line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
@ -225,19 +211,13 @@ string ctbPowers::getPwrParameters() {
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
// }
return line.str();
}
void ctbPowers::update() {
for (int idac=0; idac<NPOWERS; idac++) {
dacs[idac]->getValue();
}
}

View File

@ -3,14 +3,7 @@
#include <TGFrame.h>
#ifndef CTB
#define NPOWERS 0
#else
#define NPOWERS 6
#endif
@ -22,8 +15,10 @@ class TGCheckButton;
class multiSlsDetector;
namespace sls
{
class Detector;
};
#include <string>
using namespace std;
@ -36,7 +31,7 @@ class ctbPower : public ctbDac {
public:
ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d);
ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
string getLabel();
@ -54,11 +49,11 @@ class ctbPowers : public TGGroupFrame
ctbPower *dacs[NPOWERS];
multiSlsDetector* myDet;
sls::Detector* myDet;
public:
//ctbPowers();
ctbPowers(TGVerticalFrame*, multiSlsDetector*);
ctbPowers(TGVerticalFrame*, sls::Detector*);
int setPwrAlias(string);
string getPwrAlias();

View File

@ -34,7 +34,8 @@
#include "ctbSignals.h"
#include "multiSlsDetector.h"
#include "ctbDefs.h"
#include "Detector.h"
using namespace std;
@ -43,7 +44,7 @@ using namespace std;
//#define DEFAULTFN "run_0.encal"
ctbSignal::ctbSignal(TGFrame *page, int i, multiSlsDetector *det)
ctbSignal::ctbSignal(TGFrame *page, int i, sls::Detector *det)
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
@ -178,10 +179,6 @@ int ctbSignal::fixOutput(int i) {
int ctbSignal::setDbitList(Long64_t r) {
Long64_t mask=((Long64_t)1<<id);
// cout << hex << r << dec <<endl;
if (r)
sDbitList->SetOn(kTRUE,kFALSE);
else
@ -197,7 +194,6 @@ int ctbSignal::isPlot() { return sPlot->IsOn();}
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
void ctbSignal::ToggledOutput(Bool_t b) {
Long_t mask=b<<id;
ToggledSignalOutput(id);
if (b) {
// sClock->SetEnabled(kTRUE);
@ -249,7 +245,7 @@ void ctbSignal::ToggledSignalPlot(Int_t b){
}
ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
ctbSignals::ctbSignals(TGVerticalFrame *page, sls::Detector *det)
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
@ -259,7 +255,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
TGHorizontalFrame *hframe;
char tit[100];
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
@ -290,36 +285,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
}
// #ifdef CTB
// idac=62;
// signals[idac]=new ctbSignal(vframe,idac,myDet);
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
// signals[idac]->MapWindow();
// sprintf(tit,"DBIT Latch");
// signals[idac]->setSignalAlias(tit,-1,-1);
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
// #endif
// idac=63;
// signals[idac]=new ctbSignal(vframe,idac,myDet);
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
// signals[idac]->MapWindow();
// sprintf(tit,"ADC Latch");
// signals[idac]->setSignalAlias(tit,-1,-1);
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
hframe=new TGHorizontalFrame(vframe, 800,50);
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
@ -398,121 +363,132 @@ string ctbSignals::getSignalAlias() {
void ctbSignals::update() {
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
// Long64_t creg=myDet->setPatternClockControl();//setCTBWord(-2,-1);
try {
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
cout << hex << oreg << dec << endl;
char val[1000];
cout << hex << oreg << dec << endl;
// cout << hex << creg << dec << endl;
sprintf(val,"%llX",oreg);
// eIOCntrlRegister->SetHexNumber(oreg);
for (int idac=0; idac<NIOSIGNALS; idac++) {
signals[idac]->setOutput(oreg);
}
Long64_t mask;
std::vector <int> dbitlist=myDet->getReceiverDbitList();
if (dbitlist.empty())
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
else {
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
for (int idac=0; idac<NIOSIGNALS; idac++) {
signals[idac]->setOutput(oreg);
}
}
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
eDbitOffset->SetNumber(myDet->getReceiverDbitOffset());
try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
// enable all
if (dbitlist.empty()) {
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
}
else {
// disable all
for (int is=0; is<64; is++) {
signals[is]->setDbitList(0);
}
// enable selected
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
}
}
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
try {
auto val = myDet->getRxDbitOffset().tsquash("Different values");
eDbitOffset->SetNumber(val);
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
}
string ctbSignals::getSignalParameters() {
try {
ostringstream line;
line << "patioctrl " << hex << myDet->setPatternIOControl() << dec << endl;//setCTBWord(-1,-1)
return line.str();
auto val = myDet->getPatternIOControl().tsquash("Different values");
ostringstream line;
line << "patioctrl " << hex << val << dec << endl;
return line.str();
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
return ("");
}
void ctbSignals::ToggledOutReg(Int_t mask) {
char val[1000];
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
Long64_t m=((Long64_t)1)<<mask;
try {
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
Long64_t m=((Long64_t)1)<<mask;
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
if (signals[mask]->isOutput()) {
cout << " or " << m ;
oreg|=m;
} else {
cout << " not " << ~m ;
oreg&=~m;
}
cout << " after " << oreg << endl;
if (signals[mask]->isOutput()) {
cout << " or " << m ;
oreg|=m;
} else {
cout << " not " << ~m ;
oreg&=~m;
}
cout << " after " << oreg << endl;
myDet->setPatternIOControl(static_cast<uint64_t>(oreg));
oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
myDet->setPatternIOControl(oreg);//setCTBWord(-1,oreg);
oreg=myDet->setPatternIOControl();//myDet->setCTBWord(-1,-1);
eIOCntrlRegister->SetText(to_string(oreg).c_str());
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
sprintf(val,"%llX",oreg);
// eIOCntrlRegister->SetHexNumber(oreg);
eIOCntrlRegister->SetText(val);
// eIOCntrlRegister->SetNumber(oreg);
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
}
void ctbSignals::ToggledDbitList(Int_t mask){
try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
cout << "************* Here" << endl;
std::vector <int> new_dbitlist;
std::vector <int> old_dbitlist=myDet->getReceiverDbitList();
char val[1000];
Long64_t m=((Long64_t)1)<<mask;
if (old_dbitlist.empty() && signals[mask]->isDbitList())
;
else {
int ns=0;
for (int is=0; is<64; is++) {
if (signals[is]->isDbitList()){
new_dbitlist.push_back(is);
ns++;
cout << is << " " << ns << endl;
// anyway all enabled
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
;
}
// set the dbitlist
else {
std::vector <int> new_dbitlist;
for (int is=0; is<64; is++) {
if (signals[is]->isDbitList()){
new_dbitlist.push_back(is);
cout << is << " " << new_dbitlist.size() - 1 << endl;
}
}
if (new_dbitlist.size() > 64)
new_dbitlist.clear();
myDet->setRxDbitList(new_dbitlist);
// get list again
dbitlist = myDet->getRxDbitList().tsquash("Different values");
}
// enable all
if (dbitlist.empty()) {
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
}
else {
// disable all
for (int is=0; is<64; is++) {
signals[is]->setDbitList(0);
}
// enable selected
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
}
}
if (ns>63) new_dbitlist.clear();
myDet->setReceiverDbitList(new_dbitlist);
}
std::vector <int> dbitlist=myDet->getReceiverDbitList();
if (dbitlist.empty())
for (int is=0; is<64; is++) signals[is]->setDbitList(1);
else
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
for (const auto &value : dbitlist) signals[value]->setDbitList(1);
} CATCH_DISPLAY ("Could not get/set receiver dbit list.", "ctbSignals::ToggledDbitList")
}
@ -533,16 +509,23 @@ void ctbSignals::ToggledSignalPlot(Int_t b) {
Pixel_t ctbSignals::getColor(int i){
if (i>=0 && i<NSIGNALS) return signals[i]->getColor();
if (i>=0 && i<NSIGNALS)
return signals[i]->getColor();
return static_cast<Pixel_t>(-1);
}
int ctbSignals::getPlot(int i){
if (i>=0 && i<NSIGNALS) return signals[i]->isPlot();
if (i>=0 && i<NSIGNALS)
return signals[i]->isPlot();
return -1;
};
void ctbSignals::setDbitOffset(Long_t) {
setDbitOffset();
}
void ctbSignals::setDbitOffset(){
myDet->setReceiverDbitOffset(eDbitOffset->GetNumber());
try {
myDet->setRxDbitOffset(eDbitOffset->GetNumber());
} CATCH_DISPLAY ("Could not set receiver dbit offset.", "ctbSignals::setDbitOffset")
}

View File

@ -25,7 +25,10 @@ class TGColorSelect;
class TGNumberEntry;
class multiSlsDetector;
namespace sls
{
class Detector;
};
class ctbSignal;
#include <string>
@ -45,14 +48,14 @@ private:
TGNumberEntry *sEntry;
TGColorSelect *fColorSel;
multiSlsDetector *myDet;
sls::Detector *myDet;
Int_t id;
TH1I *hsig;
public:
ctbSignal(TGFrame *page, int i, multiSlsDetector *det);
ctbSignal(TGFrame *page, int i, sls::Detector *det);
int setSignalAlias(char *tit, int plot, int col);
string getSignalAlias();
@ -89,10 +92,10 @@ private:
TGNumberEntry *eIOCntrlRegister;
TGNumberEntry *eDbitOffset;
multiSlsDetector *myDet;
sls::Detector *myDet;
public:
ctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
int setSignalAlias(string line);
string getSignalAlias();

View File

@ -9,7 +9,8 @@
#include <TGButton.h>
#include "ctbSlowAdcs.h"
#include "multiSlsDetector.h"
#include "ctbDefs.h"
#include "Detector.h"
#include "sls_detector_defs.h"
using namespace std;
@ -17,7 +18,7 @@ using namespace std;
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
TGHorizontalFrame *hframe=this;
@ -55,9 +56,6 @@ ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TG
b->SetTextJustify(kTextLeft);
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
}
@ -66,38 +64,50 @@ int ctbSlowAdc::setLabel(char *tit) {
if(tit)
dacsLabel->SetText(tit);
return id;
}
string ctbSlowAdc::getLabel() {
ostringstream line;
line << dacsLabel->GetText() << endl;
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
return line.str();
}
int ctbSlowAdc::getValue() {
int val=myDet->getADC((slsDetectorDefs::dacIndex)id);
char s[100];
cout << "adc " << id << " " << val << endl;
sprintf(s,"%d mV",val);
if (id==999)
sprintf(s,"%d <20>C",val);
dacsValue->SetText(s);
try {
std::string s;
return val;
// temp
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
int val = myDet->getTemperature(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
cout << "slow adc temp" << " " << val << endl;
s = to_string(val) + " " + to_string(0x00b0) + "C";//<2F>C
dacsValue->SetText(s.c_str());
return val;
}
// mv
else {
int val = myDet->getSlowADC(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
cout << "slow adc " << id << " " << val << endl;
s = to_string(val) + " mV";
dacsValue->SetText(s.c_str());
return val;
}
} CATCH_DISPLAY ("Could not get slow dac " + to_string(id) + ".", "ctbSlowAdc::getValue")
return -1;
}
@ -106,8 +116,7 @@ int ctbSlowAdc::getValue() {
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
@ -116,14 +125,12 @@ ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGro
// cout << "window mapped " << endl;
for (int idac=0; idac<NSLOWADCS; idac++) {
for (int idac=0; idac<NSLOWADCS + 1; idac++) {
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
}
adcs[NSLOWADCS]=new ctbSlowAdc(this, 999, myDet);
adcs[NSLOWADCS]->setLabel("Temperature");
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
}
@ -133,7 +140,7 @@ int ctbSlowAdcs::setSlowAdcAlias(string line) {
int is=-1, mv=0;
char tit[100];
int narg=sscanf(line.c_str(),"SENSE%d %s",&is,tit,&mv);
int narg=sscanf(line.c_str(),"SENSE%d %s %d",&is,tit,&mv);
if (narg<2)
return -1;
if (is>=0 && is<NSLOWADCS)
@ -149,7 +156,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
for (int i=0; i<NSLOWADCS; i++)
line << adcs[i]->getLabel() << endl;
return line.str();
}
@ -157,7 +163,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
string ctbSlowAdcs::getAdcParameters() {
ostringstream line;
for (int i=0; i<NSLOWADCS; i++) {
@ -166,20 +171,12 @@ string ctbSlowAdcs::getAdcParameters() {
}
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
return line.str();
}
void ctbSlowAdcs::update() {
for (int idac=0; idac<NSLOWADCS+1; idac++) {
adcs[idac]->getValue();
}
}

View File

@ -19,7 +19,10 @@ class TGTextButton;
class multiSlsDetector;
namespace sls
{
class Detector;
};
#include <string>
using namespace std;
@ -35,9 +38,9 @@ class ctbSlowAdc : public TGHorizontalFrame {
TGLabel *dacsValue;
int id;
multiSlsDetector* myDet;
sls::Detector* myDet;
public:
ctbSlowAdc(TGGroupFrame*, int , multiSlsDetector*);
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
int getValue();
int setLabel(char *tit);
@ -56,10 +59,10 @@ private:
ctbSlowAdc *adcs[NSLOWADCS+1];
multiSlsDetector* myDet;
sls::Detector* myDet;
public:
ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector*);
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
int setSlowAdcAlias(string line);
// int setDacAlias(string line);

View File

@ -3,9 +3,11 @@ find_package(Sphinx)
if (DOXYGEN_FOUND AND SPHINX_FOUND)
# #Utility to generate command line documentation
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
# Utility to generate command line documentation
add_executable(gendoc src/gendoc.cpp)
# This is a bit hacky, but better than exposing stuff?
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src)
target_link_libraries(gendoc PRIVATE
slsDetectorShared
)

View File

@ -36,7 +36,7 @@ int main() {
std::cout << "Generating command line documentation!\n";
sls::CmdProxy<sls::Detector> proxy(nullptr);
sls::CmdProxy proxy(nullptr);
auto commands = proxy.GetProxyCommands();
std::ofstream fs("commands.rst");

View File

@ -0,0 +1,132 @@
#G1 Energy #G2 Energy
300 7000
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1

View File

@ -8,7 +8,7 @@ period 0.000024984
delay 0.999999968
gates 1
frames 300000.000000000
cycles 1.000000000
triggers 1.000000000
timing auto
fineoff 0.000000
startscript none

View File

@ -22,56 +22,56 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Set and get dacs",
auto th = 1000;
// set and read back each individual dac of EIGER
d.setDAC(0, di::E_SvP, 0);
CHECK(d.setDAC(-1, di::E_SvP, 0) == 0);
d.setDAC(4000, di::E_SvN, 0);
CHECK(d.setDAC(-1, di::E_SvN, 0) == 4000);
d.setDAC(2000, di::E_Vtr, 0);
CHECK(d.setDAC(-1, di::E_Vtr, 0) == 2000);
d.setDAC(3500, di::E_Vrf, 0);
CHECK(d.setDAC(-1, di::E_Vrf, 0) == 3500);
d.setDAC(1400, di::E_Vrs, 0);
CHECK(d.setDAC(-1, di::E_Vrs, 0) == 1400);
d.setDAC(2556, di::E_Vtgstv, 0);
CHECK(d.setDAC(-1, di::E_Vtgstv, 0) == 2556);
d.setDAC(1500, di::E_Vcmp_ll, 0);
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == 1500);
d.setDAC(1400, di::E_Vcmp_lr, 0);
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == 1400);
d.setDAC(4000, di::E_cal, 0);
CHECK(d.setDAC(-1, di::E_cal, 0) == 4000);
d.setDAC(1300, di::E_Vcmp_rl, 0);
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == 1300);
d.setDAC(1200, di::E_Vcmp_rr, 0);
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == 1200);
d.setDAC(1100, di::E_rxb_rb, 0);
CHECK(d.setDAC(-1, di::E_rxb_rb, 0) == 1100);
d.setDAC(1100, di::E_rxb_lb, 0);
CHECK(d.setDAC(-1, di::E_rxb_lb, 0) == 1100);
d.setDAC(1500, di::E_Vcp, 0);
CHECK(d.setDAC(-1, di::E_Vcp, 0) == 1500);
d.setDAC(2000, di::E_Vcn, 0);
CHECK(d.setDAC(-1, di::E_Vcn, 0) == 2000);
d.setDAC(1550, di::E_Vis, 0);
CHECK(d.setDAC(-1, di::E_Vis, 0) == 1550);
d.setDAC(0, di::SVP, 0);
CHECK(d.setDAC(-1, di::SVP, 0) == 0);
d.setDAC(4000, di::SVN, 0);
CHECK(d.setDAC(-1, di::SVN, 0) == 4000);
d.setDAC(2000, di::VTR, 0);
CHECK(d.setDAC(-1, di::VTR, 0) == 2000);
d.setDAC(3500, di::VRF, 0);
CHECK(d.setDAC(-1, di::VRF, 0) == 3500);
d.setDAC(1400, di::VRS, 0);
CHECK(d.setDAC(-1, di::VRS, 0) == 1400);
d.setDAC(2556, di::VTGSTV, 0);
CHECK(d.setDAC(-1, di::VTGSTV, 0) == 2556);
d.setDAC(1500, di::VCMP_LL, 0);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == 1500);
d.setDAC(1400, di::VCMP_LR, 0);
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == 1400);
d.setDAC(4000, di::CAL, 0);
CHECK(d.setDAC(-1, di::CAL, 0) == 4000);
d.setDAC(1300, di::VCMP_RL, 0);
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == 1300);
d.setDAC(1200, di::VCMP_RR, 0);
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == 1200);
d.setDAC(1100, di::RXB_RB, 0);
CHECK(d.setDAC(-1, di::RXB_RB, 0) == 1100);
d.setDAC(1100, di::RXB_LB, 0);
CHECK(d.setDAC(-1, di::RXB_LB, 0) == 1100);
d.setDAC(1500, di::VCP, 0);
CHECK(d.setDAC(-1, di::VCP, 0) == 1500);
d.setDAC(2000, di::VCN, 0);
CHECK(d.setDAC(-1, di::VCN, 0) == 2000);
d.setDAC(1550, di::VIS, 0);
CHECK(d.setDAC(-1, di::VIS, 0) == 1550);
d.setDAC(660, di::IO_DELAY, 0);
CHECK(d.setDAC(-1, di::IO_DELAY, 0) == 660);
// setting threshold sets all individual vcmp
d.setDAC(th, di::THRESHOLD, 0);
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == th);
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == th);
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == th);
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == th);
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == th);
// different values gives -1
if (d.getNumberOfDetectors() > 1) {
d.setDAC(1600, di::E_Vcmp_ll, 0, 0);
d.setDAC(1700, di::E_Vcmp_ll, 0, 1);
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 0) == 1600);
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 1) == 1700);
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == -1);
d.setDAC(1600, di::VCMP_LL, 0, 0);
d.setDAC(1700, di::VCMP_LL, 0, 1);
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 0) == 1600);
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 1) == 1700);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 1) == -1);

View File

@ -102,8 +102,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
// Setting and reading exposure time
auto t = 1000000000;
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
d.setExptime(t);
CHECK(d.getExptime() == t);
// size of an eiger half module with and without gap pixels
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
@ -143,8 +143,8 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
// Can we still access the detector while it's locked
auto t = 1300000000;
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
d.setExptime(t);
CHECK(d.getExptime() == t);
// unlock again and free
d.lockServer(0);
@ -163,12 +163,12 @@ TEST_CASE("Set settings", "[.integration][.single]"){
TEST_CASE("Timer functions", "[.integration][cli]") {
// FRAME_NUMBER, /**< number of real time frames: total number of
// acquisitions is number or frames*number of cycles */ ACQUISITION_TIME,
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
// frame (in gated mode) */ CYCLES_NUMBER, /**< number of cycles: total
// number of acquisitions is number or frames*number of cycles */
// frame (in gated mode) */ TRIGGER_NUMBER, /**< number of triggers: total
// number of acquisitions is number or frames*number of triggers */
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
// */
@ -190,49 +190,38 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
// Number of frames
auto frames = 5;
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
d.setNumberOfFrames(frames);
CHECK(d.getNumberOfFrames() == frames);
auto exptime = 2000000000;
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == exptime);
d.setExptime(exptime);
CHECK(d.getExptime() == exptime);
auto period = 2000000000;
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
d.setPeriod(period);
CHECK(d.getPeriod() == period);
if (test::type != dt::EIGER) {
auto delay = 10000;
d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) ==
d.setDelayAfterTrigger(delay);
CHECK(d.getDelayAfterTrigger() ==
delay);
}
if (test::type != dt::EIGER) {
auto gates = 1;
d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
}
auto cycles = 2;
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
auto triggers = 2;
d.setNumberOfTriggers(triggers);
CHECK(d.getNumberOfTriggers() == triggers);
if (test::type == dt::EIGER) {
auto subtime = 200;
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME,
subtime);
CHECK(d.setTimer(
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) ==
subtime);
d.setSubExptime(subtime);
CHECK(d.getSubExptime() == subtime);
}
// for (int i =0; i!=frames; ++i)
d.startAndReadAll();
d.freeSharedMemory();
// If we add a timer we should add tests for the timer
CHECK(slsDetectorDefs::MAX_TIMERS == 19);
}
// TEST_CASE("Aquire", "[.integration][eiger]"){
@ -243,13 +232,13 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
// auto period = 1000000000;
// auto exptime = 100000000;
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
// d.setNumberOfFrames(5);
// d.setExptime(exptime);
// d.setPeriod(period);
// d.startAndReadAll();
// auto rperiod =
// d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
// d.getMeasuredPeriod();
// CHECK(rperiod == 0.1);
// d.freeSharedMemory();
@ -474,7 +463,7 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(m.getHostname() == c.hostname);
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
CHECK(m.setNumberOfFrames(1) == 1);
// starting fnum
uint64_t val = 8;

View File

@ -50,7 +50,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
// DELAY_AFTER_TRIGGER,
// GATES_NUMBER,
// CYCLES_NUMBER,
// TRIGGER_NUMBER,
// ACTUAL_TIME
// MEASUREMENT_TIME

View File

@ -17,13 +17,13 @@
/*! \file document.h */
#include "reader.h"
#include "encodedstream.h"
#include "internal/meta.h"
#include "internal/strfunc.h"
#include "memorystream.h"
#include "encodedstream.h"
#include <new> // placement new
#include "reader.h"
#include <limits>
#include <new> // placement new
RAPIDJSON_DIAG_PUSH
#ifdef _MSC_VER

View File

@ -15,8 +15,8 @@
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
#define RAPIDJSON_ENCODEDSTREAM_H_
#include "stream.h"
#include "memorystream.h"
#include "stream.h"
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH

View File

@ -15,9 +15,9 @@
#ifndef RAPIDJSON_STRTOD_
#define RAPIDJSON_STRTOD_
#include "ieee754.h"
#include "biginteger.h"
#include "diyfp.h"
#include "ieee754.h"
#include "pow10.h"
RAPIDJSON_NAMESPACE_BEGIN

View File

@ -164,8 +164,8 @@
#include "msinttypes/inttypes.h"
#else
// Other compilers should have this.
#include <stdint.h>
#include <inttypes.h>
#include <stdint.h>
#endif
//!@endcond
#ifdef RAPIDJSON_DOXYGEN_RUNNING

View File

@ -18,11 +18,11 @@
/*! \file reader.h */
#include "allocators.h"
#include "stream.h"
#include "encodedstream.h"
#include "internal/meta.h"
#include "internal/stack.h"
#include "internal/strtod.h"
#include "stream.h"
#include <limits>
#if defined(RAPIDJSON_SIMD) && defined(_MSC_VER)

View File

@ -353,19 +353,19 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
\begin{table}
\begin{tabular}{|c|c|c|c|c|}
\hline
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{time to send out data ($\mu$s)}\\
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{calculated/measered time to send out data ($\mu$s)}\\
\hline
1 & 16 & \textbf{256} & 3901 & \\
\hline
1 & 32 & \textbf{128} & 7820 & \\
\hline
10 & 4 & \textbf{10240} & 98 & 100\\
10 & 4 & \textbf{10240} & 98 & 105/128\\
\hline
10 & 8 & \textbf{5120} & 196 & 200\\
10 & 8 & \textbf{5120} & 196 & 210/250\\
\hline
10 & 16 & \textbf{2560} & 391 & 400\\
10 & 16 & \textbf{2560} & 391 & 420/490\\
\hline
10 & 32 & \textbf{1280} & 782 & 800\\
10 & 32 & \textbf{1280} & 782 & 840/977\\
\hline
\end{tabular}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
@ -609,17 +609,17 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
\begin{verbatim}
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
sls_detector_put 0-frames x
sls_detector_put 0-cycles y
sls_detector_put 0-triggers y
sls_detector_acquire 0-
\end{verbatim}
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
Here are the implemented options so far:
\begin{itemize}
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{triggers}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{triggers}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
@ -628,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
\begin{verbatim}
sls_detector_put 0-timing [trigger/burst_trigger]
sls_detector_put 0-frames x
sls_detector_put 0-cycles y
sls_detector_put 0-triggers y
sls_detector_status trigger
\end{verbatim}
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
@ -715,7 +715,7 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
Here is a list of parameters that should be reset:
\begin{enumerate}
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
\end{enumerate}
@ -794,9 +794,23 @@ Transmission delays should be chosen only to accomodate the writing speed of the
Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as:
\begin{equation}
{\tt{txndelay\_frame}}=-tsending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s]}
{\tt{txndelay\_frame}}=-t_sending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s] \cdot 8}
\end{equation}
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing sped of 1/400~$\mu$s (2.5~kHz) in achieved.
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing speed of 1/400~$\mu$s (2.5~kHz) in achieved.
Note that:
\begin{enumerate}
\item The continuos frame rate goes down when transmission delays are introduced:
\begin{equation}
continuos\_frame\_rate= \frac{1}{\tt{txndelay\_frame}+t\_sending}
\end{equation}
\item If your transmission delays reduce the continuos frame rate, you will saturate the memory on board at some point and you will corrupt images. Conservatively, we say that the number of maximum images in buffered mode is the one listed in table~\ref{timgs}, call N\_images. However, one can approximately say that (and here we need to test more, so do not believe to these numbers yet),
\begin{equation}
N\_tot\_images= N\_images+\frac{ N\_images}{frame\_rate \cdot (t\_delay\_frame + t\_sending) }
\end{equation}
\end{enumerate}
\section{Setting up the PC settings for 10Gb}\label{10g}
@ -818,12 +832,8 @@ ethtool -G xth1 rx 4096 #or wheterver is the max number for your pc
ethtool -C xth1 rx-usecs 100
ethtool -A xth1 rx on
\end{verbatim}
where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
To try to bypass being root, we trued something like this:
\begin{verbatim}
/etc/security/limits.conf username rtprio 99
\end{verbatim}
but somehow it did not fully worked so we kept the trick of being root.
where {\tt{xth1}} can be replaced with the correct 10Gb device.
NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
\begin{verbatim}
@ -857,10 +867,18 @@ to make the settings permanent, edit /etc/sysctl.conf:
\begin{verbatim}
# 100MiB
net.core.rmem_max = 104857600
net.core.rmem_default= 104857600
net.core.netdev_max_backlog = 250000
\end{verbatim}
and run \textbf{sysctl -p}.
To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
To try to bypass being root, we trued something like this:
\begin{verbatim}
/etc/security/limits.conf username rtprio 99
\end{verbatim}
but somehow it did not fully worked so we kept the trick of being root.
Last, you can disable power saving in the CPU frequency (chose the appropriate command for your system):
\begin{verbatim}
cpupower frequency-info
@ -895,9 +913,6 @@ mount -t tmpfs none /mnt/ramdisk -o size=10G
\end{verbatim}
check how many GB memory you can allocate, to avoid swapping otherwise
\section{Offline processing and monitoring}
\subsection{Data out of the detector: UDP packets}\label{UDP}
@ -935,19 +950,22 @@ If you use the option of writing raw files, you will have a raw file for each UD
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like:
\begin{verbatim}
Version : 2.0
Version : 4.0
Detector Type : 3
Dynamic Range : 32
Ten Giga : 1
Image Size : 524288 bytes
x : 512 pixels
y : 256 pixels
Max. Frames Per File : 10000
Total Frames : 1
Exptime (ns) : 1000000000
nPixelsX : 512 pixels
nPixelsY : 256 pixels
Max Frames Per File : 10000
Total Frames : 3
Exptime (ns) : 10000000
SubExptime (ns) : 2621440
SubPeriod(ns) : 2621440
Period (ns) : 1000000000
Timestamp : Mon Sep 3 09:07:05 2018
Period (ns) : 0
Gap Pixels Enable : 0
Quad Enable : 0
Timestamp : Wed Aug 21 16:30:20 2019
#Frame Header
@ -957,9 +975,9 @@ Packet Number : 4 bytes
Bunch ID : 8 bytes
Timestamp : 8 bytes
Module Id : 2 bytes
X Coordinate : 2 bytes
Y Coordinate : 2 bytes
Z Coordinate : 2 bytes
Row : 2 bytes
Column : 2 bytes
Reserved : 2 bytes
Debug : 4 bytes
Round Robin Number : 2 bytes
Detector Type : 1 byte
@ -972,15 +990,15 @@ Note that if one wants to reconstruct the real time the detector was acquiring
\subsection{Offline image reconstruction}
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
Checkout the {\tt{developer}} branch if in a 3.1.X release or the {\tt{v4.0.0}} branch if in 4.0.X release of the {\tt{slsDetector}} code.
Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
Note that the number of images per file is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
\begin{verbatim}
#define EIGER_MAX_FRAMES_PER_FILE 2000
\end{verbatim}
The default is 2000.
The default is 2000 in the 3.1.X release. The default has been changed to 10000 frm realease 4.0.X and now this is picked up automatically without doing anything.
\subsubsection{cbf}
The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it downloads architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\
@ -1239,7 +1257,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
./sls_detector_put enablefwrite 0
./sls_detector_put resetframescaught 0
./sls_detector_put index 0
./sls_detector_put cycles 21
./sls_detector_put triggers 21
./sls_detector_put receiver start
./sls_detector_put status start
for i in $(seq 0 20);
@ -1497,8 +1515,8 @@ frames number
where {\tt{number}} is a string to be interpreted as an integer.
\item \begin{verbatim}
sls_detector_get cycles
cycles number
sls_detector_get triggers
triggers number
\end{verbatim}
where {\tt{number}} is a string to be interpreted as an integer.

View File

@ -111,7 +111,7 @@
"delay"; // sets/gets delay after trigger in s
"gates"; // sets/gets number of gates per frame in gated mode
"frames"; // sets/gets number of frames
"cycles"; // sets/gets number of cycles (use in trigger mode)
"triggers"; // sets/gets number of triggers (use in trigger mode)
"probes"; // sets/gets number of probes (advanced!)
"measurements"; // sets/gets number of non-real time measurements
/* read only timers */
@ -120,7 +120,7 @@
"delayl"; // gets delay left
"gatesl"; // gets number of gates left
"framesl"; // gets number of frames left
"cyclesl"; // gets number of cycles left
"triggersl"; // gets number of triggers left
"now"; // gets time stamp from the dteector
"timestamp"; // gets time stamp for the frames (fifo-style)
"framescaught";// gets the entire frames caught by receiver

View File

@ -94,7 +94,7 @@ where: \\
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
\textit{p} is the position index, if different positions are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
\textit{i} is the file index;\\
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN and \E raw data, \textit{.dat} for MYTHEN processed data.
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
@ -115,10 +115,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
Refer to the detailed documentation to understand how the different timing modes work.
\item[frames n]
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
Note that the total number of images will be frames times cycles. Refer to detailed documentation to understand how the different timing modes work.
\item[cycles n]
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
Note that the total number of images will be by frames times cycles. Refer to the detailed documentation to understand how the different timing modes work.
Note that the total number of images will be frames times triggers. Refer to detailed documentation to understand how the different timing modes work.
\item[triggers n]
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
Note that the total number of images will be by frames times triggers. Refer to the detailed documentation to understand how the different timing modes work.
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
Refer to detailed documentation to understand how the different timing modes work.
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automatically incremented.\\
@ -231,7 +231,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
%\item[delayl]
%\item[gatesl]
%\item[framesl]
%\item[cyclesl]
%\item[triggersl]
%\item[frameindex]
%\item[now]
\end{description}
@ -430,11 +430,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
Refer to detailed documentation to understand how the different timing modes work.
\item[frames]
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). Returned as a string to be interpreted as an integer ``frames integer''
Note that the total number of images is frames times cycles.
Note that the total number of images is frames times triggers.
Refer to detailed documentation to understand how the different timing modes work.
\item[cycles n]
Returns the number of cycles (e.g. number of triggers). Returned as atring to be interpreted as an integer ``cycles integer''
Note that the total number of images is frames times cycles.
\item[triggers n]
Returns the number of triggers (e.g. number of triggers). Returned as atring to be interpreted as an integer ``triggers integer''
Note that the total number of images is frames times triggers.
Refer to detailed documentation to understand how the different timing modes work.
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
Refer to detailed documentation to understand how the different timing modes work.
@ -556,7 +556,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
\item[delayl] Returns the delay after trigger left for the current frame.
\item[gatesl] Returns the number of gates left for the current frame.
\item[framesl] Returns the number of frames left for the current cycle.
\item[cyclesl] Returns the number of cycles left for the current acquisition.
\item[triggersl] Returns the number of triggers left for the current acquisition.
\item[now] Returns the current timestamp of the detector clock.
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
\end{description}

View File

@ -217,7 +217,7 @@ is used to configure the detector parameter var
\item[delay t] Sets the delay after trigger (in s)
\item[gates n] Sets the number of gates per frame
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
\item[probes n] Sets the number of probes to accumulate (max 3)
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
\item[flags mode] Sets the readout flags - can be none or storeinram
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
\item[delay] Gets the delay after trigger (in s)
\item[gates] Gets the number of gates per frame
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
\item[cycles] Gets the number of cycles (e.g. number of triggers)
\item[triggers] Gets the number of triggers (e.g. number of triggers)
\item[probes] Gets the number of probes to accumulate (max 3)
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
\item[dr] Gets the dynamic range

View File

@ -372,7 +372,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
gs 1 -1 sc (Number of frames) col0 sh gr
/Times-Roman ff 450.00 scf sf
11325 9150 m
gs 1 -1 sc (Number of cycles) col0 sh gr
gs 1 -1 sc (Number of triggers) col0 sh gr
/Times-Roman ff 240.00 scf sf
5325 4950 m
gs 1 -1 sc (Readout) col0 sh gr

View File

@ -118,7 +118,7 @@ Single
21900 2700 22050 2700
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001

View File

@ -95,7 +95,7 @@ Single
4 0 0 50 0 0 30 0.0000 4 405 2580 9450 6600 Exposure time\001
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 300 2565 1050 4125 Detection time\001
4 0 0 50 0 0 30 0.0000 4 300 1785 1050 5550 Dead time\001

View File

@ -341,7 +341,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
gs 1 -1 sc (Number of frames) col0 sh gr
/Times-Roman ff 450.00 scf sf
11325 9150 m
gs 1 -1 sc (Number of cycles) col0 sh gr
gs 1 -1 sc (Number of triggers) col0 sh gr
/Times-Roman ff 240.00 scf sf
5325 4950 m
gs 1 -1 sc (Readout) col0 sh gr

View File

@ -79,7 +79,7 @@ Single
4200 5850 4650 5850
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001

View File

@ -118,7 +118,7 @@ Single
21900 2700 22050 2700
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001

View File

@ -401,7 +401,7 @@ gs 1 -1 sc (External trigger) col0 sh gr
gs 1 -1 sc (Number of frames) col0 sh gr
/Times-Roman ff 450.00 scf sf
12600 9150 m
gs 1 -1 sc (Number of cycles) col0 sh gr
gs 1 -1 sc (Number of triggers) col0 sh gr
/Times-Roman ff 240.00 scf sf
6600 4950 m
gs 1 -1 sc (Readout) col0 sh gr

View File

@ -111,7 +111,7 @@ Single
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
4 0 0 50 0 0 30 0.0000 4 405 2760 825 2700 External trigger\001
4 0 0 50 0 0 30 0.0000 4 300 3225 8250 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 6600 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 405 2580 4575 6225 Exposure time\001
4 0 0 50 0 0 30 0.0000 4 300 1140 9525 6225 Period\001

View File

@ -79,7 +79,7 @@ Single
4200 5850 4650 5850
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001

View File

@ -217,7 +217,7 @@ is used to configure the detector parameter var
\item[delay t] Sets the delay after trigger (in s)
\item[gates n] Sets the number of gates per frame
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
\item[probes n] Sets the number of probes to accumulate (max 3)
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
\item[flags mode] Sets the readout flags - can be none or storeinram
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
\item[delay] Gets the delay after trigger (in s)
\item[gates] Gets the number of gates per frame
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
\item[cycles] Gets the number of cycles (e.g. number of triggers)
\item[triggers] Gets the number of triggers (e.g. number of triggers)
\item[probes] Gets the number of probes to accumulate (max 3)
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
\item[dr] Gets the dynamic range

View File

@ -127,7 +127,7 @@ where: \\
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
\textit{p} is the position index, if different positions are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
\textit{i} is the file index;\\
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
@ -241,7 +241,7 @@ Figure~\ref{eq:acqflow} shows in which sequence the various scripts and loops ar
If you prefere to handle the acquisition from your acquisition enviroment, simply leave al scripts and scans disabled and call the acquition from your acquisition enviroment. \\
Only the frames and cycles loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
Only the frames and triggers loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
Hereafter a description of the meaning of the various loops:
\begin{description}
@ -259,11 +259,11 @@ Hereafter a description of the meaning of the various loops:
The detector is moved in the angular positions specified by the positions command.\\
The command for moving the detector should be defined as described in~\ref{sec:usersFunc}.\\
All data acquired during a position loop will be merged together, unless the number of positions is set to 0. In this case single frames will be converted to angle without merging.\\
Avoid using the position loop together with many frames/cycles.
Avoid using the position loop together with many frames/triggers.
\item[Cycles loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times cycles.
\item[Triggers loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times triggers.
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times cycles.
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times triggers.
\end{description}
Executing a script simply consists in a system call with the arguments specified below. The various scripts are executed only if they are enabled and different than \textit{none}. \\
@ -332,11 +332,11 @@ In the following is a list of the main parameters involved in the acquisition ti
\item[Period] is the period of the images acquired. If it is shorter than the exposure time plus readout time, it will be ignored.
\item[Delay after trigger] can be set as a delay between the trigger signal and the start of the detection time.
\item[Number of gates] is used only in \textit{gating} mode and is the number of times that the gate is toggled before the detector is read out. Useful for stroboscopic measurements with gate period shorter than the minim acquisition period of the detector, otherwise can be left to 1.
\item[Number of frames] is the number of images to be acquired per cycle. Frames and cycles have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time cycles.
\item[Number of cycles] is the number of times that the frames are acquired. Frames and cycles have the same meaning except in trigger mode, when cycles means the number of triggers that will be accepted. The total number of images is frames time cycles.
\item[Number of frames] is the number of images to be acquired per cycle. Frames and triggers have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time triggers.
\item[Number of triggers] is the number of times that the frames are acquired. Frames and triggers have the same meaning except in trigger mode, when triggers means the number of triggers that will be accepted. The total number of images is frames time triggers.
\item[Number of probes] is used in stoboscopic measurements when the period is longer than the minimum acquisition period, but shorter than the frame rate.\\
In this case the data can be summed in firmware. \\
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of cycles to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of triggers to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
The returned images will always have 32~bit dynamic range, while the dynamic range if the detector defines the bit depth of the counters in rder to limit the readout time, if necessary.\\
The probes counter waorks also in trigger and gating modes.
\end{description}
@ -349,14 +349,14 @@ The probes counter waorks also in trigger and gating modes.
\begin{center}
\includegraphics[width=\textwidth]{images/normal_acquisition.eps}
\end{center}
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[width=\textwidth]{images/gated_acquisition.eps}
\end{center}
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
\end{figure}
@ -365,7 +365,7 @@ The probes counter waorks also in trigger and gating modes.
\begin{center}
\includegraphics[width=\textwidth]{images/trigger_acquisition.eps}
\end{center}
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of cycles (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of triggers (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
\end{figure}
@ -373,7 +373,7 @@ The probes counter waorks also in trigger and gating modes.
\begin{center}
\includegraphics[width=\textwidth]{images/ro_trigger_acquisition.eps}
\end{center}
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of cycles (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of triggers (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
\end{figure}

View File

@ -91,7 +91,7 @@ where: \\
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
\textit{p} is the position index, if different positions are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
\textit{i} is the file index;\\
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
@ -110,10 +110,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
Refere to the detailed documentation to understand how the different timing modes work.
\item[frames n]
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
Note that the total number of images will be frames times cycles. Refere to detailed documentation to understand how the different timing modes work.
\item[cycles n]
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
Note that the total number of images will be by frames times cycles. Refere to the detailed documentation to understand how the different timing modes work.
Note that the total number of images will be frames times triggers. Refere to detailed documentation to understand how the different timing modes work.
\item[triggers n]
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
Note that the total number of images will be by frames times triggers. Refere to the detailed documentation to understand how the different timing modes work.
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
Refere to detailed documentation to understand how the different timing modes work.
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automotically incremented.\\
@ -234,7 +234,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
%\item[delayl]
%\item[gatesl]
%\item[framesl]
%\item[cyclesl]
%\item[triggersl]
%\item[frameindex]
%\item[now]
\end{description}
@ -393,11 +393,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
Refere to detailed documentation to understand how the different timing modes work.
\item[frames]
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode).
Note that the total number of images is frames times cycles.
Note that the total number of images is frames times triggers.
Refere to detailed documentation to understand how the different timing modes work.
\item[cycles n]
Returns the number of cycles (e.g. number of triggers).
Note that the total number of images is frames times cycles.
\item[triggers n]
Returns the number of triggers (e.g. number of triggers).
Note that the total number of images is frames times triggers.
Refere to detailed documentation to understand how the different timing modes work.
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
Refere to detailed documentation to understand how the different timing modes work.
@ -518,7 +518,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
\item[delayl] Returns the delay after trigger left for the current frame.
\item[gatesl] Returns the number of gates left for the current frame.
\item[framesl] Returns the number of frames left for the current cycle.
\item[cyclesl] Returns the number of cycles left for the current acquisition.
\item[triggersl] Returns the number of triggers left for the current acquisition.
\item[now] Returns the current timestamp of the detector clock.
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
\end{description}

View File

@ -217,7 +217,7 @@ is used to configure the detector parameter var
\item[delay t] Sets the delay after trigger (in s)
\item[gates n] Sets the number of gates per frame
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
\item[probes n] Sets the number of probes to accumulate (max 3)
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
\item[flags mode] Sets the readout flags - can be none or storeinram
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
\item[delay] Gets the delay after trigger (in s)
\item[gates] Gets the number of gates per frame
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
\item[cycles] Gets the number of cycles (e.g. number of triggers)
\item[triggers] Gets the number of triggers (e.g. number of triggers)
\item[probes] Gets the number of probes to accumulate (max 3)
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
\item[dr] Gets the dynamic range

View File

@ -2,11 +2,10 @@
pybind11_add_module(_sls_detector
src/main.cpp
src/enums.cpp
src/experimental.cpp
src/detector.cpp
src/network.cpp
)
target_link_libraries(_sls_detector PUBLIC
slsDetectorShared
slsReceiverShared
@ -29,9 +28,9 @@ set( PYTHON_FILES
detector.py
eiger.py
errors.py
experimental.py
jungfrau_ctb.py
ctb.py
jungfrau.py
mythen3.py
registers.py
utils.py
@ -46,4 +45,7 @@ endforeach(FILE ${PYTHON_FILES})
configure_file( scripts/basic.py
${CMAKE_BINARY_DIR}/basic.py
)
configure_file( scripts/test_virtual.py
${CMAKE_BINARY_DIR}/test_virtual.py
)

View File

@ -2,11 +2,14 @@ import os
import sys
import numpy as np
sys.path.append(os.path.join(os.getcwd(), 'bin'))
from sls_detector import Eiger, Detector
from sls_detector import ExperimentalDetector
from _sls_detector.io import read_my302_file
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
from sls_detector import dacIndex
d = Detector()
e = ExperimentalDetector()
# e = Eiger()
# c = Ctb()
# j = Jungfrau()
m = Mythen3()

View File

@ -0,0 +1,25 @@
import subprocess
import locale
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
cmd = out.stdout.splitlines()
cmd.pop(0)
from sls_detector import Detector, Eiger, Ctb
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
'rxb_lb', 'vref_prech', 'vref_restore', 'vref_cds',
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
, 'vcmp_rl', 'vcmp_rr']
missing = []
for c in cmd:
if c not in pycmd:
print(c)
missing.append(c)
print(f'Missing: {len(missing)} commands')

View File

@ -0,0 +1,77 @@
"""
Code generator for enum bindings in the Python extension.
Reads the sls_detector_defs.h and enums_in.cpp then outputs
enums.cpp
"""
import re
import subprocess
# def remove_comments(text):
# def replacer(match):
# s = match.group(0)
# if s.startswith('/'):
# return " " # note: a space and not an empty string
# else:
# return s
# pattern = re.compile(
# r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
# re.DOTALL | re.MULTILINE
# )
# return re.sub(pattern, replacer, text)
def extract_enums(lines):
line_iter = iter(lines)
enums = {}
for line in line_iter:
m = re.search("(?<=enum )\w+(?= {)", line)
if m:
enum_name = m.group()
# print(enum_name)
fields = []
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
except:
pass
enums[enum_name] = fields
return enums
def generate_enum_string(enums):
data = []
for key, value in enums.items():
data.append(f'py::enum_<slsDetectorDefs::{key}>(Defs, "{key}")\n')
for v in value:
data.append(f'\t.value("{v}", slsDetectorDefs::{key}::{v})\n')
data.append('.export_values();\n\n')
return ''.join(data)
with open('../../slsSupportLib/include/sls_detector_defs.h') as f:
data = f.read()
data = remove_comments(data)
data = data.splitlines()
enums = extract_enums(data)
s = generate_enum_string(enums)
with open('../src/enums_in.cpp') as f:
data = f.read()
text = data.replace('[[ENUMS]]', s)
warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
with open('../src/enums.cpp', 'w') as f:
f.write(warning)
f.write(text)
# run clang format on the output
subprocess.run(['clang-format', '../src/enums.cpp', '-i'])

View File

@ -0,0 +1,84 @@
"""
This file is used to auto generate Python bindings for the
sls::Detector class. The tool needs the libclang bindings
to be installed.
When the Detector API is updated this file should be run
manually
"""
from clang import cindex
import subprocess
import argparse
from parse import system_include_paths
default_build_path = "/home/l_frojdh/sls/build/"
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--build_path", help="Path to the build database", type = str, default=default_build_path)
cargs = parser.parse_args()
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
index = cindex.Index.create()
args = db.getCompileCommands(fpath)
args = list(iter(args).__next__().arguments)[0:-1]
args = args + "-x c++ --std=c++11".split()
syspath = system_include_paths('clang++')
incargs = ["-I" + inc for inc in syspath]
args = args + incargs
tu = index.parse(fpath, args=args)
m = []
ag = []
lines = []
def get_arguments(node):
args = [a.type.spelling for a in node.get_arguments()]
args = [
"py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()"
for item in args
]
args = ', '.join(args)
if args:
args = f', {args}'
return args
def visit(node):
if node.kind == cindex.CursorKind.CLASS_DECL:
if node.displayname == "Detector":
for child in node.get_children():
if (
child.kind == cindex.CursorKind.CXX_METHOD
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
):
m.append(child)
args = get_arguments(child)
lines.append(f'.def(\"{child.spelling}\", &Detector::{child.spelling}{args})')
for child in node.get_children():
visit(child)
visit(tu.cursor)
with open('../src/detector_in.cpp') as f:
data = f.read()
s = ''.join(lines)
s += ';'
text = data.replace('[[FUNCTIONS]]', s)
warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
with open('../src/detector.cpp', 'w') as f:
f.write(warning)
f.write(text)
# run clang format on the output
subprocess.run(['clang-format', '../src/detector.cpp', '-i'])

View File

@ -0,0 +1,56 @@
import parse
from pathlib import Path
import os
import locale
import argparse
path = Path('../../slsDetectorSoftware/tests/')
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
args = parser.parse_args()
files = [f for f in os.listdir(path) if 'CmdProxy' in f]
tested = []
for fname in files:
with open(path/fname) as f:
data = f.read()
data = parse.remove_comments(data)
data = data.splitlines()
for line in data:
if 'TEST_CASE' in line or 'SECTION' in line:
cmd = line.split("\"")[1]
tested.append(cmd)
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
all_cmd = out.stdout.splitlines()
all_cmd.pop(0)
if args.startswith is not None:
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
tested = [cmd for cmd in tested if cmd in all_cmd]
print("\nThe following commands are tested:")
for cmd in tested:
print(cmd)
print("\nThe following commands are NOT tested:")
for cmd in not_tested:
print(cmd)
print(f"\nThe following {len(misnamed)} tests does not match commands and might be misnamed:")
for cmd in misnamed:
print(cmd)
print(f'\nTests cover {len(tested)} of {len(all_cmd)} commands')

56
python/scripts/parse.py Normal file
View File

@ -0,0 +1,56 @@
import re
import subprocess
from subprocess import PIPE
import os
def remove_comments(text):
def replacer(match):
s = match.group(0)
if s.startswith('/'):
return " " # note: a space and not an empty string
else:
return s
pattern = re.compile(
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE
)
return re.sub(pattern, replacer, text)
#based on ccsyspath: https://github.com/AndrewWalker/ccsyspath
def compiler_preprocessor_verbose(compiler, extraflags):
"""Capture the compiler preprocessor stage in verbose mode
"""
lines = []
with open(os.devnull, 'r', encoding='utf-8') as devnull:
cmd = [compiler, '-E']
cmd += extraflags
cmd += ['-', '-v']
p = subprocess.Popen(cmd, stdin=devnull, stdout=PIPE, stderr=PIPE)
p.wait()
lines = p.stderr.read()
lines = lines.splitlines()
return lines
def system_include_paths(compiler, cpp=True):
extraflags = []
if cpp:
extraflags = b'-x c++'.split()
lines = compiler_preprocessor_verbose(compiler, extraflags)
lines = [ line.strip() for line in lines ]
start = lines.index(b'#include <...> search starts here:')
end = lines.index(b'End of search list.')
lines = lines[start+1:end]
paths = []
for line in lines:
line = line.replace(b'(framework directory)', b'')
line = line.strip()
paths.append(line)
paths = [p.decode('utf-8') for p in paths]
return paths

View File

@ -0,0 +1,164 @@
import pytest
import subprocess
import os
import sys
import time
import datetime as dt
sys.path.append(os.path.join(os.getcwd(), "bin"))
from sls_detector import ExperimentalDetector, detectorSettings
n_detectors = 3
start_port = 1952
port_step = 3
@pytest.fixture(scope="module")
def virtual_jf_detectors(request):
"""
Fixture that is run once for the module
will launch virtual servers and clean up
after
"""
print("Setting up virtual detectors")
# Ensure that no detector servers are running
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
# Ensure no shared memory exists before tests start
d = ExperimentalDetector()
d.free()
# Start servers
virtual_jf_detectors = [
subprocess.Popen(
[
"bin/jungfrauDetectorServer_virtual",
"--port",
f"{start_port+port_step*i}",
]
)
for i in range(n_detectors)
]
# Allow server startup to complete
time.sleep(3)
def fin():
print("Cleaning up virtual detectors")
d = ExperimentalDetector()
d.free()
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
request.addfinalizer(fin)
return virtual_jf_detectors # provide the fixture value
def test_shmid(virtual_jf_detectors):
d = ExperimentalDetector()
assert d.getShmId() == 0
d.free()
d = ExperimentalDetector(73)
assert d.getShmId() == 73
d.free()
def test_hostname(virtual_jf_detectors):
d = ExperimentalDetector()
d.hostname = "localhost"
assert d.hostname == ["localhost"]
d.hostname = [f"localhost:{start_port+i*port_step}" for i in range(n_detectors)]
assert d.hostname == ["localhost"] * n_detectors
def test_fwversion(virtual_jf_detectors):
d = ExperimentalDetector()
assert d.detectorversion == 0 # Firmware of virtual detector
assert d.getFirmwareVersion() == [0] * n_detectors
def test_len(virtual_jf_detectors):
d = ExperimentalDetector()
assert len(d) == n_detectors
assert d.size() == n_detectors
def test_module_geometry(virtual_jf_detectors):
d = ExperimentalDetector()
geo = d.module_geometry
assert geo.x == 1
assert geo.y == 3
def test_module_size(virtual_jf_detectors):
d = ExperimentalDetector()
geo = d.module_size
assert geo.x == 1024
assert geo.y == 512
def test_settings(virtual_jf_detectors):
d = ExperimentalDetector()
assert d.settings == detectorSettings.DYNAMICGAIN
gain_list = [
detectorSettings.FIXGAIN1,
detectorSettings.FIXGAIN2,
detectorSettings.FORCESWITCHG1,
detectorSettings.FORCESWITCHG2,
detectorSettings.DYNAMICHG0,
detectorSettings.DYNAMICGAIN,
]
# Set all viable gain for Jungfrau to make sure nothing is crashing
for gain in gain_list:
d.settings = gain
assert d.settings == gain
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
assert d.settings == [
detectorSettings.DYNAMICGAIN,
detectorSettings.FORCESWITCHG1,
detectorSettings.DYNAMICGAIN,
]
d.settings = detectorSettings.DYNAMICGAIN
assert d.settings == detectorSettings.DYNAMICGAIN
def test_frames(virtual_jf_detectors):
d = ExperimentalDetector()
d.frames = 10
assert d.frames == 10
# def test_triggers(virtual_jf_detectors):
def test_exptime(virtual_jf_detectors):
d = ExperimentalDetector()
#default value
assert d.exptime == 1e-5
d.exptime = 1.5
assert d.exptime == 1.5
t = dt.timedelta(microseconds=10)
d.exptime = t
assert d.exptime == 10e-6
def test_period(virtual_jf_detectors):
d = ExperimentalDetector()
#default value
d.period = 0
assert d.period == 0
d.period = 1.5
assert d.period == 1.5
t = dt.timedelta(microseconds=10)
d.period = t
assert d.period == 10e-6

View File

@ -38,7 +38,8 @@ ext_modules = [
'_sls_detector',
['src/main.cpp',
'src/enums.cpp',
'src/experimental.cpp'],
'src/detector.cpp',
'src/network.cpp'],
include_dirs=[
# Path to pybind11 headers
get_pybind_include(),

View File

@ -1,9 +1,22 @@
from .detector import Detector, DetectorError, free_shared_memory
# from .detector import Detector, DetectorError, free_shared_memory
from .eiger import Eiger
from .experimental import ExperimentalDetector
from .ctb import Ctb
from .dacs import DetectorDacs, Dac
from .detector import Detector
from .jungfrau import Jungfrau
from .jungfrau_ctb import JungfrauCTB
from _sls_detector import DetectorApi
from .mythen3 import Mythen3
# from .jungfrau_ctb import JungfrauCTB
# from _sls_detector import DetectorApi
import _sls_detector
defs = _sls_detector.slsDetectorDefs
runStatus = _sls_detector.slsDetectorDefs.runStatus
speedLevel = _sls_detector.slsDetectorDefs.speedLevel
timingMode = _sls_detector.slsDetectorDefs.timingMode
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
detectorType = _sls_detector.slsDetectorDefs.detectorType
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
IpAddr = _sls_detector.IpAddr
MacAddr = _sls_detector.MacAddr

121
python/sls_detector/ctb.py Normal file
View File

@ -0,0 +1,121 @@
from .detector import Detector
from .utils import element_if_equal
from .dacs import DetectorDacs
import _sls_detector
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
class CtbDacs(DetectorDacs):
"""
Ctb dacs
"""
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
('dac1', dacIndex(1), 0, 4000, 1200),
('dac2', dacIndex(2), 0, 4000, 900),
('dac3', dacIndex(3), 0, 4000, 1050),
('dac4', dacIndex(4), 0, 4000, 1400),
('dac5', dacIndex(5), 0, 4000, 655),
('dac6', dacIndex(6), 0, 4000, 2000),
('dac7', dacIndex(7), 0, 4000, 1400),
('dac8', dacIndex(8), 0, 4000, 850),
('dac9', dacIndex(9), 0, 4000, 2000),
('dac10', dacIndex(10), 0, 4000, 2294),
('dac11', dacIndex(11), 0, 4000, 983),
('dac12', dacIndex(12), 0, 4000, 1475),
('dac13', dacIndex(13), 0, 4000, 1200),
('dac14', dacIndex(14), 0, 4000, 1600),
('dac15', dacIndex(15), 0, 4000, 1455),
('dac16', dacIndex(16), 0, 4000, 0),
('dac17', dacIndex(17), 0, 4000, 1000),
]
_dacnames = [_d[0] for _d in _dacs]
from .utils import element
class Ctb(Detector):
def __init__(self, id = 0):
super().__init__(id)
self._frozen = False
self._dacs = CtbDacs(self)
@property
def dacs(self):
return self._dacs
@property
@element
def v_a(self):
return self.getDAC(dacIndex.V_POWER_A, True)
@v_a.setter
def v_a(self, value):
self.setDAC(dacIndex.V_POWER_A, value, True)
@property
@element
def v_b(self):
return self.getDAC(dacIndex.V_POWER_B, True)
@v_b.setter
def v_b(self, value):
self.setDAC(dacIndex.V_POWER_B, value, True)
@property
@element
def v_c(self):
return self.getDAC(dacIndex.V_POWER_C, True)
@v_c.setter
def v_c(self, value):
self.setDAC(dacIndex.V_POWER_C, value, True)
@property
@element
def v_d(self):
return self.getDAC(dacIndex.V_POWER_D, True)
@v_d.setter
def v_d(self, value):
self.setDAC(dacIndex.V_POWER_D, value, True)
@property
@element
def v_io(self):
return self.getDAC(dacIndex.V_POWER_IO, True)
@v_io.setter
def v_io(self, value):
self.setDAC(dacIndex.V_POWER_IO, value, True)
@property
@element
def v_limit(self):
return self.getDAC(dacIndex.V_LIMIT, True)
@v_limit.setter
def v_limit(self, value):
self.setDAC(dacIndex.V_LIMIT, value, True)
@property
@element
def im_a(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_A)
@property
@element
def im_b(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_B)
@property
@element
def im_c(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_C)
@property
@element
def im_d(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_D)
@property
@element
def im_io(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)

View File

@ -1,7 +1,9 @@
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
import _sls_detector
from .detector import freeze
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
class Dac(DetectorProperty):
"""
This class represents a dac on the detector. One instance handles all
@ -14,11 +16,11 @@ class Dac(DetectorProperty):
"""
def __init__(self, name, low, high, default, detector):
def __init__(self, name, enum, low, high, default, detector):
super().__init__(partial(detector._api.getDac, name),
partial(detector._api.setDac, name),
detector._api.getNumberOfDetectors,
super().__init__(partial(detector.getDAC, enum, False),
lambda x, y : detector.setDAC(enum, x, False, y),
detector.size,
name)
self.min_value = low
@ -29,30 +31,16 @@ class Dac(DetectorProperty):
def __repr__(self):
"""String representation for a single dac in all modules"""
r_str = ['{:10s}: '.format(self.__name__)]
r_str += ['{:5d}, '.format(self.get(i)) for i in range(self.get_nmod())]
return ''.join(r_str).strip(', ')
dacstr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:10s}:{dacstr}'
# a = Dac('vrf', dacIndex.VRF, 0, 4000, 2500, d )
# @freeze
class DetectorDacs:
_dacs = [('vsvp', 0, 4000, 0),
('vtr', 0, 4000, 2500),
('vrf', 0, 4000, 3300),
('vrs', 0, 4000, 1400),
('vsvn', 0, 4000, 4000),
('vtgstv', 0, 4000, 2556),
('vcmp_ll', 0, 4000, 1500),
('vcmp_lr', 0, 4000, 1500),
('vcall', 0, 4000, 4000),
('vcmp_rl', 0, 4000, 1500),
('rxb_rb', 0, 4000, 1100),
('rxb_lb', 0, 4000, 1100),
('vcmp_rr', 0, 4000, 1500),
('vcp', 0, 4000, 200),
('vcn', 0, 4000, 2000),
('vis', 0, 4000, 1550),
('iodelay', 0, 4000, 660)]
_dacs = []
_dacnames = [_d[0] for _d in _dacs]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
@ -65,6 +53,8 @@ class DetectorDacs:
for _d in self._dacs:
setattr(self, '_'+_d[0], Dac(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@ -73,8 +63,11 @@ class DetectorDacs:
if name in self._dacnames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'Dac not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._dacs):
self._current = 0
@ -95,7 +88,7 @@ class DetectorDacs:
"""
Read the dacs into a numpy array with dimensions [ndacs, nmodules]
"""
dac_array = np.zeros((len(self._dacs), self._detector.n_modules))
dac_array = np.zeros((len(self._dacs), len(self._detector)))
for i, _d in enumerate(self):
dac_array[i,:] = _d[:]
return dac_array
@ -115,11 +108,3 @@ class DetectorDacs:
for _d in self:
_d[:] = _d.default
def update_nmod(self):
"""
Update the cached value of nmod, needs to be run after adding or
removing detectors
"""
for _d in self:
_d._n_modules = self._detector.n_modules

File diff suppressed because it is too large Load Diff

View File

@ -14,21 +14,20 @@ class DetectorProperty:
def __getitem__(self, key):
if key == slice(None, None, None):
return [self.get(i) for i in range(self.get_nmod())]
return self.get()
elif isinstance(key, Iterable):
return [self.get(k) for k in key]
return self.get(list(key))
else:
return self.get(key)
return self.get([key])[0] #No list for single value
def __setitem__(self, key, value):
#operate on all values
if key == slice(None, None, None):
if isinstance(value, (np.integer, int)):
for i in range(self.get_nmod()):
self.set(i, value)
self.set(value, [])
elif isinstance(value, Iterable):
for i in range(self.get_nmod()):
self.set(i, value[i])
self.set(value[i], [i])
else:
raise ValueError('Value should be int or np.integer not', type(value))
@ -36,15 +35,14 @@ class DetectorProperty:
elif isinstance(key, Iterable):
if isinstance(value, Iterable):
for k,v in zip(key, value):
self.set(k,v)
self.set(v, [k])
elif isinstance(value, int):
for k in key:
self.set(k, value)
self.set(value, list(key))
#Set single value
elif isinstance(key, int):
self.set(key, value)
self.set(value, [key])
def __repr__(self):
s = ', '.join(str(v) for v in self[:])

View File

@ -6,17 +6,16 @@ Created on Wed Dec 6 11:51:18 2017
@author: l_frojdh
"""
import socket
from collections.abc import Iterable
from collections import namedtuple
from functools import partial
from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
from .detector import Detector
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _sls_detector
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
from .utils import element_if_equal
from sls_detector.errors import DetectorValueError, DetectorError
# from .utils import element_if_equal
# from sls_detector.errors import DetectorValueError, DetectorError
class EigerVcmp:
"""
@ -30,20 +29,20 @@ class EigerVcmp:
"""
def __init__(self, detector):
_names = ['vcmp_ll',
'vcmp_lr',
'vcmp_rl',
'vcmp_rr']
_dacs = [ dacIndex.VCMP_LL,
dacIndex.VCMP_LR,
dacIndex.VCMP_RL,
dacIndex.VCMP_RR]
self.set = []
self.get = []
for i in range(detector.n_modules):
for i in range(detector.size()):
if i % 2 == 0:
name = _names
dacs = _dacs
else:
name = _names[::-1]
for n in name:
self.set.append(partial(detector._api.setDac, n, i))
self.get.append(partial(detector._api.getDac, n, i))
dacs = _dacs[::-1]
for d in dacs:
self.set.append(lambda x, d=d, i=i : detector.setDAC(d, x, False, [i]))
self.get.append(lambda d=d, i=i : detector.getDAC(d, False, [i])[0])
def __getitem__(self, key):
if key == slice(None, None, None):
@ -58,80 +57,84 @@ class EigerVcmp:
class EigerDacs(DetectorDacs):
_dacs = [('vsvp', 0, 4000, 0),
('vtr', 0, 4000, 2500),
('vrf', 0, 4000, 3300),
('vrs', 0, 4000, 1400),
('vsvn', 0, 4000, 4000),
('vtgstv', 0, 4000, 2556),
('vcmp_ll', 0, 4000, 1500),
('vcmp_lr', 0, 4000, 1500),
('vcall', 0, 4000, 4000),
('vcmp_rl', 0, 4000, 1500),
('rxb_rb', 0, 4000, 1100),
('rxb_lb', 0, 4000, 1100),
('vcmp_rr', 0, 4000, 1500),
('vcp', 0, 4000, 200),
('vcn', 0, 4000, 2000),
('vis', 0, 4000, 1550),
('iodelay', 0, 4000, 660)]
"""
Eiger specific dacs
"""
_dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
('vtr', dacIndex.VTR,0, 4000, 2500),
('vrf', dacIndex.VRF,0, 4000, 3300),
('vrs', dacIndex.VRS,0, 4000, 1400),
('vsvn', dacIndex.SVN,0, 4000, 4000),
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
('vcall', dacIndex.CAL,0, 4000, 4000),
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
('vcp', dacIndex.VCP,0, 4000, 200),
('vcn', dacIndex.VCN,0, 4000, 2000),
('vis', dacIndex.VIS,0, 4000, 1550),
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_dacnames = [_d[0] for _d in _dacs]
# # noinspection PyProtectedMember
# class DetectorDelays:
# _delaynames = ['frame', 'left', 'right']
# noinspection PyProtectedMember
class DetectorDelays:
_delaynames = ['frame', 'left', 'right']
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# def __init__(self, detector):
# # We need to at least initially know which detector we are connected to
# self._detector = detector
setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
detector._api.setDelayFrame,
detector._api.getNumberOfDetectors,
'frame'))
# setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
# detector._api.setDelayFrame,
# detector._api.getNumberOfDetectors,
# 'frame'))
setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
detector._api.setDelayLeft,
detector._api.getNumberOfDetectors,
'left'))
# setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
# detector._api.setDelayLeft,
# detector._api.getNumberOfDetectors,
# 'left'))
setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
detector._api.setDelayRight,
detector._api.getNumberOfDetectors,
'right'))
# Index to support iteration
self._current = 0
# setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
# detector._api.setDelayRight,
# detector._api.getNumberOfDetectors,
# 'right'))
# # Index to support iteration
# self._current = 0
def __getattr__(self, name):
return self.__getattribute__('_' + name)
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if name in self._delaynames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
else:
super().__setattr__(name, value)
# def __setattr__(self, name, value):
# if name in self._delaynames:
# return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
# else:
# super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._delaynames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._delaynames[self._current-1])
# def __next__(self):
# if self._current >= len(self._delaynames):
# self._current = 0
# raise StopIteration
# else:
# self._current += 1
# return self.__getattr__(self._delaynames[self._current-1])
def __iter__(self):
return self
# def __iter__(self):
# return self
def __repr__(self):
hn = self._detector.hostname
r_str = ['Transmission delay [ns]\n'
'{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
for i in range(self._detector.n_modules):
r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
return '\n'.join(r_str)
# def __repr__(self):
# hn = self._detector.hostname
# r_str = ['Transmission delay [ns]\n'
# '{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
# for i in range(self._detector.n_modules):
# r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
# return '\n'.join(r_str)
from .detector import freeze
@freeze
class Eiger(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
@ -145,79 +148,80 @@ class Eiger(Detector):
def __init__(self, id=0):
super().__init__(id)
self._active = DetectorProperty(self._api.getActive,
self._api.setActive,
self._api.getNumberOfDetectors,
'active')
self._vcmp = EigerVcmp(self)
self._frozen = False
self._dacs = EigerDacs(self)
self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
self._delay = DetectorDelays(self)
# Eiger specific adcs
self._temp = DetectorAdcs()
self._temp.fpga = Adc('temp_fpga', self)
self._temp.fpgaext = Adc('temp_fpgaext', self)
self._temp.t10ge = Adc('temp_10ge', self)
self._temp.dcdc = Adc('temp_dcdc', self)
self._temp.sodl = Adc('temp_sodl', self)
self._temp.sodr = Adc('temp_sodr', self)
self._temp.fpgafl = Adc('temp_fpgafl', self)
self._temp.fpgafr = Adc('temp_fpgafr', self)
self._vcmp = EigerVcmp(self)
@property
def active(self):
"""
Is the detector active? Can be used to enable or disable a detector
module
# self._active = DetectorProperty(self.getActive,
# self.setActive,
# self.size,
# 'active')
# self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
# self._delay = DetectorDelays(self)
Examples
----------
# # Eiger specific adcs
# self._temp = DetectorAdcs()
# self._temp.fpga = Adc('temp_fpga', self)
# self._temp.fpgaext = Adc('temp_fpgaext', self)
# self._temp.t10ge = Adc('temp_10ge', self)
# self._temp.dcdc = Adc('temp_dcdc', self)
# self._temp.sodl = Adc('temp_sodl', self)
# self._temp.sodr = Adc('temp_sodr', self)
# self._temp.fpgafl = Adc('temp_fpgafl', self)
# self._temp.fpgafr = Adc('temp_fpgafr', self)
# @property
# def active(self):
# """
# Is the detector active? Can be used to enable or disable a detector
# module
::
# Examples
# ----------
# ::
d.active
>> active: [True, True]
# d.active
# >> active: [True, True]
d.active[1] = False
>> active: [True, False]
"""
return self._active
# d.active[1] = False
# >> active: [True, False]
# """
# return self._active
@active.setter
def active(self, value):
self._active[:] = value
# @active.setter
# def active(self, value):
# self._active[:] = value
@property
def measured_period(self):
return self._api.getMeasuredPeriod()
# @property
# def measured_period(self):
# return self._api.getMeasuredPeriod()
@property
def measured_subperiod(self):
return self._api.getMeasuredSubPeriod()
# @property
# def measured_subperiod(self):
# return self._api.getMeasuredSubPeriod()
@property
def add_gappixels(self):
"""Enable or disable the (virual) pixels between ASICs
# @property
# def add_gappixels(self):
# """Enable or disable the (virual) pixels between ASICs
Examples
----------
# Examples
# ----------
::
# ::
d.add_gappixels = True
# d.add_gappixels = True
d.add_gappixels
>> True
# d.add_gappixels
# >> True
"""
return self._api.getGapPixels()
# """
# return self._api.getGapPixels()
@add_gappixels.setter
def add_gappixels(self, value):
self._api.setGapPixels(value)
# @add_gappixels.setter
# def add_gappixels(self, value):
# self._api.setGapPixels(value)
@property
def dacs(self):
@ -280,114 +284,68 @@ class Eiger(Detector):
"""
return self._dacs
@property
def tx_delay(self):
"""
Transmission delay of the modules to allow running the detector
in a network not supporting the full speed of the detector.
# @property
# def tx_delay(self):
# """
# Transmission delay of the modules to allow running the detector
# in a network not supporting the full speed of the detector.
::
# ::
d.tx_delay
>>
Transmission delay [ns]
left right frame
0:beb048 0 15000 0
1:beb049 100 190000 100
# d.tx_delay
# >>
# Transmission delay [ns]
# left right frame
# 0:beb048 0 15000 0
# 1:beb049 100 190000 100
d.tx_delay.left = [2000,5000]
"""
return self._delay
# d.tx_delay.left = [2000,5000]
# """
# return self._delay
def default_settings(self):
"""
reset the detector to some type of standard settings
mostly used when testing
"""
self.n_frames = 1
self.exposure_time = 1
self.period = 0
self.n_cycles = 1
self.n_measurements = 1
self.dynamic_range = 16
@property
def eiger_matrix_reset(self):
"""
Matrix reset bit for Eiger.
:py:obj:`True` : Normal operation, the matrix is reset before each acq.
:py:obj:`False` : Matrix reset disabled. Used to not reset before
reading out analog test pulses.
"""
return self._api.getCounterBit()
@eiger_matrix_reset.setter
def eiger_matrix_reset(self, value):
self._api.setCounterBit(value)
@property
def flowcontrol_10g(self):
"""
:py:obj:`True` - Flow control enabled :py:obj:`False` flow control disabled.
Sets for all moduels, if for some reason access to a single module is needed
this can be done trough the C++ API.
"""
fc = self._api.getNetworkParameter('flow_control_10g')
return element_if_equal([bool(int(e)) for e in fc])
@flowcontrol_10g.setter
def flowcontrol_10g(self, value):
if value is True:
v = '1'
else:
v = '0'
self._api.setNetworkParameter('flow_control_10g', v, -1)
def pulse_all_pixels(self, n):
"""
Pulse each pixel of the chip **n** times using the analog test pulses.
The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
the highest pulse.
# def pulse_all_pixels(self, n):
# """
# Pulse each pixel of the chip **n** times using the analog test pulses.
# The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
# the highest pulse.
::
# ::
#Pulse all pixels ten times
d.pulse_all_pixels(10)
# #Pulse all pixels ten times
# d.pulse_all_pixels(10)
#Avoid resetting before acq
d.eiger_matrix_reset = False
# #Avoid resetting before acq
# d.eiger_matrix_reset = False
d.acq() #take frame
# d.acq() #take frame
#Restore normal behaviour
d.eiger_matrix_reset = True
# #Restore normal behaviour
# d.eiger_matrix_reset = True
"""
self._api.pulseAllPixels(n)
# """
# self._api.pulseAllPixels(n)
def pulse_diagonal(self, n):
"""
Pulse pixels in super colums in a diagonal fashion. Used for calibration
of vcall. Saves time compared to pulsing all pixels.
"""
self._api.pulseDiagonal(n)
# def pulse_diagonal(self, n):
# """
# Pulse pixels in super colums in a diagonal fashion. Used for calibration
# of vcall. Saves time compared to pulsing all pixels.
# """
# self._api.pulseDiagonal(n)
def pulse_chip(self, n):
"""
Advance the counter by toggling enable. Gives 2*n+2 int the counter
# def pulse_chip(self, n):
# """
# Advance the counter by toggling enable. Gives 2*n+2 int the counter
"""
n = int(n)
if n >= -1:
self._api.pulseChip(n)
else:
raise ValueError('n must be equal or larger than -1')
# """
# n = int(n)
# if n >= -1:
# self._api.pulseChip(n)
# else:
# raise ValueError('n must be equal or larger than -1')
@property
def vcmp(self):
@ -420,177 +378,99 @@ class Eiger(Detector):
else:
raise ValueError('vcmp only compatible with setting all')
@property
def rx_udpport(self):
"""
UDP port for the receiver. Each module has two ports referred to
as rx_udpport and rx_udpport2 in the command line interface
here they are grouped for each detector
# @property
# def rx_udpport(self):
# """
# UDP port for the receiver. Each module has two ports referred to
# as rx_udpport and rx_udpport2 in the command line interface
# here they are grouped for each detector
::
# ::
[0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
# [0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
Examples
-----------
# Examples
# -----------
::
# ::
d.rx_udpport
>> [50010, 50011, 50004, 50005]
# d.rx_udpport
# >> [50010, 50011, 50004, 50005]
d.rx_udpport = [50010, 50011, 50012, 50013]
# d.rx_udpport = [50010, 50011, 50012, 50013]
"""
p0 = self._api.getReceiverUDPPort()
p1 = self._api.getReceiverUDPPort2()
return [int(val) for pair in zip(p0, p1) for val in pair]
# """
# p0 = self._api.getReceiverUDPPort()
# p1 = self._api.getReceiverUDPPort2()
# return [int(val) for pair in zip(p0, p1) for val in pair]
@rx_udpport.setter
def rx_udpport(self, ports):
"""Requires iterating over elements two and two for setting ports"""
a = iter(ports)
for i, p in enumerate(zip(a, a)):
self._api.setReceiverUDPPort(p[0], i)
self._api.setReceiverUDPPort2(p[1], i)
# @rx_udpport.setter
# def rx_udpport(self, ports):
# """Requires iterating over elements two and two for setting ports"""
# a = iter(ports)
# for i, p in enumerate(zip(a, a)):
# self._api.setReceiverUDPPort(p[0], i)
# self._api.setReceiverUDPPort2(p[1], i)
@property
def rx_zmqport(self):
"""
Return the receiver zmq ports. Note that Eiger has two ports per receiver!
This functions therefore differ from the base class.
::
detector.rx_zmqport
e.rx_zmqport
>> [30001, 30002, 30003, 30004]
"""
_s = self._api.getReceiverStreamingPort()
if _s == '':
return []
else:
return [int(_p) + i for _p in _s for i in range(2)]
@rx_zmqport.setter
def rx_zmqport(self, port):
if isinstance(port, Iterable):
for i, p in enumerate(port):
self._api.setReceiverStreamingPort(p, i)
else:
self._api.setReceiverStreamingPort(port, -1)
ports = self.getRxZmqPort()
return [p + i for p in ports for i in range(2)]
@property
def sub_exposure_time(self):
"""
Sub frame exposure time in *seconds* for Eiger in 32bit autosumming mode
# @rx_zmqport.setter
# def rx_zmqport(self, port):
# if isinstance(port, Iterable):
# for i, p in enumerate(port):
# self._api.setReceiverStreamingPort(p, i)
# else:
# self._api.setReceiverStreamingPort(port, -1)
::
# @property
# def temp(self):
# """
# An instance of DetectorAdcs used to read the temperature
# of different components
d.sub_exposure_time
>> 0.0023
# Examples
# -----------
d.sub_exposure_time = 0.002
# ::
"""
return self._api.getSubExposureTime() / 1e9
# detector.temp
# >>
# temp_fpga : 36.90°C, 45.60°C
# temp_fpgaext : 31.50°C, 32.50°C
# temp_10ge : 0.00°C, 0.00°C
# temp_dcdc : 36.00°C, 36.00°C
# temp_sodl : 33.00°C, 34.50°C
# temp_sodr : 33.50°C, 34.00°C
# temp_fpgafl : 33.81°C, 30.93°C
# temp_fpgafr : 27.88°C, 29.15°C
@sub_exposure_time.setter
def sub_exposure_time(self, t):
#TODO! checking here or in the detector?
ns_time = int(t * 1e9)
if ns_time > 0:
self._api.setSubExposureTime(ns_time)
else:
raise DetectorValueError('Sub exposure time must be larger than 0')
@property
def sub_deadtime(self):
"""
Deadtime between subexposures. Used to mimize noise by delaying the start of the next
subexposure.
"""
return self._api.getSubExposureDeadTime() / 1e9
@sub_deadtime.setter
def sub_deadtime(self, t):
ns_time = int(t * 1e9)
if ns_time >= 0:
self._api.setSubExposureDeadTime(ns_time)
else:
raise ValueError('Sub deadtime time must be larger or equal to 0')
@property
def temp(self):
"""
An instance of DetectorAdcs used to read the temperature
of different components
Examples
-----------
::
detector.temp
>>
temp_fpga : 36.90°C, 45.60°C
temp_fpgaext : 31.50°C, 32.50°C
temp_10ge : 0.00°C, 0.00°C
temp_dcdc : 36.00°C, 36.00°C
temp_sodl : 33.00°C, 34.50°C
temp_sodr : 33.50°C, 34.00°C
temp_fpgafl : 33.81°C, 30.93°C
temp_fpgafr : 27.88°C, 29.15°C
a = detector.temp.fpga[:]
a
>> [36.568, 45.542]
# a = detector.temp.fpga[:]
# a
# >> [36.568, 45.542]
"""
return self._temp
@property
def tengiga(self):
"""Enable 10Gbit/s data output
Examples
----------
::
d.tengiga
>> False
d.tengiga = True
"""
return self._api.getTenGigabitEthernet()
@tengiga.setter
def tengiga(self, value):
self._api.setTenGigabitEthernet(value)
def set_delays(self, delta):
self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
# """
# return self._temp
# def set_delays(self, delta):
# self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
# self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
def setup500k(self, hostnames):
"""
Setup the Eiger detector to run on the local machine
"""
self.hostname = hostnames
self.file_write = False
self.image_size = (512, 1024)
self.rx_tcpport = [1954, 1955]
self.rx_udpport = [50010, 50011, 50004, 50005]
self.rx_hostname = socket.gethostname().split('.')[0]
self.rx_datastream = False
self.file_write = False
self.online = True
self.receiver_online = True

View File

@ -1,180 +0,0 @@
from _sls_detector import multiDetectorApi
from _sls_detector import slsDetectorDefs
runStatus = slsDetectorDefs.runStatus
from .utils import element_if_equal, all_equal
import datetime as dt
from functools import wraps
def freeze(cls):
cls.__frozen = False
def frozensetattr(self, key, value):
if self.__frozen and not hasattr(self, key):
raise AttributeError(
"Class {} is frozen. Cannot set {} = {}".format(
cls.__name__, key, value
)
)
else:
object.__setattr__(self, key, value)
def init_decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
func(self, *args, **kwargs)
self.__frozen = True
return wrapper
cls.__setattr__ = frozensetattr
cls.__init__ = init_decorator(cls.__init__)
return cls
@freeze
class ExperimentalDetector(multiDetectorApi):
"""
This class is the base for detector specific
interfaces. Most functions exists in two versions
like the getExptime() function that uses the
C++ API directly and the simplified exptime property.
"""
def __init__(self, multi_id = 0):
"""
multi_id refers to the shared memory id of the
slsDetectorPackage. Default value is 0.
"""
super().__init__(multi_id)
# Acq
@property
def rx_status(self):
"""
Read the status of the receiver
"""
return element_if_equal(self.getReceiverStatus())
@rx_status.setter
def rx_status(self, status_str):
if status_str == "start":
self.startReceiver()
elif status_str == "stop":
self.stopReceiver()
else:
raise NotImplementedError("Unknown argument to rx_status")
@property
def busy(self):
"""
Checks if the detector is acquiring. Can also be set but should only be used if the acquire fails and
leaves the detector with busy == True
.. note ::
Only works when the measurement is launched using acquire, not with status start!
Returns
--------
bool
:py:obj:`True` if the detector is acquiring otherwise :py:obj:`False`
Examples
----------
::
d.busy
>> True
#If the detector is stuck reset by:
d.busy = False
"""
return self.getAcquiringFlag()
@busy.setter
def busy(self, value):
self.setAcquiringFlag(value)
# Configuration
@property
def startingfnum(self):
return element_if_equal(self.getStartingFrameNumber())
@startingfnum.setter
def startingfnum(self, value):
self.setStartingFrameNumber(value)
@property
def config(self):
return NotImplementedError("config is set only")
@config.setter
def config(self, fname):
self.setConfig(fname)
# File
@property
def fname(self):
return element_if_equal(self.getFileName())
@fname.setter
def fname(self, file_name):
self.setFileName(file_name)
@property
def fpath(self):
return element_if_equal(self.getFilePath())
@fpath.setter
def fpath(self, path):
self.setFilePath(path)
@property
def fwrite(self):
return element_if_equal(self.getFileWrite())
@fwrite.setter
def fwrite(self, value):
self.setFileWrite(value)
@property
def foverwrite(self):
return element_if_equal(self.getFileOverWrite())
@foverwrite.setter
def foverwrite(self, value):
self.setFileOverWrite(value)
# Time
@property
def exptime(self):
res = self.getExptime()
return element_if_equal([it.total_seconds() for it in res])
@exptime.setter
def exptime(self, t):
self.setExptime(dt.timedelta(seconds=t))
@property
def subexptime(self):
res = self.getSubExptime()
return element_if_equal([it.total_seconds() for it in res])
@subexptime.setter
def subexptime(self, t):
self.setSubExptime(dt.timedelta(seconds=t))
@property
def period(self):
res = self.getPeriod()
return element_if_equal([it.total_seconds() for it in res])
@period.setter
def period(self, t):
self.setPeriod(dt.timedelta(seconds=t))

275
python/sls_detector/jungfrau.py Executable file → Normal file
View File

@ -1,259 +1,54 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Jungfrau detector class and support functions.
Inherits from Detector.
This file contains the specialization for the Jungfrau detector
"""
from .adcs import Adc, DetectorAdcs
from .detector import Detector
from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
from .utils import element_if_equal
import _sls_detector
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# @freeze
class JungfrauDacs(DetectorDacs):
_dacs = [('vb_comp', 0, 4000, 1220),
('vdd_prot', 0, 4000, 3000),
('vin_com', 0, 4000, 1053),
('vref_prech', 0, 4000, 1450),
('vb_pixbuff', 0, 4000, 750),
('vb_ds', 0, 4000, 1000),
('vref_ds', 0, 4000, 480),
('vref_comp', 0, 4000, 420),
"""
Jungfrau specific DACs
"""
_dacs = [('vb_comp', dacIndex.VB_COMP, 0, 4000, 1220),
('vdd_prot', dacIndex.VDD_PROT, 0, 4000, 3000),
('vin_com', dacIndex.VIN_COM, 0, 4000, 1053),
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 1450),
('vb_pixbuff', dacIndex.VB_PIXBUF, 0, 4000, 750),
('vb_ds', dacIndex.VB_DS, 0, 4000, 1000),
('vref_ds', dacIndex.VREF_DS, 0, 4000, 480),
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 420),
]
_dacnames = [_d[0] for _d in _dacs]
@freeze
class Jungfrau(Detector):
"""
Class used to control a Jungfrau detector. Inherits from the Detector class but a specialized
class is needed to provide the correct dacs and unique functions.
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [4, 8, 16, 32]
_settings = ['dynamichg0',
'dynamicgain',
'fixgain1',
'fixgain2',
'forceswitchg1',
'forceswitchg2']
"""Available settings for Jungfrau"""
def __init__(self, multi_id=0):
#Init on base calss
super().__init__(multi_id)
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = JungfrauDacs(self)
#Jungfrau specific temps, this can be reduced to a single value?
self._temp = DetectorAdcs()
self._temp.fpga = Adc('temp_fpga', self)
# self._register = Register(self)
@property
def dacs(self):
"""
An instance of DetectorDacs used for accessing the dacs of a single
or multi detector.
Examples
---------
::
#Jungfrau
"""
return self._dacs
@property
def power_chip(self):
"""Power on or off the ASICs, True for on False for off"""
return self._api.isChipPowered()
@power_chip.setter
def power_chip(self, value):
self._api.powerChip(value)
@property
def delay(self):
"""Delay after trigger [s]"""
return self._api.getDelay()/1e9
@delay.setter
def delay(self, t):
ns_time = int(t * 1e9)
self._api.setDelay(ns_time)
@property
def n_gates(self):
return self._api.getNumberOfGates()
@n_gates.setter
def n_gates(self, n):
self._api.setNumberOfGates(n)
@property
def n_probes(self):
return self._api.getNumberOfProbes()
@n_probes.setter
def n_probes(self, n):
self._api.setNumberOfProbes(n)
@property
def storagecell_start(self):
"""
First storage cell
"""
return self._api.getStoragecellStart()
@storagecell_start.setter
def storagecell_start(self, value):
self._api.setStoragecellStart(value)
@property
def n_storagecells(self):
"""
number of storage cells used for the measurements
"""
return self._api.getNumberOfStorageCells()
@n_storagecells.setter
def n_storagecells(self, value):
self._api.setNumberOfStorageCells(value)
@property
def temp(self):
"""
An instance of DetectorAdcs used to read the temperature
of different components
Examples
-----------
::
detector.temp
>>
temp_fpga : 36.90°C, 45.60°C
a = detector.temp.fpga[:]
a
>> [36.568, 45.542]
"""
return self._temp
@property
def temperature_threshold(self):
"""Threshold for switching of chips"""
return self._api.getThresholdTemperature()
@temperature_threshold.setter
def temperature_threshold(self, t):
self._api.setThresholdTemperature(t)
@property
def temperature_control(self):
"""
Monitor the temperature of the detector and switch off chips if temperature_threshold is
crossed
Examples
---------
::
#activate
detector.temperature_control = True
#deactivate
detector.temperature_control = False
"""
return self._api.getTemperatureControl()
@temperature_control.setter
def temperature_control(self, v):
self._api.setTemperatureControl(v)
@property
def temperature_event(self):
"""Have the temperature threshold been crossed?
Returns
---------
:py:obj:`True` if the threshold have been crossed and temperature_control is active
otherwise :py:obj:`False`
"""
return self._api.getTemperatureEvent()
def reset_temperature_event(self):
"""Reset the temperature_event. After reset temperature_event is False"""
self._api.resetTemperatureEvent()
@property
def rx_udpport(self):
"""
UDP port for the receiver. Each module have one port.
Note! Eiger has two ports
::
[0:rx_udpport]
Examples
-----------
::
d.rx_udpport
>> [50010]
d.rx_udpport = [50010]
"""
return self._api.getNetworkParameter('rx_udpport')
@rx_udpport.setter
def rx_udpport(self, ports):
"""Requires iterating over elements two and two for setting ports"""
for i, p in enumerate(ports):
self._api.setNetworkParameter('rx_udpport', str(p), i)
@property
def detector_mac(self):
s = self._api.getNetworkParameter('detectormac')
return element_if_equal(s)
@detector_mac.setter
def detector_mac(self, mac):
if isinstance(mac, list):
for i, m in enumerate(mac):
self._api.setNetworkParameter('detectormac', m, i)
else:
self._api.setNetworkParameter('detectormac', mac, -1)
@property
def detector_ip(self):
s = self._api.getNetworkParameter('detectorip')
return element_if_equal(s)
@detector_ip.setter
def detector_ip(self, ip):
if isinstance(ip, list):
for i, addr in enumerate(ip):
self._api.setNetworkParameter('detectorip', addr, i)
else:
self._api.setNetworkParameter('detectorip', ip, -1)
return self._dacs

View File

@ -1,178 +0,0 @@
from functools import partial
from collections.abc import Iterable
from collections import namedtuple
import socket
from .detector import Detector
from .utils import element_if_equal
from .adcs import DetectorAdcs, Adc
from .dacs import DetectorDacs
from .detector_property import DetectorProperty
from .registers import Register, Adc_register
class JungfrauCTBDacs(DetectorDacs):
_dacs = [('dac0', 0, 4000, 1400),
('dac1', 0, 4000, 1200),
('dac2', 0, 4000, 900),
('dac3', 0, 4000, 1050),
('dac4', 0, 4000, 1400),
('dac5', 0, 4000, 655),
('dac6', 0, 4000, 2000),
('dac7', 0, 4000, 1400),
('dac8', 0, 4000, 850),
('dac9', 0, 4000, 2000),
('dac10', 0, 4000, 2294),
('dac11', 0, 4000, 983),
('dac12', 0, 4000, 1475),
('dac13', 0, 4000, 1200),
('dac14', 0, 4000, 1600),
('dac15', 0, 4000, 1455),
('dac16', 0, 4000, 0),
('dac17', 0, 4000, 1000),
]
_dacnames = [_d[0] for _d in _dacs]
class JungfrauCTB(Detector):
def __init__(self, id = 0):
super().__init__(id)
self._dacs = JungfrauCTBDacs(self)
self._register = Register(self)
self._adc_register = Adc_register(self)
@property
def v_a(self):
return self._api.getDac_mV('v_a', -1)
@v_a.setter
def v_a(self, value):
self._api.setDac_mV('v_a', -1, value)
@property
def v_b(self):
return self._api.getDac_mV('v_b', -1)
@v_b.setter
def v_b(self, value):
self._api.setDac_mV('v_b', -1, value)
@property
def v_c(self):
return self._api.getDac_mV('v_c', -1)
@v_c.setter
def v_c(self, value):
self._api.setDac_mV('v_c', -1, value)
@property
def v_d(self):
return self._api.getDac_mV('v_d', -1)
@v_d.setter
def v_d(self, value):
self._api.setDac_mV('v_d', -1, value)
@property
def v_io(self):
return self._api.getDac_mV('v_io', -1)
@v_io.setter
def v_io(self, value):
self._api.setDac_mV('v_io', -1, value)
@property
def v_limit(self):
return self._api.getDac_mV('v_limit', -1)
@v_limit.setter
def v_limit(self, value):
self._api.setDac_mV('v_limit', -1, value)
@property
def adc_register(self):
return self._adc_register
# @property
# def register(self):
# return self._register
def adcOFF(self):
"""Switch off the ADC"""
self.adc_register[0x8] = 1
@property
def dacs(self):
"""
An instance of DetectorDacs used for accessing the dacs of a single
or multi detector.
Examples
---------
::
#JungfrauCTB
"""
return self._dacs
@property
def dbitpipeline(self):
return self._api.getDbitPipeline()
@dbitpipeline.setter
def dbitpipeline(self, value):
self._api.setDbitPipeline(value)
@property
def dbitphase(self):
return self._api.getDbitPhase()
@dbitphase.setter
def dbitphase(self, value):
self._api.setDbitPhase(value)
@property
def dbitclock(self):
return self._api.getDbitClock()
@dbitclock.setter
def dbitclock(self, value):
self._api.setDbitClock(value)
@property
def samples(self):
return self._api.getJCTBSamples()
@samples.setter
def samples(self, value):
self._api.setJCTBSamples(value)
@property
def readout_clock(self):
"""
Speed of the readout clock relative to the full speed
Examples
---------
::
"""
return self._api.getReadoutClockSpeed()
@readout_clock.setter
def readout_clock(self, value):
self._api.setReadoutClockSpeed(value)

View File

@ -0,0 +1,80 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains the specialization for the Jungfrau detector
"""
from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _sls_detector
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# vcassh 1200,
# vth2 2800,
# vshaper 1280,
# vshaperneg 2800,
# vipre_out 1220,
# vth3 2800,
# vth1 2800,
# vicin 1708,
# vcas 1800,
# vpreamp 1100,
# vpl 1100,
# vipre 2624,
# viinsh 1708,
# vph 1712,
# vtrim 2800,
# vdcsh 800
# @freeze
class Mythen3Dacs(DetectorDacs):
"""
Jungfrau specific DACs
"""
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
('vth2', dacIndex.VTH2, 0, 4000, 2800),
('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
('vth3', dacIndex.VTH3, 0, 4000, 2800),
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
('vicin', dacIndex.VICIN, 0, 4000, 1708),
('vcas', dacIndex.CAS, 0, 4000, 1800),
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
('vpl', dacIndex.VPL, 0, 4000, 1100),
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
]
_dacnames = [_d[0] for _d in _dacs]
@freeze
class Mythen3(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [4, 8, 16, 32]
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = Mythen3Dacs(self)
@property
def dacs(self):
return self._dacs

View File

@ -3,14 +3,17 @@ class Register:
self._detector = detector
def __getitem__(self, key):
return self._detector._api.readRegister(key)
return self._detector.readRegister(key)
def __setitem__(self, key, value):
self._detector._api.writeRegister(key, value)
self._detector.writeRegister(key, value)
class Adc_register:
def __init__(self, detector):
self._detector = detector
def __setitem__(self, key, value):
self._detector._api.writeAdcRegister(key, value)
self._detector.writeAdcRegister(key, value)
def __getitem__(self, key):
raise ValueError('Adc registers cannot be read back')

View File

@ -2,7 +2,34 @@
Utility functions that are useful for testing and troubleshooting
but not directly used in controlling the detector
"""
from collections import namedtuple
import _sls_detector #C++ lib
import functools
Geometry = namedtuple('Geometry', ['x', 'y'])
def get_set_bits(mask):
"""
Return a list of the set bits in a python integer
"""
return [i for i in range(mask.bit_length()) if (mask>>i)&1]
def list_to_bitmask(values):
"""
Convert a list of integers to a bitmask with set bits
where the list indicates
"""
mask = int(0)
values = list(set(values)) #Remove duplicates
for v in values:
mask += 1 << v
return mask
def to_geo(value):
if isinstance(value, _sls_detector.xy):
return Geometry(x = value.x, y = value.y)
else:
raise ValueError("Can only convert sls_detector.xy")
def all_equal(mylist):
"""If all elements are equal return true otherwise false"""
@ -19,6 +46,14 @@ def element_if_equal(mylist):
else:
return mylist
def element(func):
"""
Wrapper to return either list or element
"""
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
return element_if_equal(func(self, *args, **kwargs))
return wrapper
def eiger_register_to_time(register):
"""

File diff suppressed because it is too large Load Diff

636
python/src/detector.cpp Normal file
View File

@ -0,0 +1,636 @@
/* WARINING This file is auto generated any edits might be overwritten without
* warning */
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "Detector.h"
#include "ToString.h"
#include "network_utils.h"
#include "sls_detector_defs.h"
#include "typecaster.h"
namespace py = pybind11;
void init_det(py::module &m) {
using sls::Detector;
using sls::Positions;
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
CppDetectorApi
.def(py::init<int>())
.def("freeSharedMemory", &Detector::freeSharedMemory)
.def("loadConfig", &Detector::loadConfig, py::arg())
.def("loadParameters", &Detector::loadParameters, py::arg())
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
.def("setHostname", &Detector::setHostname, py::arg())
.def("setVirtualDetectorServers", &Detector::setVirtualDetectorServers,
py::arg(), py::arg())
.def("getShmId", &Detector::getShmId)
.def("getPackageVersion", &Detector::getPackageVersion)
.def("getClientVersion", &Detector::getClientVersion)
.def("getFirmwareVersion", &Detector::getFirmwareVersion,
py::arg() = Positions{})
.def("getDetectorServerVersion", &Detector::getDetectorServerVersion,
py::arg() = Positions{})
.def("getSerialNumber", &Detector::getSerialNumber,
py::arg() = Positions{})
.def("getReceiverVersion", &Detector::getReceiverVersion,
py::arg() = Positions{})
.def("getDetectorType", &Detector::getDetectorType,
py::arg() = Positions{})
.def("size", &Detector::size)
.def("empty", &Detector::empty)
.def("getModuleGeometry", &Detector::getModuleGeometry)
.def("getModuleSize", &Detector::getModuleSize, py::arg() = Positions{})
.def("getDetectorSize", &Detector::getDetectorSize)
.def("setDetectorSize", &Detector::setDetectorSize, py::arg())
.def("getSettings", &Detector::getSettings, py::arg() = Positions{})
.def("setSettings", &Detector::setSettings, py::arg(),
py::arg() = Positions{})
.def("registerAcquisitionFinishedCallback",
&Detector::registerAcquisitionFinishedCallback, py::arg(),
py::arg())
.def("registerDataCallback", &Detector::registerDataCallback, py::arg(),
py::arg())
.def("getNumberOfFrames", &Detector::getNumberOfFrames,
py::arg() = Positions{})
.def("setNumberOfFrames", &Detector::setNumberOfFrames, py::arg())
.def("getNumberOfTriggers", &Detector::getNumberOfTriggers,
py::arg() = Positions{})
.def("setNumberOfTriggers", &Detector::setNumberOfTriggers, py::arg())
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
.def("setExptime", &Detector::setExptime, py::arg(),
py::arg() = Positions{})
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
.def("setPeriod", &Detector::setPeriod, py::arg(),
py::arg() = Positions{})
.def("getDelayAfterTrigger", &Detector::getDelayAfterTrigger,
py::arg() = Positions{})
.def("setDelayAfterTrigger", &Detector::setDelayAfterTrigger, py::arg(),
py::arg() = Positions{})
.def("getNumberOfFramesLeft", &Detector::getNumberOfFramesLeft,
py::arg() = Positions{})
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
py::arg() = Positions{})
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
py::arg() = Positions{})
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
.def("setSpeed", &Detector::setSpeed, py::arg(),
py::arg() = Positions{})
.def("getADCPhase", &Detector::getADCPhase, py::arg() = Positions{})
.def("setADCPhase", &Detector::setADCPhase, py::arg(),
py::arg() = Positions{})
.def("getMaxADCPhaseShift", &Detector::getMaxADCPhaseShift,
py::arg() = Positions{})
.def("getADCPhaseInDegrees", &Detector::getADCPhaseInDegrees,
py::arg() = Positions{})
.def("setADCPhaseInDegrees", &Detector::setADCPhaseInDegrees, py::arg(),
py::arg() = Positions{})
.def("getClockFrequency", &Detector::getClockFrequency, py::arg(),
py::arg() = Positions{})
.def("setClockFrequency", &Detector::setClockFrequency, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getClockPhase", &Detector::getClockPhase, py::arg(),
py::arg() = Positions{})
.def("setClockPhase", &Detector::setClockPhase, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getMaxClockPhaseShift", &Detector::getMaxClockPhaseShift,
py::arg(), py::arg() = Positions{})
.def("getClockPhaseinDegrees", &Detector::getClockPhaseinDegrees,
py::arg(), py::arg() = Positions{})
.def("setClockPhaseinDegrees", &Detector::setClockPhaseinDegrees,
py::arg(), py::arg(), py::arg() = Positions{})
.def("getClockDivider", &Detector::getClockDivider, py::arg(),
py::arg() = Positions{})
.def("setClockDivider", &Detector::setClockDivider, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getHighVoltage", &Detector::getHighVoltage,
py::arg() = Positions{})
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
py::arg() = Positions{})
.def("getTemperature", &Detector::getTemperature, py::arg(),
py::arg() = Positions{})
.def("getDAC", &Detector::getDAC, py::arg(), py::arg(),
py::arg() = Positions{})
.def("setDAC", &Detector::setDAC, py::arg(), py::arg(), py::arg(),
py::arg() = Positions{})
.def("getOnChipDAC", &Detector::getOnChipDAC, py::arg(), py::arg(),
py::arg() = Positions{})
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
py::arg(), py::arg() = Positions{})
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
py::arg() = Positions{})
.def("acquire", &Detector::acquire)
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
.def("startReceiver", &Detector::startReceiver)
.def("stopReceiver", &Detector::stopReceiver)
.def("startDetector", &Detector::startDetector)
.def("stopDetector", &Detector::stopDetector)
.def("getDetectorStatus", &Detector::getDetectorStatus,
py::arg() = Positions{})
.def("getReceiverStatus", &Detector::getReceiverStatus,
py::arg() = Positions{})
.def("getFramesCaught", &Detector::getFramesCaught,
py::arg() = Positions{})
.def("getNumMissingPackets", &Detector::getNumMissingPackets,
py::arg() = Positions{})
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
py::arg() = Positions{})
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
py::arg(), py::arg() = Positions{})
.def("sendSoftwareTrigger", &Detector::sendSoftwareTrigger,
py::arg() = Positions{})
.def("getNumberofUDPInterfaces", &Detector::getNumberofUDPInterfaces,
py::arg() = Positions{})
.def("setNumberofUDPInterfaces", &Detector::setNumberofUDPInterfaces,
py::arg(), py::arg() = Positions{})
.def("getSelectedUDPInterface", &Detector::getSelectedUDPInterface,
py::arg() = Positions{})
.def("selectUDPInterface", &Detector::selectUDPInterface, py::arg(),
py::arg() = Positions{})
.def("getSourceUDPIP", &Detector::getSourceUDPIP,
py::arg() = Positions{})
.def("setSourceUDPIP", &Detector::setSourceUDPIP, py::arg(),
py::arg() = Positions{})
.def("getSourceUDPIP2", &Detector::getSourceUDPIP2,
py::arg() = Positions{})
.def("setSourceUDPIP2", &Detector::setSourceUDPIP2, py::arg(),
py::arg() = Positions{})
.def("getSourceUDPMAC", &Detector::getSourceUDPMAC,
py::arg() = Positions{})
.def("setSourceUDPMAC", &Detector::setSourceUDPMAC, py::arg(),
py::arg() = Positions{})
.def("getSourceUDPMAC2", &Detector::getSourceUDPMAC2,
py::arg() = Positions{})
.def("setSourceUDPMAC2", &Detector::setSourceUDPMAC2, py::arg(),
py::arg() = Positions{})
.def("getDestinationUDPIP", &Detector::getDestinationUDPIP,
py::arg() = Positions{})
.def("setDestinationUDPIP", &Detector::setDestinationUDPIP, py::arg(),
py::arg() = Positions{})
.def("getDestinationUDPIP2", &Detector::getDestinationUDPIP2,
py::arg() = Positions{})
.def("setDestinationUDPIP2", &Detector::setDestinationUDPIP2, py::arg(),
py::arg() = Positions{})
.def("getDestinationUDPMAC", &Detector::getDestinationUDPMAC,
py::arg() = Positions{})
.def("setDestinationUDPMAC", &Detector::setDestinationUDPMAC, py::arg(),
py::arg() = Positions{})
.def("getDestinationUDPMAC2", &Detector::getDestinationUDPMAC2,
py::arg() = Positions{})
.def("setDestinationUDPMAC2", &Detector::setDestinationUDPMAC2,
py::arg(), py::arg() = Positions{})
.def("getDestinationUDPPort", &Detector::getDestinationUDPPort,
py::arg() = Positions{})
.def("setDestinationUDPPort", &Detector::setDestinationUDPPort,
py::arg(), py::arg())
.def("getDestinationUDPPort2", &Detector::getDestinationUDPPort2,
py::arg() = Positions{})
.def("setDestinationUDPPort2", &Detector::setDestinationUDPPort2,
py::arg(), py::arg())
.def("printRxConfiguration", &Detector::printRxConfiguration,
py::arg() = Positions{})
.def("getTenGiga", &Detector::getTenGiga, py::arg() = Positions{})
.def("setTenGiga", &Detector::setTenGiga, py::arg(),
py::arg() = Positions{})
.def("getTenGigaFlowControl", &Detector::getTenGigaFlowControl,
py::arg() = Positions{})
.def("setTenGigaFlowControl", &Detector::setTenGigaFlowControl,
py::arg(), py::arg() = Positions{})
.def("getTransmissionDelayFrame", &Detector::getTransmissionDelayFrame,
py::arg() = Positions{})
.def("setTransmissionDelayFrame", &Detector::setTransmissionDelayFrame,
py::arg(), py::arg() = Positions{})
.def("getTransmissionDelayLeft", &Detector::getTransmissionDelayLeft,
py::arg() = Positions{})
.def("setTransmissionDelayLeft", &Detector::setTransmissionDelayLeft,
py::arg(), py::arg() = Positions{})
.def("getTransmissionDelayRight", &Detector::getTransmissionDelayRight,
py::arg() = Positions{})
.def("setTransmissionDelayRight", &Detector::setTransmissionDelayRight,
py::arg(), py::arg() = Positions{})
.def("getUseReceiverFlag", &Detector::getUseReceiverFlag,
py::arg() = Positions{})
.def("getRxHostname", &Detector::getRxHostname, py::arg() = Positions{})
.def("setRxHostname", &Detector::setRxHostname, py::arg(),
py::arg() = Positions{})
.def("getRxPort", &Detector::getRxPort, py::arg() = Positions{})
.def("setRxPort", &Detector::setRxPort, py::arg(), py::arg())
.def("getRxFifoDepth", &Detector::getRxFifoDepth,
py::arg() = Positions{})
.def("setRxFifoDepth", &Detector::setRxFifoDepth, py::arg(),
py::arg() = Positions{})
.def("getRxSilentMode", &Detector::getRxSilentMode,
py::arg() = Positions{})
.def("setRxSilentMode", &Detector::setRxSilentMode, py::arg(),
py::arg() = Positions{})
.def("getRxFrameDiscardPolicy", &Detector::getRxFrameDiscardPolicy,
py::arg() = Positions{})
.def("setRxFrameDiscardPolicy", &Detector::setRxFrameDiscardPolicy,
py::arg(), py::arg() = Positions{})
.def("getPartialFramesPadding", &Detector::getPartialFramesPadding,
py::arg() = Positions{})
.def("setPartialFramesPadding", &Detector::setPartialFramesPadding,
py::arg(), py::arg() = Positions{})
.def("getRxUDPSocketBufferSize", &Detector::getRxUDPSocketBufferSize,
py::arg() = Positions{})
.def("setRxUDPSocketBufferSize", &Detector::setRxUDPSocketBufferSize,
py::arg(), py::arg() = Positions{})
.def("getRxRealUDPSocketBufferSize",
&Detector::getRxRealUDPSocketBufferSize, py::arg() = Positions{})
.def("getRxLock", &Detector::getRxLock, py::arg() = Positions{})
.def("setRxLock", &Detector::setRxLock, py::arg(),
py::arg() = Positions{})
.def("getRxLastClientIP", &Detector::getRxLastClientIP,
py::arg() = Positions{})
.def("getFileFormat", &Detector::getFileFormat, py::arg() = Positions{})
.def("setFileFormat", &Detector::setFileFormat, py::arg(),
py::arg() = Positions{})
.def("getFilePath", &Detector::getFilePath, py::arg() = Positions{})
.def("setFilePath", &Detector::setFilePath, py::arg(),
py::arg() = Positions{})
.def("getFileNamePrefix", &Detector::getFileNamePrefix,
py::arg() = Positions{})
.def("setFileNamePrefix", &Detector::setFileNamePrefix, py::arg(),
py::arg() = Positions{})
.def("getAcquisitionIndex", &Detector::getAcquisitionIndex,
py::arg() = Positions{})
.def("setAcquisitionIndex", &Detector::setAcquisitionIndex, py::arg(),
py::arg() = Positions{})
.def("getFileWrite", &Detector::getFileWrite, py::arg() = Positions{})
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
py::arg() = Positions{})
.def("getMasterFileWrite", &Detector::getMasterFileWrite,
py::arg() = Positions{})
.def("setMasterFileWrite", &Detector::setMasterFileWrite, py::arg(),
py::arg() = Positions{})
.def("getFileOverWrite", &Detector::getFileOverWrite,
py::arg() = Positions{})
.def("setFileOverWrite", &Detector::setFileOverWrite, py::arg(),
py::arg() = Positions{})
.def("getFramesPerFile", &Detector::getFramesPerFile,
py::arg() = Positions{})
.def("setFramesPerFile", &Detector::setFramesPerFile, py::arg(),
py::arg() = Positions{})
.def("getRxZmqDataStream", &Detector::getRxZmqDataStream,
py::arg() = Positions{})
.def("setRxZmqDataStream", &Detector::setRxZmqDataStream, py::arg(),
py::arg() = Positions{})
.def("getRxZmqFrequency", &Detector::getRxZmqFrequency,
py::arg() = Positions{})
.def("setRxZmqFrequency", &Detector::setRxZmqFrequency, py::arg(),
py::arg() = Positions{})
.def("getRxZmqTimer", &Detector::getRxZmqTimer, py::arg() = Positions{})
.def("setRxZmqTimer", &Detector::setRxZmqTimer, py::arg(),
py::arg() = Positions{})
.def("getRxZmqPort", &Detector::getRxZmqPort, py::arg() = Positions{})
.def("setRxZmqPort", &Detector::setRxZmqPort, py::arg(), py::arg())
.def("getRxZmqIP", &Detector::getRxZmqIP, py::arg() = Positions{})
.def("setRxZmqIP", &Detector::setRxZmqIP, py::arg(),
py::arg() = Positions{})
.def("getClientZmqPort", &Detector::getClientZmqPort,
py::arg() = Positions{})
.def("setClientZmqPort", &Detector::setClientZmqPort, py::arg(),
py::arg())
.def("getClientZmqIp", &Detector::getClientZmqIp,
py::arg() = Positions{})
.def("setClientZmqIp", &Detector::setClientZmqIp, py::arg(),
py::arg() = Positions{})
.def("getDynamicRange", &Detector::getDynamicRange,
py::arg() = Positions{})
.def("setDynamicRange", &Detector::setDynamicRange, py::arg())
.def("getSubExptime", &Detector::getSubExptime, py::arg() = Positions{})
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
py::arg() = Positions{})
.def("getSubDeadTime", &Detector::getSubDeadTime,
py::arg() = Positions{})
.def("setSubDeadTime", &Detector::setSubDeadTime, py::arg(),
py::arg() = Positions{})
.def("getThresholdEnergy", &Detector::getThresholdEnergy,
py::arg() = Positions{})
.def("setThresholdEnergy", &Detector::setThresholdEnergy, py::arg(),
py::arg(), py::arg(), py::arg() = Positions{})
.def("getSettingsPath", &Detector::getSettingsPath,
py::arg() = Positions{})
.def("setSettingsPath", &Detector::setSettingsPath, py::arg(),
py::arg() = Positions{})
.def("loadTrimbits", &Detector::loadTrimbits, py::arg(),
py::arg() = Positions{})
.def("getRxAddGapPixels", &Detector::getRxAddGapPixels,
py::arg() = Positions{})
.def("setRxAddGapPixels", &Detector::setRxAddGapPixels, py::arg())
.def("getParallelMode", &Detector::getParallelMode,
py::arg() = Positions{})
.def("setParallelMode", &Detector::setParallelMode, py::arg(),
py::arg() = Positions{})
.def("getOverFlowMode", &Detector::getOverFlowMode,
py::arg() = Positions{})
.def("setOverFlowMode", &Detector::setOverFlowMode, py::arg(),
py::arg() = Positions{})
.def("getStoreInRamMode", &Detector::getStoreInRamMode,
py::arg() = Positions{})
.def("setStoreInRamMode", &Detector::setStoreInRamMode, py::arg(),
py::arg() = Positions{})
.def("getBottom", &Detector::getBottom, py::arg() = Positions{})
.def("setBottom", &Detector::setBottom, py::arg(),
py::arg() = Positions{})
.def("getAllTrimbits", &Detector::getAllTrimbits,
py::arg() = Positions{})
.def("setAllTrimbits", &Detector::setAllTrimbits, py::arg(),
py::arg() = Positions{})
.def("getTrimEnergies", &Detector::getTrimEnergies,
py::arg() = Positions{})
.def("setTrimEnergies", &Detector::setTrimEnergies, py::arg(),
py::arg() = Positions{})
.def("getRateCorrection", &Detector::getRateCorrection,
py::arg() = Positions{})
.def("setDefaultRateCorrection", &Detector::setDefaultRateCorrection,
py::arg() = Positions{})
.def("setRateCorrection", &Detector::setRateCorrection, py::arg(),
py::arg() = Positions{})
.def("getPartialReadout", &Detector::getPartialReadout,
py::arg() = Positions{})
.def("setPartialReadout", &Detector::setPartialReadout, py::arg(),
py::arg() = Positions{})
.def("getInterruptSubframe", &Detector::getInterruptSubframe,
py::arg() = Positions{})
.def("setInterruptSubframe", &Detector::setInterruptSubframe, py::arg(),
py::arg() = Positions{})
.def("getMeasuredPeriod", &Detector::getMeasuredPeriod,
py::arg() = Positions{})
.def("getMeasuredSubFramePeriod", &Detector::getMeasuredSubFramePeriod,
py::arg() = Positions{})
.def("getActive", &Detector::getActive, py::arg() = Positions{})
.def("setActive", &Detector::setActive, py::arg(),
py::arg() = Positions{})
.def("getRxPadDeactivatedMode", &Detector::getRxPadDeactivatedMode,
py::arg() = Positions{})
.def("setRxPadDeactivatedMode", &Detector::setRxPadDeactivatedMode,
py::arg(), py::arg() = Positions{})
.def("getPartialReset", &Detector::getPartialReset,
py::arg() = Positions{})
.def("setPartialReset", &Detector::setPartialReset, py::arg(),
py::arg() = Positions{})
.def("pulsePixel", &Detector::pulsePixel, py::arg(), py::arg(),
py::arg() = Positions{})
.def("pulsePixelNMove", &Detector::pulsePixelNMove, py::arg(),
py::arg(), py::arg() = Positions{})
.def("pulseChip", &Detector::pulseChip, py::arg(),
py::arg() = Positions{})
.def("getQuad", &Detector::getQuad, py::arg() = Positions{})
.def("setQuad", &Detector::setQuad, py::arg())
.def("getThresholdTemperature", &Detector::getThresholdTemperature,
py::arg() = Positions{})
.def("setThresholdTemperature", &Detector::setThresholdTemperature,
py::arg(), py::arg() = Positions{})
.def("getTemperatureControl", &Detector::getTemperatureControl,
py::arg() = Positions{})
.def("setTemperatureControl", &Detector::setTemperatureControl,
py::arg(), py::arg() = Positions{})
.def("getTemperatureEvent", &Detector::getTemperatureEvent,
py::arg() = Positions{})
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
py::arg() = Positions{})
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
py::arg() = Positions{})
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
py::arg() = Positions{})
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
py::arg() = Positions{})
.def("getNumberOfAdditionalStorageCells",
&Detector::getNumberOfAdditionalStorageCells,
py::arg() = Positions{})
.def("setNumberOfAdditionalStorageCells",
&Detector::setNumberOfAdditionalStorageCells, py::arg())
.def("getStorageCellStart", &Detector::getStorageCellStart,
py::arg() = Positions{})
.def("setStoragecellStart", &Detector::setStoragecellStart, py::arg(),
py::arg() = Positions{})
.def("getStorageCellDelay", &Detector::getStorageCellDelay,
py::arg() = Positions{})
.def("setStorageCellDelay", &Detector::setStorageCellDelay, py::arg(),
py::arg() = Positions{})
.def("getROI", &Detector::getROI, py::arg() = Positions{})
.def("setROI", &Detector::setROI, py::arg(), py::arg())
.def("clearROI", &Detector::clearROI, py::arg() = Positions{})
.def("getExptimeLeft", &Detector::getExptimeLeft,
py::arg() = Positions{})
.def("getExternalSignalFlags", &Detector::getExternalSignalFlags,
py::arg() = Positions{})
.def("setExternalSignalFlags", &Detector::setExternalSignalFlags,
py::arg(), py::arg() = Positions{})
.def("getImageTestMode", &Detector::getImageTestMode,
py::arg() = Positions{})
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
py::arg() = Positions{})
.def("getInjectChannel", &Detector::getInjectChannel,
py::arg() = Positions{})
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getVetoPhoton", &Detector::getVetoPhoton, py::arg(),
py::arg() = Positions{})
.def("setVetoPhoton", &Detector::setVetoPhoton, py::arg(), py::arg(),
py::arg(), py::arg(), py::arg() = Positions{})
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
py::arg(), py::arg() = Positions{})
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
py::arg() = Positions{})
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
.def("getCounterMask", &Detector::getCounterMask,
py::arg() = Positions{})
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
py::arg() = Positions{})
.def("getNumberOfAnalogSamples", &Detector::getNumberOfAnalogSamples,
py::arg() = Positions{})
.def("setNumberOfAnalogSamples", &Detector::setNumberOfAnalogSamples,
py::arg(), py::arg() = Positions{})
.def("getNumberOfDigitalSamples", &Detector::getNumberOfDigitalSamples,
py::arg() = Positions{})
.def("setNumberOfDigitalSamples", &Detector::setNumberOfDigitalSamples,
py::arg(), py::arg() = Positions{})
.def("getReadoutMode", &Detector::getReadoutMode,
py::arg() = Positions{})
.def("setReadoutMode", &Detector::setReadoutMode, py::arg(),
py::arg() = Positions{})
.def("getDBITPhase", &Detector::getDBITPhase, py::arg() = Positions{})
.def("setDBITPhase", &Detector::setDBITPhase, py::arg(),
py::arg() = Positions{})
.def("getMaxDBITPhaseShift", &Detector::getMaxDBITPhaseShift,
py::arg() = Positions{})
.def("getDBITPhaseInDegrees", &Detector::getDBITPhaseInDegrees,
py::arg() = Positions{})
.def("setDBITPhaseInDegrees", &Detector::setDBITPhaseInDegrees,
py::arg(), py::arg() = Positions{})
.def("getADCClock", &Detector::getADCClock, py::arg() = Positions{})
.def("setADCClock", &Detector::setADCClock, py::arg(),
py::arg() = Positions{})
.def("getDBITClock", &Detector::getDBITClock, py::arg() = Positions{})
.def("setDBITClock", &Detector::setDBITClock, py::arg(),
py::arg() = Positions{})
.def("getRUNClock", &Detector::getRUNClock, py::arg() = Positions{})
.def("setRUNClock", &Detector::setRUNClock, py::arg(),
py::arg() = Positions{})
.def("getSYNCClock", &Detector::getSYNCClock, py::arg() = Positions{})
.def("getADCPipeline", &Detector::getADCPipeline,
py::arg() = Positions{})
.def("setADCPipeline", &Detector::setADCPipeline, py::arg(),
py::arg() = Positions{})
.def("getDBITPipeline", &Detector::getDBITPipeline,
py::arg() = Positions{})
.def("setDBITPipeline", &Detector::setDBITPipeline, py::arg(),
py::arg() = Positions{})
.def("getVoltage", &Detector::getVoltage, py::arg(),
py::arg() = Positions{})
.def("setVoltage", &Detector::setVoltage, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getMeasuredVoltage", &Detector::getMeasuredVoltage, py::arg(),
py::arg() = Positions{})
.def("getMeasuredCurrent", &Detector::getMeasuredCurrent, py::arg(),
py::arg() = Positions{})
.def("getSlowADC", &Detector::getSlowADC, py::arg(),
py::arg() = Positions{})
.def("getADCEnableMask", &Detector::getADCEnableMask,
py::arg() = Positions{})
.def("setADCEnableMask", &Detector::setADCEnableMask, py::arg(),
py::arg() = Positions{})
.def("getTenGigaADCEnableMask", &Detector::getTenGigaADCEnableMask,
py::arg() = Positions{})
.def("setTenGigaADCEnableMask", &Detector::setTenGigaADCEnableMask,
py::arg(), py::arg() = Positions{})
.def("getADCInvert", &Detector::getADCInvert, py::arg() = Positions{})
.def("setADCInvert", &Detector::setADCInvert, py::arg(),
py::arg() = Positions{})
.def("getExternalSamplingSource", &Detector::getExternalSamplingSource,
py::arg() = Positions{})
.def("setExternalSamplingSource", &Detector::setExternalSamplingSource,
py::arg(), py::arg() = Positions{})
.def("getExternalSampling", &Detector::getExternalSampling,
py::arg() = Positions{})
.def("setExternalSampling", &Detector::setExternalSampling, py::arg(),
py::arg() = Positions{})
.def("getRxDbitList", &Detector::getRxDbitList, py::arg() = Positions{})
.def("setRxDbitList", &Detector::setRxDbitList, py::arg(),
py::arg() = Positions{})
.def("getRxDbitOffset", &Detector::getRxDbitOffset,
py::arg() = Positions{})
.def("setRxDbitOffset", &Detector::setRxDbitOffset, py::arg(),
py::arg() = Positions{})
.def("setDigitalIODelay", &Detector::setDigitalIODelay, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getLEDEnable", &Detector::getLEDEnable, py::arg() = Positions{})
.def("setLEDEnable", &Detector::setLEDEnable, py::arg(),
py::arg() = Positions{})
.def("setPattern", &Detector::setPattern, py::arg(),
py::arg() = Positions{})
.def("savePattern", &Detector::savePattern, py::arg())
.def("getPatternIOControl", &Detector::getPatternIOControl,
py::arg() = Positions{})
.def("setPatternIOControl", &Detector::setPatternIOControl, py::arg(),
py::arg() = Positions{})
.def("getPatternClockControl", &Detector::getPatternClockControl,
py::arg() = Positions{})
.def("setPatternClockControl", &Detector::setPatternClockControl,
py::arg(), py::arg() = Positions{})
.def("getPatternWord", &Detector::getPatternWord, py::arg(),
py::arg() = Positions{})
.def("setPatternWord", &Detector::setPatternWord, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getPatternLoopAddresses", &Detector::getPatternLoopAddresses,
py::arg(), py::arg() = Positions{})
.def("setPatternLoopAddresses", &Detector::setPatternLoopAddresses,
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
.def("getPatternLoopCycles", &Detector::getPatternLoopCycles, py::arg(),
py::arg() = Positions{})
.def("setPatternLoopCycles", &Detector::setPatternLoopCycles, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getPatternWaitAddr", &Detector::getPatternWaitAddr, py::arg(),
py::arg() = Positions{})
.def("setPatternWaitAddr", &Detector::setPatternWaitAddr, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getPatternWaitTime", &Detector::getPatternWaitTime, py::arg(),
py::arg() = Positions{})
.def("setPatternWaitTime", &Detector::setPatternWaitTime, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getPatternMask", &Detector::getPatternMask,
py::arg() = Positions{})
.def("setPatternMask", &Detector::setPatternMask, py::arg(),
py::arg() = Positions{})
.def("getPatternBitMask", &Detector::getPatternBitMask,
py::arg() = Positions{})
.def("setPatternBitMask", &Detector::setPatternBitMask, py::arg(),
py::arg() = Positions{})
.def("getAdditionalJsonHeader", &Detector::getAdditionalJsonHeader,
py::arg() = Positions{})
.def("setAdditionalJsonHeader", &Detector::setAdditionalJsonHeader,
py::arg(), py::arg() = Positions{})
.def("getAdditionalJsonParameter",
&Detector::getAdditionalJsonParameter, py::arg(),
py::arg() = Positions{})
.def("setAdditionalJsonParameter",
&Detector::setAdditionalJsonParameter, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getDetectorMinMaxEnergyThreshold",
&Detector::getDetectorMinMaxEnergyThreshold, py::arg(),
py::arg() = Positions{})
.def("setDetectorMinMaxEnergyThreshold",
&Detector::setDetectorMinMaxEnergyThreshold, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getFrameMode", &Detector::getFrameMode, py::arg() = Positions{})
.def("setFrameMode", &Detector::setFrameMode, py::arg(),
py::arg() = Positions{})
.def("getDetectorMode", &Detector::getDetectorMode,
py::arg() = Positions{})
.def("setDetectorMode", &Detector::setDetectorMode, py::arg(),
py::arg() = Positions{})
.def("programFPGA", &Detector::programFPGA, py::arg(),
py::arg() = Positions{})
.def("resetFPGA", &Detector::resetFPGA, py::arg() = Positions{})
.def("copyDetectorServer", &Detector::copyDetectorServer, py::arg(),
py::arg(), py::arg() = Positions{})
.def("rebootController", &Detector::rebootController,
py::arg() = Positions{})
.def("updateFirmwareAndServer", &Detector::updateFirmwareAndServer,
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
.def("readRegister", &Detector::readRegister, py::arg(),
py::arg() = Positions{})
.def("writeRegister", &Detector::writeRegister, py::arg(), py::arg(),
py::arg() = Positions{})
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
py::arg() = Positions{})
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
py::arg() = Positions{})
.def("executeFirmwareTest", &Detector::executeFirmwareTest,
py::arg() = Positions{})
.def("executeBusTest", &Detector::executeBusTest,
py::arg() = Positions{})
.def("writeAdcRegister", &Detector::writeAdcRegister, py::arg(),
py::arg(), py::arg() = Positions{})
.def("getControlPort", &Detector::getControlPort,
py::arg() = Positions{})
.def("setControlPort", &Detector::setControlPort, py::arg(),
py::arg() = Positions{})
.def("getStopPort", &Detector::getStopPort, py::arg() = Positions{})
.def("setStopPort", &Detector::setStopPort, py::arg(),
py::arg() = Positions{})
.def("getDetectorLock", &Detector::getDetectorLock,
py::arg() = Positions{})
.def("setDetectorLock", &Detector::setDetectorLock, py::arg(),
py::arg() = Positions{})
.def("getLastClientIP", &Detector::getLastClientIP,
py::arg() = Positions{})
.def("executeCommand", &Detector::executeCommand, py::arg(),
py::arg() = Positions{})
.def("getNumberOfFramesFromStart",
&Detector::getNumberOfFramesFromStart, py::arg() = Positions{})
.def("getActualTime", &Detector::getActualTime, py::arg() = Positions{})
.def("getMeasurementTime", &Detector::getMeasurementTime,
py::arg() = Positions{})
.def("getUserDetails", &Detector::getUserDetails)
.def("getRxCurrentFrameIndex", &Detector::getRxCurrentFrameIndex,
py::arg() = Positions{});
}

View File

@ -0,0 +1,21 @@
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "Detector.h"
#include "ToString.h"
#include "network_utils.h"
#include "sls_detector_defs.h"
#include "typecaster.h"
namespace py = pybind11;
void init_det(py::module &m) {
using sls::Detector;
using sls::Positions;
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
CppDetectorApi
.def(py::init<int>())
[[FUNCTIONS]]
}

View File

@ -1,3 +1,6 @@
/* WARINING This file is auto generated any edits might be overwritten without
* warning */
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
@ -7,6 +10,25 @@
namespace py = pybind11;
void init_enums(py::module &m) {
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
py::class_<slsDetectorDefs::xy> xy(m, "xy");
xy.def(py::init());
xy.def(py::init<int, int>());
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
.value("GET_DETECTOR_TYPE",
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
.value("EIGER", slsDetectorDefs::detectorType::EIGER)
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
.value("JUNGFRAU", slsDetectorDefs::detectorType::JUNGFRAU)
.value("CHIPTESTBOARD", slsDetectorDefs::detectorType::CHIPTESTBOARD)
.value("MOENCH", slsDetectorDefs::detectorType::MOENCH)
.value("MYTHEN3", slsDetectorDefs::detectorType::MYTHEN3)
.value("GOTTHARD2", slsDetectorDefs::detectorType::GOTTHARD2)
.export_values();
py::enum_<slsDetectorDefs::runStatus>(Defs, "runStatus")
.value("IDLE", slsDetectorDefs::runStatus::IDLE)
.value("ERROR", slsDetectorDefs::runStatus::ERROR)
@ -16,4 +38,244 @@ void init_enums(py::module &m) {
.value("RUNNING", slsDetectorDefs::runStatus::RUNNING)
.value("STOPPED", slsDetectorDefs::runStatus::STOPPED)
.export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("GET_FRAME_DISCARD_POLICY",
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
.value("DISCARD_PARTIAL_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_PARTIAL_FRAMES)
.value("NUM_DISCARD_POLICIES",
slsDetectorDefs::frameDiscardPolicy::NUM_DISCARD_POLICIES)
.export_values();
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
.value("NUM_FILE_FORMATS",
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
.export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X)
.value("Y", slsDetectorDefs::dimension::Y)
.export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
.value("GET_EXTERNAL_SIGNAL_FLAG",
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
.value("GATE_IN_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
.value("GATE_IN_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
.value("TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
.value("TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
.value("RO_TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
.value("RO_TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
.value("GATE_OUT_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
.value("GATE_OUT_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
.value("TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
.value("TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
.value("RO_TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
.value("RO_TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
.value(
"MASTER_SLAVE_SYNCHRONIZATION",
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
.export_values();
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
.value("TRIGGER_EXPOSURE",
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
.value("GATED", slsDetectorDefs::timingMode::GATED)
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
.export_values();
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
.value("THRESHOLD", slsDetectorDefs::dacIndex::THRESHOLD)
.value("CALIBRATION_PULSE",
slsDetectorDefs::dacIndex::CALIBRATION_PULSE)
.value("TRIMBIT_SIZE", slsDetectorDefs::dacIndex::TRIMBIT_SIZE)
.value("PREAMP", slsDetectorDefs::dacIndex::PREAMP)
.value("SHAPER1", slsDetectorDefs::dacIndex::SHAPER1)
.value("SHAPER2", slsDetectorDefs::dacIndex::SHAPER2)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
.value("VOUT_CM", slsDetectorDefs::dacIndex::VOUT_CM)
.value("VCASC_OUT", slsDetectorDefs::dacIndex::VCASC_OUT)
.value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM)
.value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP)
.value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC)
.value("SVP", slsDetectorDefs::dacIndex::SVP)
.value("SVN", slsDetectorDefs::dacIndex::SVN)
.value("VTR", slsDetectorDefs::dacIndex::VTR)
.value("VRF", slsDetectorDefs::dacIndex::VRF)
.value("VRS", slsDetectorDefs::dacIndex::VRS)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("CAL", slsDetectorDefs::dacIndex::CAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VIS", slsDetectorDefs::dacIndex::VIS)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP)
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
.value("TEMPERATURE_FPGAEXT",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
.value("TEMPERATURE_DCDC", slsDetectorDefs::dacIndex::TEMPERATURE_DCDC)
.value("TEMPERATURE_SODL", slsDetectorDefs::dacIndex::TEMPERATURE_SODL)
.value("TEMPERATURE_SODR", slsDetectorDefs::dacIndex::TEMPERATURE_SODR)
.value("TEMPERATURE_FPGA2",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
.value("TEMPERATURE_FPGA3",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VIINSH", slsDetectorDefs::dacIndex::VIINSH)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VPL", slsDetectorDefs::dacIndex::VPL)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("CASSH", slsDetectorDefs::dacIndex::CASSH)
.value("CAS", slsDetectorDefs::dacIndex::CAS)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
.value("VREF_RESTORE", slsDetectorDefs::dacIndex::VREF_RESTORE)
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
.value("V_POWER_D", slsDetectorDefs::dacIndex::V_POWER_D)
.value("V_POWER_IO", slsDetectorDefs::dacIndex::V_POWER_IO)
.value("V_POWER_CHIP", slsDetectorDefs::dacIndex::V_POWER_CHIP)
.value("I_POWER_A", slsDetectorDefs::dacIndex::I_POWER_A)
.value("I_POWER_B", slsDetectorDefs::dacIndex::I_POWER_B)
.value("I_POWER_C", slsDetectorDefs::dacIndex::I_POWER_C)
.value("I_POWER_D", slsDetectorDefs::dacIndex::I_POWER_D)
.value("I_POWER_IO", slsDetectorDefs::dacIndex::I_POWER_IO)
.value("V_LIMIT", slsDetectorDefs::dacIndex::V_LIMIT)
.value("SLOW_ADC0", slsDetectorDefs::dacIndex::SLOW_ADC0)
.value("SLOW_ADC1", slsDetectorDefs::dacIndex::SLOW_ADC1)
.value("SLOW_ADC2", slsDetectorDefs::dacIndex::SLOW_ADC2)
.value("SLOW_ADC3", slsDetectorDefs::dacIndex::SLOW_ADC3)
.value("SLOW_ADC4", slsDetectorDefs::dacIndex::SLOW_ADC4)
.value("SLOW_ADC5", slsDetectorDefs::dacIndex::SLOW_ADC5)
.value("SLOW_ADC6", slsDetectorDefs::dacIndex::SLOW_ADC6)
.value("SLOW_ADC7", slsDetectorDefs::dacIndex::SLOW_ADC7)
.value("SLOW_ADC_TEMP", slsDetectorDefs::dacIndex::SLOW_ADC_TEMP)
.export_values();
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
.value("FAST", slsDetectorDefs::detectorSettings::FAST)
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
.value("DYNAMICGAIN", slsDetectorDefs::detectorSettings::DYNAMICGAIN)
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
.value("FORCESWITCHG1",
slsDetectorDefs::detectorSettings::FORCESWITCHG1)
.value("FORCESWITCHG2",
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
.value("UNINITIALIZED",
slsDetectorDefs::detectorSettings::UNINITIALIZED)
.export_values();
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
.value("ADC_CLOCK", slsDetectorDefs::clockIndex::ADC_CLOCK)
.value("DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
.value("RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
.value("SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
.export_values();
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
.value("ANALOG_AND_DIGITAL",
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
.export_values();
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values();
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
.export_values();
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("GET_DETECTOR_MODE",
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value("INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING)
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.export_values();
}

18
python/src/enums_in.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "sls_detector_defs.h"
namespace py = pybind11;
void init_enums(py::module &m) {
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
py::class_<slsDetectorDefs::xy> xy(m, "xy");
xy.def(py::init());
xy.def(py::init<int,int>());
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
[[ENUMS]]
}

View File

@ -1,70 +0,0 @@
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "Detector.h"
#include "sls_detector_defs.h"
#include "typecaster.h"
namespace py = pybind11;
void init_experimental(py::module &m) {
// Experimental API to use the multi directly and inherit from to reduce
// code duplication need to investigate how to handle documentation
using sls::Detector;
using sls::Positions;
py::class_<Detector> multiDetectorApi(m, "multiDetectorApi");
multiDetectorApi
.def(py::init<int>())
// Acq related
.def("acquire", &Detector::acquire)
.def("startReceiver", &Detector::startReceiver, py::arg() = Positions{})
.def("stopReceiver", &Detector::stopReceiver, py::arg() = Positions{})
.def("getAcquiringFlag", &Detector::getAcquiringFlag)
.def("setAcquiringFlag", &Detector::setAcquiringFlag)
.def("getReceiverStatus", &Detector::getReceiverStatus,
py::arg() = Positions{})
// Configuration
.def("free", &Detector::freeSharedMemory)
.def("setConfig", &Detector::setConfig)
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
// Bits and registers
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
py::arg() = Positions{})
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getRegister", &Detector::getRegister, py::arg(),
py::arg() = Positions{})
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
py::arg() = Positions{})
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
py::arg(), py::arg() = Positions{})
// File
.def("getFileName", &Detector::getFileName)
.def("setFileName", &Detector::setFileName, py::arg())
.def("getFilePath", &Detector::getFilePath)
.def("setFilePath", &Detector::setFilePath, py::arg())
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
py::arg() = Positions{})
.def("getFileWrite", &Detector::getFileWrite, py::arg() = Positions{})
.def("setFileOverWrite", &Detector::setFileOverWrite, py::arg(),
py::arg() = Positions{})
.def("getFileOverWrite", &Detector::getFileOverWrite,
py::arg() = Positions{})
// Time
.def("setExptime", &Detector::setExptime, py::arg(),
py::arg() = Positions{})
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
.def("setPeriod", &Detector::setPeriod, py::arg(),
py::arg() = Positions{})
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
py::arg() = Positions{})
.def("getSubExptime", &Detector::getSubExptime,
py::arg() = Positions{});
}

View File

@ -4,7 +4,6 @@
#include <pybind11/stl.h>
#include "Detector.h"
#include "DetectorPythonInterface.h"
#include "Result.h"
#include "mythenFileIO.h"
#include <chrono>
@ -12,20 +11,14 @@
#include "typecaster.h"
// // Add type_typecaster to pybind for our wrapper type
// namespace pybind11 {
// namespace detail {
// template <typename Type, typename Alloc>
// struct type_caster<sls::Result<Type, Alloc>>
// : list_caster<sls::Result<Type, Alloc>, Type> {};
// } // namespace detail
// } // namespace pybind11
using ds = std::chrono::duration<double>;
namespace py = pybind11;
void init_enums(py::module &);
void init_experimental(py::module &);
void init_det(py::module &);
void init_network(py::module &);
PYBIND11_MODULE(_sls_detector, m) {
m.doc() = R"pbdoc(
C/C++ API
@ -38,309 +31,9 @@ PYBIND11_MODULE(_sls_detector, m) {
)pbdoc";
init_enums(m);
init_experimental(m);
py::class_<DetectorPythonInterface> DetectorApi(m, "DetectorApi", R"pbdoc(
Interface to the multiSlsDetector class through Detector.h These functions
are used by the python classes Eiger and Jungfrau and normally it is better
to use them than to directly access functions here.
However it is possible to access these functions...
::
#Using the python class
from sls_detector import Eiger
d = Eiger()
d._api.getThresholdEnergy()
from _sls_detector import DetectorApi
api = DetectorApi(0)
api.getNumberOfFrames()
#But the Pythonic way is almost alway simpler
d = Eiger()
d.n_frames
>> 10
)pbdoc");
DetectorApi.def(py::init<int>())
.def("freeSharedMemory", &DetectorPythonInterface::freeSharedMemory)
.def("getMultiDetectorId", &DetectorPythonInterface::getMultiDetectorId)
.def("acq", &DetectorPythonInterface::acquire)
.def("getAcquiringFlag", &DetectorPythonInterface::getAcquiringFlag)
.def("setAcquiringFlag", &DetectorPythonInterface::setAcquiringFlag)
.def("setAllTrimbits", &DetectorPythonInterface::setAllTrimbits)
.def("getAllTrimbits", &DetectorPythonInterface::getAllTrimbits)
.def("setCounterBit", &DetectorPythonInterface::setCounterBit)
.def("getCounterBit", &DetectorPythonInterface::getCounterBit)
.def("getAdc", &DetectorPythonInterface::getAdc)
.def("getDac", &DetectorPythonInterface::getDac)
.def("getDac_mV", &DetectorPythonInterface::getDac_mV)
.def("setDac", &DetectorPythonInterface::setDac)
.def("setDac_mV", &DetectorPythonInterface::setDac_mV)
.def("getDacFromIndex", &DetectorPythonInterface::getDacFromIndex)
.def("setDacFromIndex", &DetectorPythonInterface::setDacFromIndex)
.def("getDbitPipeline", &DetectorPythonInterface::getDbitPipeline)
.def("setDbitPipeline", &DetectorPythonInterface::setDbitPipeline)
.def("getDbitPhase", &DetectorPythonInterface::getDbitPhase)
.def("setDbitPhase", &DetectorPythonInterface::setDbitPhase)
.def("getDbitClock", &DetectorPythonInterface::getDbitClock)
.def("setDbitClock", &DetectorPythonInterface::setDbitClock)
.def("setThresholdEnergy", &DetectorPythonInterface::setThresholdEnergy)
.def("getThresholdEnergy", &DetectorPythonInterface::getThresholdEnergy)
.def("getSettings", &DetectorPythonInterface::getSettings)
.def("setSettings", &DetectorPythonInterface::setSettings)
.def("getSettingsDir", &DetectorPythonInterface::getSettingsDir)
.def("setSettingsDir", &DetectorPythonInterface::setSettingsDir)
.def("loadTrimbitFile", &DetectorPythonInterface::loadTrimbitFile)
.def("setTrimEnergies", &DetectorPythonInterface::setTrimEnergies)
.def("getTrimEnergies", &DetectorPythonInterface::getTrimEnergies)
.def("pulseChip", &DetectorPythonInterface::pulseChip)
.def("pulseAllPixels", &DetectorPythonInterface::pulseAllPixels)
.def("pulseDiagonal", &DetectorPythonInterface::pulseDiagonal)
.def("getRunStatus", &DetectorPythonInterface::getRunStatus)
.def("readConfigurationFile",
&DetectorPythonInterface::readConfigurationFile)
.def("readParametersFile", &DetectorPythonInterface::readParametersFile)
.def("checkOnline", &DetectorPythonInterface::checkOnline)
.def("setReadoutClockSpeed",
&DetectorPythonInterface::setReadoutClockSpeed)
.def("getReadoutClockSpeed",
&DetectorPythonInterface::getReadoutClockSpeed)
.def("getSyncClkSpeed", &DetectorPythonInterface::getSyncClkSpeed)
.def("getHostname", &DetectorPythonInterface::getHostname)
.def("setHostname", &DetectorPythonInterface::setHostname)
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
.def("isChipPowered", &DetectorPythonInterface::isChipPowered)
.def("powerChip", &DetectorPythonInterface::powerChip)
.def("readRegister", &DetectorPythonInterface::readRegister)
.def("writeRegister", &DetectorPythonInterface::writeRegister)
.def("writeAdcRegister", &DetectorPythonInterface::writeAdcRegister)
.def("setBitInRegister", &DetectorPythonInterface::setBitInRegister)
.def("clearBitInRegister", &DetectorPythonInterface::clearBitInRegister)
.def("setDynamicRange", &DetectorPythonInterface::setDynamicRange)
.def("getDynamicRange", &DetectorPythonInterface::getDynamicRange)
.def("getFirmwareVersion", &DetectorPythonInterface::getFirmwareVersion)
.def("getServerVersion", &DetectorPythonInterface::getServerVersion)
.def("getClientVersion", &DetectorPythonInterface::getClientVersion)
.def("getReceiverVersion", &DetectorPythonInterface::getReceiverVersion)
.def("getDetectorNumber", &DetectorPythonInterface::getDetectorNumber)
.def("getRateCorrection", &DetectorPythonInterface::getRateCorrection)
.def("setRateCorrection", &DetectorPythonInterface::setRateCorrection)
.def("startAcquisition", &DetectorPythonInterface::startAcquisition)
.def("stopAcquisition", &DetectorPythonInterface::stopAcquisition)
.def("startReceiver", &DetectorPythonInterface::startReceiver)
.def("stopReceiver", &DetectorPythonInterface::stopReceiver)
.def("getFilePath",
(std::string(DetectorPythonInterface::*)()) &
DetectorPythonInterface::getFilePath,
"Using multiSlsDetector")
.def("getFilePath",
(std::string(DetectorPythonInterface::*)(int)) &
DetectorPythonInterface::getFilePath,
"File path for individual detector")
.def("setFilePath", (void (DetectorPythonInterface::*)(std::string)) &
DetectorPythonInterface::setFilePath)
.def("setFileName", &DetectorPythonInterface::setFileName)
.def("getFileName", &DetectorPythonInterface::getFileName)
.def("setFileIndex", &DetectorPythonInterface::setFileIndex)
.def("getFileIndex", &DetectorPythonInterface::getFileIndex)
.def("setExposureTime", &DetectorPythonInterface::setExposureTime)
.def("getExposureTime", &DetectorPythonInterface::getExposureTime)
.def("setSubExposureTime", &DetectorPythonInterface::setSubExposureTime)
.def("getSubExposureTime", &DetectorPythonInterface::getSubExposureTime)
.def("setPeriod", &DetectorPythonInterface::setPeriod)
.def("getPeriod", &DetectorPythonInterface::getPeriod)
.def("setSubExposureDeadTime", &DetectorPythonInterface::setSubExposureDeadTime)
.def("getSubExposureDeadTime", &DetectorPythonInterface::getSubExposureDeadTime)
.def("getCycles", &DetectorPythonInterface::getCycles)
.def("setCycles", &DetectorPythonInterface::setCycles)
.def("getNumberOfGates", &DetectorPythonInterface::getNumberOfGates)
.def("setNumberOfGates", &DetectorPythonInterface::setNumberOfGates)
.def("getDelay", &DetectorPythonInterface::getDelay)
.def("setDelay", &DetectorPythonInterface::setDelay)
.def("setStoragecellStart", &DetectorPythonInterface::setStoragecellStart)
.def("getStoragecellStart", &DetectorPythonInterface::getStoragecellStart)
.def("setNumberOfStorageCells", &DetectorPythonInterface::setNumberOfStorageCells)
.def("getNumberOfStorageCells", &DetectorPythonInterface::getNumberOfStorageCells)
.def("getTimingMode", &DetectorPythonInterface::getTimingMode)
.def("setTimingMode", &DetectorPythonInterface::setTimingMode)
.def("getDetectorType", &DetectorPythonInterface::getDetectorType)
.def("setThresholdTemperature", &DetectorPythonInterface::setThresholdTemperature)
.def("getThresholdTemperature", &DetectorPythonInterface::getThresholdTemperature)
.def("setTemperatureControl", &DetectorPythonInterface::setTemperatureControl)
.def("getTemperatureControl", &DetectorPythonInterface::getTemperatureControl)
.def("getTemperatureEvent", &DetectorPythonInterface::getTemperatureEvent)
.def("resetTemperatureEvent", &DetectorPythonInterface::resetTemperatureEvent)
.def("getRxDataStreamStatus", &DetectorPythonInterface::getRxDataStreamStatus)
.def("setRxDataStreamStatus", &DetectorPythonInterface::setRxDataStreamStatus)
// Network stuff
.def("getReceiverHostname",
&DetectorPythonInterface::getReceiverHostname,
py::arg("det_id") = -1)
.def("setReceiverHostname",
&DetectorPythonInterface::setReceiverHostname, py::arg("hostname"),
py::arg("det_id") = -1)
.def("getReceiverStreamingPort",
&DetectorPythonInterface::getReceiverStreamingPort)
.def("setReceiverStreamingPort",
&DetectorPythonInterface::setReceiverStreamingPort)
.def("getReceiverUDPPort", &DetectorPythonInterface::getReceiverUDPPort)
.def("getReceiverUDPPort2",
&DetectorPythonInterface::getReceiverUDPPort2)
.def("setReceiverUDPPort", &DetectorPythonInterface::setReceiverUDPPort)
.def("setReceiverUDPPort2",
&DetectorPythonInterface::setReceiverUDPPort2)
.def("setReceiverUDPIP", &DetectorPythonInterface::setReceiverUDPIP)
.def("getReceiverUDPIP", &DetectorPythonInterface::getReceiverUDPIP)
.def("getReceiverUDPMAC", &DetectorPythonInterface::getReceiverUDPMAC)
.def("setReceiverUDPMAC", &DetectorPythonInterface::setReceiverUDPMAC)
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
.def("configureNetworkParameters",
&DetectorPythonInterface::configureNetworkParameters)
.def("getDelayFrame", &DetectorPythonInterface::getDelayFrame)
.def("setDelayFrame", &DetectorPythonInterface::setDelayFrame)
.def("getDelayLeft", &DetectorPythonInterface::getDelayLeft)
.def("setDelayLeft", &DetectorPythonInterface::setDelayLeft)
.def("getDelayRight", &DetectorPythonInterface::getDelayRight)
.def("setDelayRight", &DetectorPythonInterface::setDelayRight)
.def("getLastClientIP", &DetectorPythonInterface::getLastClientIP)
.def("getReceiverLastClientIP",
&DetectorPythonInterface::getReceiverLastClientIP)
.def("setFramesPerFile", &DetectorPythonInterface::setFramesPerFile)
.def("getFramesPerFile", &DetectorPythonInterface::getFramesPerFile)
.def("setReceiverFifoDepth",
&DetectorPythonInterface::setReceiverFifoDepth)
.def("getReceiverFifoDepth",
&DetectorPythonInterface::getReceiverFifoDepth)
.def("getReceiverFrameDiscardPolicy",
&DetectorPythonInterface::getReceiverFrameDiscardPolicy)
.def("setReceiverFramesDiscardPolicy",
&DetectorPythonInterface::setReceiverFramesDiscardPolicy)
.def("setPartialFramesPadding",
&DetectorPythonInterface::setPartialFramesPadding)
.def("getPartialFramesPadding",
&DetectorPythonInterface::getPartialFramesPadding)
.def("getUserDetails", &DetectorPythonInterface::getUserDetails)
.def("checkDetectorVersionCompatibility",
&DetectorPythonInterface::checkDetectorVersionCompatibility)
.def("checkReceiverVersionCompatibility",
&DetectorPythonInterface::checkReceiverVersionCompatibility)
.def("getMeasuredPeriod", &DetectorPythonInterface::getMeasuredPeriod)
.def("getMeasuredSubPeriod",
&DetectorPythonInterface::getMeasuredSubPeriod)
.def("setFileWrite", &DetectorPythonInterface::setFileWrite)
.def("getFileWrite", &DetectorPythonInterface::getFileWrite)
.def("setFileOverWrite", &DetectorPythonInterface::setFileOverWrite)
.def("getFileOverWrite", &DetectorPythonInterface::getFileOverWrite)
.def("getDacVthreshold", &DetectorPythonInterface::getDacVthreshold)
.def("setDacVthreshold", &DetectorPythonInterface::setDacVthreshold)
.def("setNumberOfFrames", &DetectorPythonInterface::setNumberOfFrames)
.def("getNumberOfFrames", &DetectorPythonInterface::getNumberOfFrames)
// Overloaded calls
.def("getFramesCaughtByReceiver",
(int (DetectorPythonInterface::*)()) &
DetectorPythonInterface::getFramesCaughtByReceiver)
.def("getFramesCaughtByReceiver",
(int (DetectorPythonInterface::*)(int)) &
DetectorPythonInterface::getFramesCaughtByReceiver)
.def("resetFramesCaught", &DetectorPythonInterface::resetFramesCaught)
.def("getReceiverCurrentFrameIndex",
&DetectorPythonInterface::getReceiverCurrentFrameIndex)
.def("getGapPixels", &DetectorPythonInterface::getGapPixels)
.def("setGapPixels", &DetectorPythonInterface::setGapPixels)
.def("getFlippedDataX", &DetectorPythonInterface::getFlippedDataX)
.def("getFlippedDataY", &DetectorPythonInterface::getFlippedDataY)
.def("setFlippedDataX", &DetectorPythonInterface::setFlippedDataX)
.def("setFlippedDataY", &DetectorPythonInterface::setFlippedDataY)
.def("getServerLock", &DetectorPythonInterface::getServerLock)
.def("setServerLock", &DetectorPythonInterface::setServerLock)
.def("getReceiverLock", &DetectorPythonInterface::getReceiverLock)
.def("setReceiverLock", &DetectorPythonInterface::setReceiverLock)
.def("getReadoutFlags", &DetectorPythonInterface::getReadoutFlags)
.def("setReadoutFlag", &DetectorPythonInterface::setReadoutFlag)
.def("setFileFormat", &DetectorPythonInterface::setFileFormat)
.def("getFileFormat", &DetectorPythonInterface::getFileFormat)
.def("getActive", &DetectorPythonInterface::getActive)
.def("setActive", &DetectorPythonInterface::setActive)
.def("getTenGigabitEthernet",
&DetectorPythonInterface::getTenGigabitEthernet)
.def("setTenGigabitEthernet",
&DetectorPythonInterface::setTenGigabitEthernet)
.def("getPatternLoops", &DetectorPythonInterface::getPatternLoops,
py::arg("level"), py::arg("det_id") = -1)
.def("setPatternLoops", &DetectorPythonInterface::setPatternLoops,
py::arg("level"), py::arg("start"), py::arg("stop"), py::arg("n"),
py::arg("det_id") = -1)
.def("setPatternWord", &DetectorPythonInterface::setPatternWord,
py::arg("addr"), py::arg("word"), py::arg("det_id") = -1)
.def("getPatternWord", &DetectorPythonInterface::getPatternWord,
py::arg("addr"), py::arg("det_id") = -1)
.def("setPatternIOControl",
&DetectorPythonInterface::setPatternIOControl, py::arg("word"),
py::arg("det_id") = -1)
.def("setPatternClockControl",
&DetectorPythonInterface::setPatternClockControl, py::arg("word"),
py::arg("det_id") = -1)
.def("setPatternWaitAddr", &DetectorPythonInterface::setPatternWaitAddr,
py::arg("level"), py::arg("addr"), py::arg("det_id") = -1)
.def("getPatternWaitAddr", &DetectorPythonInterface::getPatternWaitAddr,
py::arg("level"), py::arg("det_id") = -1)
.def("setPatternWaitTime", &DetectorPythonInterface::setPatternWaitTime,
py::arg("level"), py::arg("duration"), py::arg("det_id") = -1)
.def("getPatternWaitTime", &DetectorPythonInterface::getPatternWaitTime,
py::arg("level"), py::arg("det_id") = -1)
.def("getImageSize", &DetectorPythonInterface::getImageSize)
.def("setImageSize", &DetectorPythonInterface::setImageSize)
.def("getNumberOfDetectors",
&DetectorPythonInterface::getNumberOfDetectors)
.def("getDetectorGeometry",
&DetectorPythonInterface::getDetectorGeometry);
init_det(m);
init_network(m);
// init_experimental(m);
py::module io = m.def_submodule("io", "Submodule for io");

39
python/src/network.cpp Normal file
View File

@ -0,0 +1,39 @@
/*
This file contains Python bindings for the IpAddr and MacAddr
classes.
*/
#include <pybind11/chrono.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "network_utils.h"
namespace py = pybind11;
using sls::IpAddr;
using sls::MacAddr;
void init_network(py::module &m) {
py::class_ <IpAddr> IpAddr(m, "IpAddr");
IpAddr.def(py::init())
.def(py::init<const std::string&>())
.def(py::init<uint32_t>())
.def("hex", &IpAddr::hex)
.def("uint32", &IpAddr::uint32)
.def(py::self == py::self)
.def("__repr__", &IpAddr::str)
.def("str", &IpAddr::str);
py::class_ <MacAddr> MacAddr(m, "MacAddr");
MacAddr.def(py::init())
.def(py::init<const std::string&>())
.def(py::init<uint64_t>())
.def("hex", &MacAddr::hex)
.def(py::self == py::self)
.def("uint64", &MacAddr::uint64)
.def("__repr__", &MacAddr::str)
.def("str", &MacAddr::str);
}

View File

@ -1,8 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing parameters and methods of the Detector class using mocks
Testing the Detector python class by mocking calls.
Should only be used when there is functionality in
the detector.py file.
An example is converting a mask to a list of set bits.
"""
from unittest.mock import Mock
import pytest
from pytest_mock import mocker
@ -13,459 +18,471 @@ sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
import _sls_detector
from sls_detector.errors import DetectorValueError, DetectorError
from sls_detector.utils import all_equal, element_if_equal
@pytest.fixture
def d():
from sls_detector import Detector
return Detector()
def test_length(d, mocker):
m = mocker.patch('sls_detector.Detector.size')
m.return_value = 5
assert(len(d) == 5)
def test_length_zero(d):
assert len(d) == 0
def test_counters_single(d, mocker):
m = mocker.patch('sls_detector.Detector.getCounterMask')
m.return_value = [7]
assert(d.counters == [0,1,2])
def test_acq_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.acq')
d.acq()
m.assert_called_once_with()
def test_busy_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
m.return_value = False
assert d.busy == False
def test_set_busy(d):
d.busy = True
assert d.busy == True
assert d._api.getAcquiringFlag() == True
d.busy = False
assert d.busy == False
assert d._api.getAcquiringFlag() == False
def test_error_mask(d):
d._api.setErrorMask(1)
assert d.error_mask == 1
d.clear_errors()
def test_error_handling(d):
with pytest.raises(DetectorError):
d._provoke_error()
def test_assign_to_detector_type(d):
with pytest.raises(AttributeError):
d.detector_type = 'Eiger'
def test_det_type(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
m.return_value = 'Eiger'
assert d.detector_type == 'Eiger'
def test_get_exposure_time(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
m.return_value = 100000000
assert d.exposure_time == 0.1
def test_set_exposure_time(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
d.exposure_time = 1.5
m.assert_called_once_with(1500000000)
def test_set_exposure_time_less_than_zero(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setExposureTime')
with pytest.raises(DetectorValueError):
d.exposure_time = -7
def test_get_file_index(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
m.return_value = 8
assert d.file_index == 8
def test_set_file_index(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
d.file_index = 9
m.assert_called_with(9)
def file_index_with_no_detector(d):
assert d.file_index == -100
def dr_with_no_detector(d):
assert d.dynamic_range == -100
def test_set_file_index_raises_on_neg(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setFileIndex')
with pytest.raises(ValueError):
d.file_index = -9
def test_get_file_name(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getFileName')
d.file_name
m.assert_called_once_with()
def test_set_file_name(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setFileName')
d.file_name = 'hej'
m.assert_called_once_with('hej')
def test_get_file_path(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
d.file_path
m.assert_called_once_with()
def test_set_file_path_when_path_exists(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.exists')
mock_os.return_value = True
d.file_path = '/path/to/something/'
m.assert_called_once_with('/path/to/something/')
def test_set_file_path_raises_when_not_exists(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setFilePath')
mock_os = mocker.patch('os.path.exists')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.file_path = '/path/to/something/'
def test_get_file_write(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
m.return_value = False
assert d.file_write == False
def test_set_file_write(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
d.file_write = True
m.assert_called_once_with(True)
def test_get_firmware_version(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
m.return_value = 20
assert d.firmware_version == 20
def test_cannot_set_fw_version(d):
with pytest.raises(AttributeError):
d.firmware_version = 20
def test_get_high_voltage_call_signature(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDac')
d.high_voltage
m.assert_called_once_with('vhighvoltage', -1)
def test_get_high_voltage(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDac')
m.return_value = 80
assert d.high_voltage == 80
#self._api.setDac('vhighvoltage', -1, voltage)
def test_set_high_voltage(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setDac')
d.high_voltage = 80
m.assert_called_once_with('vhighvoltage', -1, 80)
def test_decode_hostname_two_names(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
m.return_value = 'beb059+beb048+'
assert d.hostname == ['beb059', 'beb048']
def test_decode_hostname_four_names(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
m.return_value = 'beb059+beb048+beb120+beb153+'
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
def test_decode_hostname_blank(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
m.return_value = ''
assert d.hostname == []
def test_get_image_size_gives_correct_size(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
m.return_value = (512,1024)
im_size = d.image_size
assert im_size.rows == 512
assert im_size.cols == 1024
def test_load_config(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = True
d.load_config('/path/to/my/file.config')
m.assert_called_once_with('/path/to/my/file.config')
def test_load_config_raises_when_file_is_not_found(d, mocker):
mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.load_config('/path/to/my/file.config')
def test_load_parameters(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = True
d.load_parameters('/path/to/my/file.par')
m.assert_called_once_with('/path/to/my/file.par')
def test_load_parameters_raises_when_file_is_not_found(d, mocker):
mocker.patch('_sls_detector.DetectorApi.readParametersFile')
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.load_parameters('/path/to/my/file.par')
#getDetectorGeometry
def test_get_module_geometry_gives_correct_size(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
m.return_value = (13,7)
g = d.module_geometry
assert g.vertical == 7
assert g.horizontal == 13
def test_get_module_geometry_access(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
m.return_value = (12,3)
assert d.module_geometry[0] == 12
assert d.module_geometry[1] == 3
assert d.module_geometry.vertical == 3
assert d.module_geometry.horizontal == 12
def test_module_geometry_without_detectors(d):
t = d.module_geometry
assert t.horizontal == 0
assert t.vertical == 0
def test_get_n_frames(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
m.return_value = 3
assert d.n_frames == 3
def test_set_n_frames(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
d.n_frames = 9
m.assert_called_once_with(9)
def test_nframes_without_detector(d):
assert d.n_frames == -100
def test_set_n_frames_raises_on_neg(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
with pytest.raises(DetectorValueError):
d.n_frames = -1
def test_set_n_frames_raises_on_zero(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
with pytest.raises(DetectorValueError):
d.n_frames = 0
def test_n_cycles_without_detector(d):
assert d.n_cycles == -100
def test_set_n_cycles_raises_on_zero(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setCycles')
with pytest.raises(DetectorValueError):
d.n_cycles = 0
def test_set_n_cycles(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setCycles')
d.n_cycles = 56
m.assert_called_once_with(56)
def test_n_measurements_without_detector(d):
assert d.n_measurements == -100
def test_set_n_measurements_raises_on_zero(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
with pytest.raises(DetectorValueError):
d.n_measurements = 0
def test_set_n_measurements(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
d.n_measurements = 560
m.assert_called_once_with(560)
def test_get_n_modules_no_detector(d):
assert d.n_modules == 0
def test_get_n_modules(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
m.return_value = 12
assert d.n_modules == 12
def test_get_period_time(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
m.return_value = 130000000
assert d.period == 0.13
def test_set_period_time(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
d.period = 1.953
m.assert_called_once_with(1953000000)
def test_set_period_time_less_than_zero(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setPeriod')
with pytest.raises(ValueError):
d.period = -7
def test_get_online(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getOnline')
d.online
m.assert_called_once_with()
def test_set_online(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setOnline')
d.online = True
m.assert_called_once_with(True)
def test_last_client_ip_no_detector(d):
assert d.last_client_ip == ''
def test_last_cliten_ip_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getLastClientIP')
d.last_client_ip
m.assert_called_once_with()
#-------------------------------------------------------------Rate correction
def test_get_rate_correction(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
m.return_value = [132,129]
assert d.rate_correction == [132,129]
def test_set_rate_correction(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
mock_n.return_value = 3
d.rate_correction = [123,90,50]
m.assert_called_once_with([123,90,50])
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
mock_n.return_value = 4
with pytest.raises(ValueError):
d.rate_correction = [123,90,50]
#----------------------------------------------------------------Readout clock
def test_get_readout_clock_0(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
m.return_value = 0
assert d.readout_clock == 'Full Speed'
def test_get_readout_clock_1(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
m.return_value = 1
assert d.readout_clock == 'Half Speed'
def test_get_readout_clock_2(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
m.return_value = 2
assert d.readout_clock == 'Quarter Speed'
def test_get_readout_clock_3(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
m.return_value = 3
assert d.readout_clock == 'Super Slow Speed'
def test_set_readout_clock_0(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Full Speed'
m.assert_called_once_with(0)
def test_set_readout_clock_1(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Half Speed'
m.assert_called_once_with(1)
def test_set_readout_clock_2(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Quarter Speed'
m.assert_called_once_with(2)
def test_set_readout_clock_3(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Super Slow Speed'
m.assert_called_once_with(3)
#----------------------------------------------------------------rx_datastream
def test_get_rx_datastream(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
m.return_value = False
assert d.rx_datastream == False
def test_set_rx_datastream(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
d.rx_datastream = True
m.assert_called_once_with(True)
def test_get_rx_zmqip(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
d.rx_zmqip
m.assert_called_once_with('rx_zmqip')
def test_get_rx_zmqport_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
d.rx_zmqport
m.assert_called_once_with('rx_zmqport')
def test_get_rx_zmqport_decode(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
m.return_value = ['30001', '30003']
assert d.rx_zmqport == [30001, 30003]
def test_get_rx_zmqport_empty(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
m.return_value = ''
assert d.rx_zmqport == []
#--------------------------------------------------------------------status
def test_status_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
d.status
m.assert_called_once_with()
def test_start_detecor(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
d.start_detector()
m.assert_called_once_with()
def test_stop_acq_call(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
d.stop_detector()
m.assert_called_once_with()
#------------------------------------------------------------------timing mode
def test_get_timing_mode(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
d.timing_mode
m.assert_called_once_with()
def test_set_timing_mode(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
d.timing_mode = 'auto'
m.assert_called_once_with('auto')
#----------------------------------------------------------------vthreshold
def test_get_vthreshold(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.getDac')
d.vthreshold
m.assert_called_once_with('vthreshold', -1)
def test_set_vthreshold(d, mocker):
m = mocker.patch('_sls_detector.DetectorApi.setDac')
d.vthreshold = 1675
m.assert_called_once_with('vthreshold', -1, 1675)
def test_counters_multi(d, mocker):
m = mocker.patch('sls_detector.Detector.getCounterMask')
m.return_value = [7, 9]
assert(d.counters == [[0,1,2],[0,3]])
def test_set_counters_single(d, mocker):
m = mocker.patch('sls_detector.Detector.setCounterMask')
d.counters = [0,2]
m.assert_called_once_with(5)
# def test_busy_call(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
# m.return_value = False
# assert d.busy == False
# def test_set_busy(d):
# d.busy = True
# assert d.busy == True
# assert d._api.getAcquiringFlag() == True
# d.busy = False
# assert d.busy == False
# assert d._api.getAcquiringFlag() == False
# def test_error_mask(d):
# d._api.setErrorMask(1)
# assert d.error_mask == 1
# d.clear_errors()
# def test_error_handling(d):
# with pytest.raises(DetectorError):
# d._provoke_error()
# def test_assign_to_detector_type(d):
# with pytest.raises(AttributeError):
# d.detector_type = 'Eiger'
# def test_det_type(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
# m.return_value = 'Eiger'
# assert d.detector_type == 'Eiger'
# def test_get_exposure_time(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
# m.return_value = 100000000
# assert d.exposure_time == 0.1
# def test_set_exposure_time(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
# d.exposure_time = 1.5
# m.assert_called_once_with(1500000000)
# def test_set_exposure_time_less_than_zero(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setExposureTime')
# with pytest.raises(DetectorValueError):
# d.exposure_time = -7
# def test_get_file_index(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
# m.return_value = 8
# assert d.file_index == 8
# def test_set_file_index(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
# d.file_index = 9
# m.assert_called_with(9)
# def file_index_with_no_detector(d):
# assert d.file_index == -100
# def dr_with_no_detector(d):
# assert d.dynamic_range == -100
# def test_set_file_index_raises_on_neg(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setFileIndex')
# with pytest.raises(ValueError):
# d.file_index = -9
# def test_get_file_name(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getFileName')
# d.file_name
# m.assert_called_once_with()
# def test_set_file_name(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setFileName')
# d.file_name = 'hej'
# m.assert_called_once_with('hej')
# def test_get_file_path(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
# d.file_path
# m.assert_called_once_with()
# def test_set_file_path_when_path_exists(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.exists')
# mock_os.return_value = True
# d.file_path = '/path/to/something/'
# m.assert_called_once_with('/path/to/something/')
# def test_set_file_path_raises_when_not_exists(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setFilePath')
# mock_os = mocker.patch('os.path.exists')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.file_path = '/path/to/something/'
# def test_get_file_write(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
# m.return_value = False
# assert d.file_write == False
# def test_set_file_write(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
# d.file_write = True
# m.assert_called_once_with(True)
# def test_get_firmware_version(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
# m.return_value = 20
# assert d.firmware_version == 20
# def test_cannot_set_fw_version(d):
# with pytest.raises(AttributeError):
# d.firmware_version = 20
# def test_get_high_voltage_call_signature(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
# d.high_voltage
# m.assert_called_once_with('vhighvoltage', -1)
# def test_get_high_voltage(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
# m.return_value = 80
# assert d.high_voltage == 80
# #self._api.setDac('vhighvoltage', -1, voltage)
# def test_set_high_voltage(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
# d.high_voltage = 80
# m.assert_called_once_with('vhighvoltage', -1, 80)
# def test_decode_hostname_two_names(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
# m.return_value = 'beb059+beb048+'
# assert d.hostname == ['beb059', 'beb048']
# def test_decode_hostname_four_names(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
# m.return_value = 'beb059+beb048+beb120+beb153+'
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
# def test_decode_hostname_blank(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
# m.return_value = ''
# assert d.hostname == []
# def test_get_image_size_gives_correct_size(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
# m.return_value = (512,1024)
# im_size = d.image_size
# assert im_size.rows == 512
# assert im_size.cols == 1024
# def test_load_config(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = True
# d.load_config('/path/to/my/file.config')
# m.assert_called_once_with('/path/to/my/file.config')
# def test_load_config_raises_when_file_is_not_found(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.load_config('/path/to/my/file.config')
# def test_load_parameters(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = True
# d.load_parameters('/path/to/my/file.par')
# m.assert_called_once_with('/path/to/my/file.par')
# def test_load_parameters_raises_when_file_is_not_found(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.readParametersFile')
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.load_parameters('/path/to/my/file.par')
# #getDetectorGeometry
# def test_get_module_geometry_gives_correct_size(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
# m.return_value = (13,7)
# g = d.module_geometry
# assert g.vertical == 7
# assert g.horizontal == 13
# def test_get_module_geometry_access(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
# m.return_value = (12,3)
# assert d.module_geometry[0] == 12
# assert d.module_geometry[1] == 3
# assert d.module_geometry.vertical == 3
# assert d.module_geometry.horizontal == 12
# def test_module_geometry_without_detectors(d):
# t = d.module_geometry
# assert t.horizontal == 0
# assert t.vertical == 0
# def test_get_n_frames(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
# m.return_value = 3
# assert d.n_frames == 3
# def test_set_n_frames(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
# d.n_frames = 9
# m.assert_called_once_with(9)
# def test_nframes_without_detector(d):
# assert d.n_frames == -100
# def test_set_n_frames_raises_on_neg(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
# with pytest.raises(DetectorValueError):
# d.n_frames = -1
# def test_set_n_frames_raises_on_zero(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
# with pytest.raises(DetectorValueError):
# d.n_frames = 0
# def test_n_cycles_without_detector(d):
# assert d.n_cycles == -100
# def test_set_n_cycles_raises_on_zero(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setCycles')
# with pytest.raises(DetectorValueError):
# d.n_cycles = 0
# def test_set_n_cycles(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setCycles')
# d.n_cycles = 56
# m.assert_called_once_with(56)
# def test_n_measurements_without_detector(d):
# assert d.n_measurements == -100
# def test_set_n_measurements_raises_on_zero(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
# with pytest.raises(DetectorValueError):
# d.n_measurements = 0
# def test_set_n_measurements(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
# d.n_measurements = 560
# m.assert_called_once_with(560)
# def test_get_n_modules_no_detector(d):
# assert d.n_modules == 0
# def test_get_n_modules(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
# m.return_value = 12
# assert d.n_modules == 12
# def test_get_period_time(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
# m.return_value = 130000000
# assert d.period == 0.13
# def test_set_period_time(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
# d.period = 1.953
# m.assert_called_once_with(1953000000)
# def test_set_period_time_less_than_zero(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setPeriod')
# with pytest.raises(ValueError):
# d.period = -7
# def test_get_online(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getOnline')
# d.online
# m.assert_called_once_with()
# def test_set_online(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setOnline')
# d.online = True
# m.assert_called_once_with(True)
# def test_last_client_ip_no_detector(d):
# assert d.last_client_ip == ''
# def test_last_cliten_ip_call(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getLastClientIP')
# d.last_client_ip
# m.assert_called_once_with()
# #-------------------------------------------------------------Rate correction
# def test_get_rate_correction(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
# m.return_value = [132,129]
# assert d.rate_correction == [132,129]
# def test_set_rate_correction(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
# mock_n.return_value = 3
# d.rate_correction = [123,90,50]
# m.assert_called_once_with([123,90,50])
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
# mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
# mock_n.return_value = 4
# with pytest.raises(ValueError):
# d.rate_correction = [123,90,50]
# #----------------------------------------------------------------Readout clock
# def test_get_readout_clock_0(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
# m.return_value = 0
# assert d.readout_clock == 'Full Speed'
# def test_get_readout_clock_1(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
# m.return_value = 1
# assert d.readout_clock == 'Half Speed'
# def test_get_readout_clock_2(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
# m.return_value = 2
# assert d.readout_clock == 'Quarter Speed'
# def test_get_readout_clock_3(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
# m.return_value = 3
# assert d.readout_clock == 'Super Slow Speed'
# def test_set_readout_clock_0(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Full Speed'
# m.assert_called_once_with(0)
# def test_set_readout_clock_1(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Half Speed'
# m.assert_called_once_with(1)
# def test_set_readout_clock_2(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Quarter Speed'
# m.assert_called_once_with(2)
# def test_set_readout_clock_3(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Super Slow Speed'
# m.assert_called_once_with(3)
# #----------------------------------------------------------------rx_datastream
# def test_get_rx_datastream(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
# m.return_value = False
# assert d.rx_datastream == False
# def test_set_rx_datastream(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
# d.rx_datastream = True
# m.assert_called_once_with(True)
# def test_get_rx_zmqip(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
# d.rx_zmqip
# m.assert_called_once_with('rx_zmqip')
# def test_get_rx_zmqport_call(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
# d.rx_zmqport
# m.assert_called_once_with('rx_zmqport')
# def test_get_rx_zmqport_decode(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
# m.return_value = ['30001', '30003']
# assert d.rx_zmqport == [30001, 30003]
# def test_get_rx_zmqport_empty(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
# m.return_value = ''
# assert d.rx_zmqport == []
# #--------------------------------------------------------------------status
# def test_status_call(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
# d.status
# m.assert_called_once_with()
# def test_start_detecor(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
# d.start_detector()
# m.assert_called_once_with()
# def test_stop_acq_call(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
# d.stop_detector()
# m.assert_called_once_with()
# #------------------------------------------------------------------timing mode
# def test_get_timing_mode(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
# d.timing_mode
# m.assert_called_once_with()
# def test_set_timing_mode(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
# d.timing_mode = 'auto'
# m.assert_called_once_with('auto')
# #----------------------------------------------------------------vthreshold
# def test_get_vthreshold(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
# d.vthreshold
# m.assert_called_once_with('vthreshold', -1)
# def test_set_vthreshold(d, mocker):
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
# d.vthreshold = 1675
# m.assert_called_once_with('vthreshold', -1, 1675)

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing parameters and methods of the Detector class using mocks
Testing functions from utils.py
"""
import pytest
from sls_detector.utils import eiger_register_to_time
from sls_detector.utils import all_equal, element_if_equal
from sls_detector.utils import *
def test_convert_zero():
assert eiger_register_to_time(0) == 0
@ -47,4 +47,16 @@ def test_element_if_equal_str():
assert element_if_equal('hhh') == 'h'
def test_element_if_equal_int_fails():
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
def test_get_set_bits():
assert(get_set_bits(0) == [])
assert get_set_bits(7) == [0, 1, 2]
def test_list_to_mask():
assert(list_to_bitmask([0,1,2]) == 7)
assert(list_to_bitmask([]) == 0)
assert(list_to_bitmask([0]) == 1)
assert(list_to_bitmask([1]) == 2)
assert(list_to_bitmask([3]) == 8)
assert(list_to_bitmask([1,1,1]) == 2)

View File

@ -47,7 +47,7 @@ using std::chrono::seconds;
int main() {
Detector d;
d.setConfig("/home/l_frojdh/virtual.config");
// d.setConfig("/home/l_frojdh/virtual.config");
// d.setExptime(nanoseconds(500)); // set exptime of all modules
// auto t0 = d.getExptime();

46
sample/time.cpp Normal file
View File

@ -0,0 +1,46 @@
#include <chrono>
#include <iostream>
#include <string>
#include <memory>
#include "Result.h"
#include "Detector.h"
#include "container_utils.h"
#include "ToString.h"
#include <algorithm>
std::chrono::nanoseconds to_nano(double val, const std::string &unit) {
if (unit == "us")
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double, std::micro>(val));
else if (unit == "ms")
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double, std::milli>(val));
else if (unit == "s")
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::duration<double>(val));
}
int main() {
// std::cout << "5.8 us is " << to_nano(5.8, "us").count() << " ns\n";
// std::cout << "7 ms is " << to_nano(7, "ms").count() << " ns\n";
// std::cout << "3.123 s is " << to_nano(3.123, "s").count() << " ns\n";
// sls::Result<int> res{1,0,6,4,0,4};
// std::unique_ptr<sls::Detector>
auto d = sls::make_unique<sls::Detector>(0);
std::cout << d->getHostname() << "\n";
auto s= sls::ToString(d->getHostname());
std::cout << s << "\n";
std::string str;
for (const auto& s : d->getHostname())
str += s;
std::cout << str << "\n";
}

View File

@ -1,38 +1,43 @@
/** Examples on how to use Result<T> */
#include "Result.h"
#include "ToString.h"
#include <algorithm>
#include <iostream>
auto main() -> int {
using sls::Result;
using sls::ToString;
using sls::Result; // declared in namespace sls
using sls::ToString;
auto main() -> int {
std::cout << "Examples on usage of Result<T>\n";
// Result exposes the underlying constructors of std::vector
Result<int> res{1, 2, 3, 4, 5};
/** Constructing Result<T> can be done in the same way as vectors */
Result<int> res{1, 2, 3, 4, 5};
std::cout << "res: " << res << '\n';
Result<double> res2(5, 3.7);
std::cout << "res2: " << res2 << '\n';
// and can be converted to and from a vector. However, the
// conversion to a vector is not efficient since a copy is made
// and should only be done when a vector is needed for further use
// in most sense and in standard algorithms Result<T> behaves as a
// vector.
/** and Result can be converted to and from a vector. However, the
* conversion to a vector is not efficient since a copy is made
* and should only be done when a vector is needed for further use
* in most cases Result behaved as a vector, for example with standard
* algorithms */
std::vector<int> vec(5, 5);
std::cout << "vec: " << ToString(vec) << "\n";
//Result from vector
Result<int> res3 = vec;
std::cout << "res3: " << res3 << '\n';
// Vector from Result
std::vector<int> vec2 = res3;
std::cout << "vec2: " << ToString(vec2) << "\n";
// Using squash we can also convert to a single value
// Using squash we can convert to a single value
std::cout << "res.squash(): " << res.squash() << '\n';
std::cout << "res3.squash(): " << res3.squash() << '\n';
@ -40,11 +45,17 @@ auto main() -> int {
std::cout << "res.squash(-1): " << res.squash(-1) << '\n';
std::cout << "res3.squash(-1): " << res3.squash(-1) << '\n';
std::vector<int> ivec{1, 3, 5};
Result<int> ivec{1, 3, 5};
Result<sls::time::ns> nres(ivec);
// for (const auto& i : ivec)
// nres.push_back(sls::time::ns(i));
std::cout << "nres: " << sls::ToString(nres) << '\n';
//
/* Convert from Result<int> to Result<bool> */
Result<int> int_result{0, 1, 0, 3, -5};
Result<bool> bool_result{int_result};
std::cout << bool_result << '\n';
// Result can be printed using <<
Result<std::string> string_res{"ein", "zwei", "drei"};
std::cout << string_res << '\n';
}

View File

@ -31,18 +31,19 @@ class MovingStat
*/
void Set(double val, double rms=0, int m=-1)
{
if (m>=0) m_n = m; else m_n = n;
if (m>0) m_n = m; else m_n = n;
m_newM=val*m_n;
// cout << "set " << val << " " << m << " " << m_n << " " << m_newM << endl;
SetRMS(rms);
}
/**
/**
clears the moving average number of samples parameter, mean and standard deviation
*/
void SetRMS(double rms)
{
if (rms<=0) {
m_newM2=m_newM*m_newM/n;
m_n=0;
//m_n=0;
} else {
if (m_n>0)
m_newM2=(m_n*rms*rms+m_newM*m_newM/m_n);
@ -120,6 +121,7 @@ class MovingStat
*/
inline double Mean() const
{
// cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n << endl;
return (m_n > 0) ? m_newM/m_n : 0.0;
}

View File

@ -62,7 +62,7 @@ template <class dataType> class analogDetector {
analogDetector(slsDetectorData<dataType> *d, int sign=1,
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), iframe(-1), dataSign(sign), gmap(gm), ghSum(gs), id(0) {
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), dataSign(sign), iframe(-1), gmap(gm), ghSum(gs), id(0) {
if (det)
det->getDetectorSize(nx,ny);
@ -154,8 +154,15 @@ template <class dataType> class analogDetector {
hs9=(TH2F*)(orig->hs9)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
#endif
#endif
if (orig->cmSub) cmSub=(orig->cmSub)->Clone();
if (orig->ghSum) ghSum=(orig->ghSum)->Clone();
if (orig->cmSub) {
cmSub=(orig->cmSub)->Clone();
cout <<"cloning cm" << endl;
}
else cmSub=NULL;
if (orig->ghSum) {
ghSum=(orig->ghSum)->Clone();
cout <<"cloning gs" << endl;
}
else ghSum=NULL;
}
@ -224,9 +231,10 @@ template <class dataType> class analogDetector {
if (gm) {
if (gmap) delete [] gmap;
gmap=new double[nnx*nny];
for (int iy=0; iy<nny; iy++) {
for (int ix=0; ix<nnx; ix++) {
for (int iy=0; iy<nny; iy++) {
for (int ix=0; ix<nnx; ix++) {
gmap[iy*nnx+ix]=gm[iy*nnx+ix];
// cout << gmap[iy*nnx+ix] << " " ;
}
}
return gmap;
@ -280,7 +288,12 @@ template <class dataType> class analogDetector {
virtual void newFrame(){iframe++; if (cmSub) cmSub->newFrame();};
/** resets the commonModeSubtraction and increases the frame index */
virtual void newFrame(char *data){iframe++; if (cmSub) cmSub->newFrame(); calcGhost(data);};
virtual void newFrame(char *data){
iframe++;
if (cmSub) cmSub->newFrame();
calcGhost(data);
// cout << getId() << " Calc ghost " << getGhost(15,15) << endl;
};
/** sets the commonModeSubtraction algorithm to be used
@ -315,7 +328,7 @@ template <class dataType> class analogDetector {
\param iy pixel y coordinate
\param cm 1 adds the value to common mod, 0 skips it. Defaults to 0. - not properly implemented
*/
virtual void addToPedestal(double val, int ix, int iy=0, int cm=0){
virtual void addToPedestal(double val, int ix, int iy, int cm=0){
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
// cout << val << " " ;
@ -335,15 +348,17 @@ template <class dataType> class analogDetector {
}
double getCommonMode(int ix, int iy) {
if (cmSub) return cmSub->getCommonMode(ix, iy);
else return 0;
if (cmSub) {
return cmSub->getCommonMode(ix, iy);
}
return 0;
}
virtual void addToCommonMode(char *data){
// cout << "+"<< endl;
// cout << "+"<< getId() << endl;
if (cmSub) {
// cout << "*" << endl;
//cout << "*" << endl;
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
// if (getNumpedestals(ix,iy)>0)
@ -358,12 +373,22 @@ template <class dataType> class analogDetector {
}
virtual void addToCommonMode(char *data, int ix, int iy=0){
// cout <<".";
if (cmSub) {
//cout <<":";
if (det) if (det->isGood(ix, iy)==0) return;
if (getNumpedestals(ix,iy)>0){
cmSub->addToCommonMode(subtractPedestal(data,ix,iy,0), ix, iy);
// cout << ":";
// cout << ix << " " <<" " << iy << subtractPedestal(data,ix,iy,0) << endl;
double val;
if (det) {
/* if (det->getChannel(data, ix, iy)>=0x3fff) */
/* cout << ix << " " << iy << " " << det->getChannel(data, ix, iy) <<endl; */
val= (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,0));
} else
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy));
val+=getGhost(ix,iy);
cmSub->addToCommonMode(val, ix, iy);
//cout << ":";
}
}
}
@ -375,11 +400,12 @@ template <class dataType> class analogDetector {
\returns pedestal value
*/
virtual double getPedestal (int ix, int iy, int cm=0){
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
if (cmSub && cm>0)
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
if (cmSub && cm>0) {
return stat[iy][ix].getPedestal()+getCommonMode(ix,iy);
else return stat[iy][ix].getPedestal();
else return -1;
} else return stat[iy][ix].getPedestal();
} else return -1;
};
@ -390,15 +416,22 @@ template <class dataType> class analogDetector {
\returns pedestal rms
*/
virtual double getPedestalRMS(int ix, int iy){
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
return stat[iy][ix].getPedestalRMS();
else return -1;
double g=1;
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
if (gmap) {
g=gmap[iy*nx+ix];
if (g==0) g=-1.;
}
return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
}
return -1;
};
virtual int getNumpedestals(int ix, int iy){
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
return stat[iy][ix].getNumpedestals();
else return -1;
return -1;
};
/**
gets pedestal (and common mode)
@ -410,10 +443,10 @@ template <class dataType> class analogDetector {
virtual double* getPedestal(double *ped){
if (ped==NULL)
ped=new double[nx*ny];
for (int iy=0; iy<ny; iy++) {
for (int ix=0; ix<nx; ix++) {
for (int iy=0; iy<ny; iy++) {
for (int ix=0; ix<nx; ix++) {
ped[iy*nx+ix]=stat[iy][ix].getPedestal();
//cout << ped[iy*nx+ix] << " " ;
//cout << ped[iy*nx+ix] << " " ;
}
}
return ped;
@ -468,13 +501,14 @@ template <class dataType> class analogDetector {
*/
virtual void setPedestal(double *ped, double *rms=NULL, int m=-1){
double rr=0;
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
if (rms) rr=rms[iy*nx+ix];
stat[iy][ix].setPedestal(ped[iy*nx+ix],rr, m);
// cout << ix << " " << iy << " " << ped[iy*nx+ix] << " " << stat[iy][ix].getPedestal() << endl;
};
};
}
@ -505,10 +539,24 @@ template <class dataType> class analogDetector {
}
virtual void calcGhost(char *data, int ix, int iy=1) {if (ghSum) ghSum->calcGhost(data, ix, iy);};
virtual void calcGhost(char *data, int ix, int iy=1) {
if (ghSum) {
ghSum->calcGhost(data, ix, iy);
}
};
virtual void calcGhost(char *data){if (ghSum) ghSum->calcGhost(data);};
virtual double getGhost(int ix, int iy) {if (ghSum) return ghSum->getGhost(ix, iy); return 0;};
virtual void calcGhost(char *data){if (ghSum) {
ghSum->calcGhost(data);
// cout << getId() << " @ " << ghSum->getXTalk() << " " << ghSum->getGhost(15,15) << endl;
}
};
virtual double getGhost(int ix, int iy) {if (ghSum) return ghSum->getGhost(ix, iy); return 0;};
/**
write 32bit tiff file with detector image data
@ -716,20 +764,21 @@ template <class dataType> class analogDetector {
virtual void addToPedestal(char *data, int cm=0) {
// cout << "add to pedestal " << endl;
// cout << "add to pedestal " << endl;
newFrame(data);
//calcGhost(data);
if (cmSub && cm) {
// cout <<",";
addToCommonMode(data);
}
}
//cout << xmin << " " << xmax << endl;
// cout << ymin << " " << ymax << endl;
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy)) {
// addToPedestal(data,ix,iy,1);
addToPedestal(data,ix,iy,cm);
@ -812,7 +861,7 @@ template <class dataType> class analogDetector {
*/
virtual void addToPedestal(char *data, int ix, int iy=0, int cm=0) {
virtual void addToPedestal(char *data, int ix, int iy, int cm=0) {
double val;
@ -880,7 +929,7 @@ template <class dataType> class analogDetector {
virtual double subtractPedestal(char *data, int ix, int iy=0, int cm=0) {
double g=1.;
double val;
double val =0;
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
if (gmap) {
g=gmap[iy*nx+ix];
@ -893,7 +942,10 @@ template <class dataType> class analogDetector {
val= (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,cm))/g;
} else
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy))/g;
//if (val>=0.5*thr)
// cout << val << " " << (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,cm)) << " " << g << " ";
val+=getGhost(ix,iy)/g;
#ifdef ROOTSPECTRUM
@ -927,6 +979,7 @@ template <class dataType> class analogDetector {
#endif
return val;
}
return val;
};
@ -954,8 +1007,7 @@ template <class dataType> class analogDetector {
int nph=0;
double v;
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
v=subtractPedestal(data,ix,iy);
v=subtractPedestal(data,ix,iy,1);
/* // cout << v << " " ; */
/* #ifdef ROOTSPECTRUM */
/* // cout << (iy-ymin)*(xmax-xmin)+(ix-xmin) << endl; */
@ -964,8 +1016,14 @@ template <class dataType> class analogDetector {
if (thr>0) {
v+=0.5*thr;
nph=v/thr;
if (nph>0)
/* if (ix ==10 && iy<20) */
/* cout << det->getValue(data,ix,iy) << " " << stat[iy][ix].getPedestal() << " " << getCommonMode(ix,iy) << " " << getPedestal(ix,iy,0)<< " " << getPedestal(ix,iy,1) << endl; */
// cout << subtractPedestal(data,ix,iy,0) << " " << subtractPedestal(data,ix,iy,1) << " " << nph << endl;
if (nph>0) {
//cout << " " << nph << endl;
return nph;
}
return 0;
}
return v;
@ -981,15 +1039,16 @@ template <class dataType> class analogDetector {
*/
int *getNPhotons(char *data, int *nph=NULL) {
double val;
//double val;
if (nph==NULL)
nph=image;
newFrame(data);
//calcGhost(data);
addToCommonMode(data);
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy))
nph[iy*nx+ix]+=getNPhotons(data, ix, iy);
}
@ -1094,7 +1153,7 @@ template <class dataType> class analogDetector {
switch(fMode) {
case ePedestal:
//cout << "analog ped " << endl;
addToPedestal(data);
addToPedestal(data,1);
break;
default:
// cout << "analog " << endl;

View File

@ -14,7 +14,7 @@ class commonModeSubtraction {
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
*/
commonModeSubtraction(int iroi=1, int ns=3) : nROI(iroi), nsigma(ns) {
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
mean=new double[nROI];
mean2=new double[nROI];
nCm=new double[nROI];
@ -28,7 +28,7 @@ class commonModeSubtraction {
/* } */
virtual commonModeSubtraction *Clone() {
new commonModeSubtraction(this->nROI, this->nsigma);
return new commonModeSubtraction(this->nROI, this->nsigma);
}
/** clears the moving average and the sum of pedestals calculation - virtual func*/
@ -41,6 +41,7 @@ class commonModeSubtraction {
/** adds the average of pedestals to the moving average and reinitializes the calculation of the sum of pedestals for all ROIs. - virtual func*/
virtual void newFrame(){
//cout << "Reset CM" << endl;
for (int i=0; i<nROI; i++) {
// if (nCm[i]>0) cmStat[i].Calc(cmPed[i]/nCm[i]);
nCm[i]=0;
@ -60,6 +61,7 @@ class commonModeSubtraction {
// else val=-100;
// if (isc>=0 && isc<nROI) {
// cout << ix << " " << iy << " " << iroi << endl;
//if (ix==15 && iy==15) cout << "=" << val << endl;
if (iroi>=0 && iroi<nROI) {
// cout << ix << " " << iy << " " << iroi << endl;
mean[iroi]+=val;
@ -80,6 +82,7 @@ class commonModeSubtraction {
/* else */
/* return -100; */
// cout << "*" << ix << " " << iy << " " << iroi << " " << mean[iroi] << " " << nCm[iroi]<< endl;
// if (ix==15 && iy==15) cout << "-" << mean[iroi]/nCm[iroi] << endl;
if (iroi>=0 && iroi<nROI) {
if (nCm[iroi]>0)
return mean[iroi]/nCm[iroi];

View File

@ -45,7 +45,7 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
// off=0;
int iarg;
//int iarg;
int64_t word, *wp;
short unsigned int* val=new short unsigned int[nch];
int bit[64];

View File

@ -49,7 +49,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
// off=0;
int iarg;
//int iarg;
int64_t word, *wp;
short unsigned int* val=new short unsigned int[nch];
int bit[64];
@ -57,7 +57,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
int ioff=0;
int idr=0;
int ib=0;
int ich=0;
//int ich=0;
int ii=0;
int iw=0;
bit[0]=17;//19;

View File

@ -8,9 +8,9 @@ class deserializer : public slsDetectorData<int> {
public:
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
@ -51,7 +51,7 @@ class deserializer : public slsDetectorData<int> {
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
// off=0;
int iarg;
//int iarg;
int64_t word, *wp;
int* val=new int[nch];
int ioff=0;
@ -107,10 +107,10 @@ class deserializer : public slsDetectorData<int> {
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
// off=0;
int iarg;
int64_t word;
//int iarg;
// int64_t word;
int* val=new int[nch];
int ioff=0;
//int ioff=0;
int idr=0;
int ib=0;
int iw=0;
@ -129,7 +129,7 @@ class deserializer : public slsDetectorData<int> {
ib=0;
ich=0;
for (const auto &bit : dbl) {
ioff=off;
//ioff=off;
idr=0;
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
val[ich]|=(*dval)<<idr;

View File

@ -100,7 +100,10 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
} else {
row=200+i/sc_width;
}
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
#ifdef HIGHZ
dataMask[row][col]=0x3fff; //invert data
#endif
if (dataMap[row][col]<0 || dataMap[row][col]>=nSamples*2*32)
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
}

View File

@ -0,0 +1,268 @@
#ifndef MOENCH03T1ZMQDATA_H
#define MOENCH03T1ZMQDATA_H
#include "slsDetectorData.h"
class moench03T1ZmqData : public slsDetectorData<uint16_t> {
private:
int iframe;
int nadc;
int sc_width;
int sc_height;
const int nPackets; /**<number of UDP packets constituting one frame */
const int packetSize; /**< size of a udp packet */
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
(160x160 pixels, 40 packets 1286 large etc.)
\param c crosstalk parameter for the output buffer
*/
moench03T1ZmqData(int npackets=40, int ps=8192): slsDetectorData<uint16_t>(400, 400, ps*npackets), packetSize(ps), nPackets(npackets) {
int nadc=32;
int sc_width=25;
int sc_height=200;
int adc_nr[32]={300,325,350,375,300,325,350,375, \
200,225,250,275,200,225,250,275,\
100,125,150,175,100,125,150,175,\
0,25,50,75,0,25,50,75};
int row, col;
int isample;
int iadc;
int ix, iy;
// int npackets=40;
int i;
int adc4(0);
for (int ip=0; ip<npackets; ip++) {
for (int is=0; is<128; is++) {
for (iadc=0; iadc<nadc; iadc++) {
i=128*ip+is;
adc4=(int)iadc/4;
if (i<sc_width*sc_height) {
// for (int i=0; i<sc_width*sc_height; i++) {
col=adc_nr[iadc]+(i%sc_width);
if (adc4%2==0) {
row=199-i/sc_width;
} else {
row=200+i/sc_width;
}
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
if (dataMap[row][col]<0 || dataMap[row][col]>=8192*40)
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
}
}
}
}
int ipacket;
int ibyte;
int ii=0;
for (int ipacket=0; ipacket<npackets; ipacket++) {
for (int ibyte=0; ibyte< 8192/2; ibyte++) {
i=ipacket*8208/2+ibyte;
/* if (ibyte<8) { */
/* //header! */
/* xmap[i]=-1; */
/* ymap[i]=-1; */
/* } else { */
// ii=ibyte+128*32*ipacket;
isample=ii/nadc;
iadc=ii%nadc;
adc4 = (int)iadc/4;
ix=isample%sc_width;
iy=isample/sc_width;
if (adc4%2==0) {
xmap[i]=adc_nr[iadc]+ix;
ymap[i]=ny/2-1-iy;
} else {
xmap[i]=adc_nr[iadc]+ix;
ymap[i]=ny/2+iy;
}
ii++;
// }
}
}
iframe=0;
// cout << "data struct created" << endl;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
/* class jfrau_packet_header_t { */
/* public: */
/* unsigned char reserved[4]; */
/* unsigned char packetNumber[1]; */
/* unsigned char frameNumber[3]; */
/* unsigned char bunchid[8]; */
/* }; */
int getFrameNumber(char *buff){return iframe;};//*((int*)(buff+5))&0xffffff;};
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
/* /\** */
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
/* \param data pointer to the memory to be analyzed */
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
/* \param dsize size of the memory slot to be analyzed */
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
/* *\/ */
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
/* /\** */
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
/* \param filebin input file stream (binary) */
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
/* *\/ */
/* virtual char *readNextFrame(ifstream &filebin){ */
/* // int afifo_length=0; */
/* uint16_t *afifo_cont; */
/* int ib=0; */
/* if (filebin.is_open()) { */
/* afifo_cont=new uint16_t[dataSize/2]; */
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
/* ib+=2; */
/* if (ib==dataSize) break; */
/* } */
/* if (ib>0) { */
/* iframe++; */
/* // cout << ib << "-" << endl; */
/* return (char*)afifo_cont; */
/* } else { */
/* delete [] afifo_cont; */
/* return NULL; */
/* } */
/* } */
/* return NULL; */
/* }; */
virtual char *readNextFrame(ifstream &filebin) {
int ff=-1, np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int &ff) {
int np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
char *data=new char[packetSize*nPackets];
char *d=readNextFrame(filebin, ff, np, data);
if (d==NULL) {delete [] data; data=NULL;}
return data;
}
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
char *retval=0;
int nd;
int fnum = -1;
np=0;
int pn;
if (ff>=0)
fnum=ff;
if (filebin.is_open()) {
if (filebin.read(data, packetSize*nPackets) ){
iframe++;
ff=iframe;
return data;
}
}
return NULL;
};
/**
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
\param data pointer to the memory to be analyzed
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
\param dsize size of the memory slot to be analyzed
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
*/
virtual char *findNextFrame(char *data, int &ndata, int dsize){
if (dsize<packetSize*nPackets) ndata=dsize;
else ndata=packetSize*nPackets;
return data;
}
int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -276,15 +276,15 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
char *retval=0;
int nd;
int fnum = -1;
//char *retval=0;
// int nd;
//int fnum = -1;
np=0;
int pn;
// int pn;
if (ff>=0)
fnum=ff;
// if (ff>=0)
// fnum=ff;
if (filebin.is_open()) {
if (filebin.read(data, 32*2*nSamples) ){

View File

@ -0,0 +1,294 @@
#ifndef MOENCH04REC10GBDATA_H
#define MOENCH04REC10GBDATA_H
#include "slsDetectorData.h"
//#define VERSION_V2
/**
@short structure for a Detector Packet or Image Header
@li frameNumber is the frame number
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
@li packetNumber is the packet number
@li bunchId is the bunch id from beamline
@li timestamp is the time stamp with 10 MHz clock
@li modId is the unique module id (unique even for left, right, top, bottom)
@li xCoord is the x coordinate in the complete detector system
@li yCoord is the y coordinate in the complete detector system
@li zCoord is the z coordinate in the complete detector system
@li debug is for debugging purposes
@li roundRNumber is the round robin set number
@li detType is the detector type see :: detectorType
@li version is the version number of this structure format
*/
typedef struct {
uint64_t frameNumber; /**< is the frame number */
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
uint32_t packetNumber; /**< is the packet number */
uint64_t bunchId; /**< is the bunch id from beamline */
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
uint32_t debug; /**< is for debugging purposes */
uint16_t roundRNumber; /**< is the round robin set number */
uint8_t detType; /**< is the detector type see :: detectorType */
uint8_t version; /**< is the version number of this structure format */
uint64_t packetCaught[8]; /**< is the version number of this structure format */
} sls_detector_header;
class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
private:
int iframe;
int nadc;
int sc_width;
int sc_height;
const int aSamples;
const int dSamples;
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
(160x160 pixels, 40 packets 1286 large etc.)
\param c crosstalk parameter for the output buffer
*/
moench04CtbReceiver10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) {
int nadc=32;
int sc_width=25;
int sc_height=200;
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
int row, col;
int isample;
int iadc;
int ix, iy;
int npackets=40;
int i;
int adc4(0);
for (int ip=0; ip<npackets; ip++) {
for (int is=0; is<128; is++) {
for (iadc=0; iadc<nadc; iadc++) {
i=128*ip+is;
adc4=(int)iadc/4;
if (i<sc_width*sc_height) {
// for (int i=0; i<sc_width*sc_height; i++) {
col=(adc_nr[iadc]%16)*sc_width+(i%sc_width);
// if (adc4%2==0) {
if (iadc/16>0) {
row=199-i/sc_width;
} else {
row=200+i/sc_width;
}
if (nds>0)
dataMap[row][col]=sizeof(sls_detector_header)+((nadc+4)*i+iadc)*2;//+16*(ip+1);
else
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
}
}
}
}
int ipacket;
int ibyte;
int ii=0;
for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){
xmap[ibyte]=-1;
ymap[ibyte]=-1;
}
/* int off=sizeof(sls_detector_header)/2; */
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
/* i=ipacket*8208/2+ibyte; */
/* isample=ii/nadc; */
/* if (isample<nSamples) { */
/* iadc=ii%nadc; */
/* adc4 = (int)iadc/4; */
/* ix=isample%sc_width; */
/* iy=isample/sc_width; */
/* if (adc4%2==0) { */
/* xmap[i+off]=adc_nr[iadc]+ix; */
/* ymap[i+off]=ny/2-1-iy; */
/* } else { */
/* xmap[i+off]=adc_nr[iadc]+ix; */
/* ymap[i+off]=ny/2+iy; */
/* } */
/* } */
/* ii++; */
/* // } */
/* } */
/* } */
iframe=0;
// cout << "data struct created" << endl;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
/* class jfrau_packet_header_t { */
/* public: */
/* unsigned char reserved[4]; */
/* unsigned char packetNumber[1]; */
/* unsigned char frameNumber[3]; */
/* unsigned char bunchid[8]; */
/* }; */
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
/* /\** */
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
/* \param data pointer to the memory to be analyzed */
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
/* \param dsize size of the memory slot to be analyzed */
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
/* *\/ */
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
/* /\** */
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
/* \param filebin input file stream (binary) */
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
/* *\/ */
/* virtual char *readNextFrame(ifstream &filebin){ */
/* // int afifo_length=0; */
/* uint16_t *afifo_cont; */
/* int ib=0; */
/* if (filebin.is_open()) { */
/* afifo_cont=new uint16_t[dataSize/2]; */
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
/* ib+=2; */
/* if (ib==dataSize) break; */
/* } */
/* if (ib>0) { */
/* iframe++; */
/* // cout << ib << "-" << endl; */
/* return (char*)afifo_cont; */
/* } else { */
/* delete [] afifo_cont; */
/* return NULL; */
/* } */
/* } */
/* return NULL; */
/* }; */
virtual char *readNextFrame(ifstream &filebin) {
int ff=-1, np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int &ff) {
int np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
char *data=new char[dataSize];
char *d=readNextFrame(filebin, ff, np, data);
if (d==NULL) {delete [] data; data=NULL;}
return data;
}
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
char *retval=0;
int nd;
int fnum = -1;
np=0;
int pn;
// cout << dataSize << endl;
if (ff>=0)
fnum=ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize) ){
ff=getFrameNumber(data);
np=getPacketNumber(data);
return data;
}
}
return NULL;
};
/**
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
\param data pointer to the memory to be analyzed
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
\param dsize size of the memory slot to be analyzed
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
*/
virtual char *findNextFrame(char *data, int &ndata, int dsize){
if (dsize<dataSize) ndata=dsize;
else ndata=dataSize;
return data;
}
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

Some files were not shown because too many files have changed in this diff Show More