mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
Merge branch 'developer' into rxacqIndices
This commit is contained in:
@ -11,9 +11,17 @@ manually
|
||||
from clang import cindex
|
||||
import subprocess
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from parse import system_include_paths, clang_format_version
|
||||
|
||||
required_version = 13
|
||||
RED = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
if (ver := clang_format_version()) != required_version:
|
||||
print(f'{RED}Clang format version {required_version} required, detected: {ver}. Bye!{ENDC}')
|
||||
sys.exit(1)
|
||||
|
||||
from parse import system_include_paths
|
||||
|
||||
default_build_path = "/home/l_frojdh/sls/build/"
|
||||
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
||||
@ -66,7 +74,7 @@ def get_arguments_with_default(node):
|
||||
args = []
|
||||
for arg in node.get_arguments():
|
||||
tokens = [t.spelling for t in arg.get_tokens()]
|
||||
print(tokens)
|
||||
# print(tokens)
|
||||
if '=' in tokens:
|
||||
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||
args.append("py::arg() = Positions{}")
|
||||
@ -111,19 +119,11 @@ def visit(node):
|
||||
lines.append(
|
||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||
)
|
||||
print(f'&Detector::{child.spelling}{args})')
|
||||
cn.append(child)
|
||||
for child in node.get_children():
|
||||
visit(child)
|
||||
|
||||
# .def("setRxHostname",
|
||||
# (void (Detector::*)(const std::string &, Positions)) &
|
||||
# Detector::setRxHostname,
|
||||
# py::arg(), py::arg() = Positions{})
|
||||
# .def("setRxHostname",
|
||||
# (void (Detector::*)(const std::vector<std::string> &)) &
|
||||
# Detector::setRxHostname,
|
||||
# py::arg())
|
||||
|
||||
|
||||
visit(tu.cursor)
|
||||
|
||||
|
@ -5,6 +5,12 @@ import subprocess
|
||||
from subprocess import PIPE
|
||||
import os
|
||||
|
||||
def clang_format_version():
|
||||
p = subprocess.run(['clang-format', '--version'], capture_output = True)
|
||||
ver = p.stdout.decode().split()[2]
|
||||
major = int(ver.split('.')[0])
|
||||
return major
|
||||
|
||||
|
||||
def remove_comments(text):
|
||||
def replacer(match):
|
||||
|
@ -287,7 +287,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
Note
|
||||
-----
|
||||
[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
||||
[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
||||
[Mythen3] Options: 8, 16, 32 \n
|
||||
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
||||
"""
|
||||
@ -1474,6 +1474,19 @@ class Detector(CppDetectorApi):
|
||||
def trimval(self, value):
|
||||
ut.set_using_dict(self.setAllTrimbits, value)
|
||||
|
||||
@property
|
||||
@element
|
||||
def master(self):
|
||||
"""
|
||||
[Eiger] Sets half module to master and others to slaves.\n
|
||||
[Gotthard][Gotthard2][Mythen3][Eiger] Gets if the current module/ half module is master.
|
||||
"""
|
||||
return self.getMaster()
|
||||
|
||||
@master.setter
|
||||
def master(self, value):
|
||||
ut.set_using_dict(self.setMaster, value)
|
||||
|
||||
@property
|
||||
@element
|
||||
def lock(self):
|
||||
@ -2126,6 +2139,21 @@ class Detector(CppDetectorApi):
|
||||
"""
|
||||
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
||||
|
||||
@property
|
||||
@element
|
||||
def top(self):
|
||||
"""[Eiger] Sets half module to top (1), else bottom.
|
||||
|
||||
Note
|
||||
-----
|
||||
Advanced Function!
|
||||
"""
|
||||
return self.getTop()
|
||||
|
||||
@top.setter
|
||||
def top(self, value):
|
||||
ut.set_using_dict(self.setTop, value)
|
||||
|
||||
"""
|
||||
------------------<<<Jungfrau specific>>>-------------------------
|
||||
"""
|
||||
|
@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/* WARINING This file is auto generated any edits might be overwritten without
|
||||
* warning */
|
||||
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
@ -173,6 +173,12 @@ void init_det(py::module &m) {
|
||||
.def("setFlipRows",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getMaster",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getMaster,
|
||||
py::arg() = Positions{})
|
||||
.def("setMaster", (void (Detector::*)(bool, int)) & Detector::setMaster,
|
||||
py::arg(), py::arg())
|
||||
.def("isVirtualDetectorServer",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::isVirtualDetectorServer,
|
||||
@ -770,7 +776,7 @@ void init_det(py::module &m) {
|
||||
Detector::getRxLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxThreadIds",
|
||||
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) &
|
||||
(Result<std::array<pid_t, 9>>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxThreadIds,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxArping",
|
||||
@ -1009,6 +1015,13 @@ void init_det(py::module &m) {
|
||||
sls::Positions)) &
|
||||
Detector::setDataStream,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getTop",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getTop,
|
||||
py::arg() = Positions{})
|
||||
.def("setTop",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setTop,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getChipVersion",
|
||||
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getChipVersion,
|
||||
@ -1267,10 +1280,6 @@ void init_det(py::module &m) {
|
||||
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getGateDelayForAllGates,
|
||||
py::arg() = Positions{})
|
||||
.def("getMaster",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getMaster,
|
||||
py::arg() = Positions{})
|
||||
.def("getChipStatusRegister",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getChipStatusRegister,
|
||||
@ -1559,7 +1568,7 @@ void init_det(py::module &m) {
|
||||
Detector::getUpdateMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setUpdateMode",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
(void (Detector::*)(const bool, sls::Positions)) &
|
||||
Detector::setUpdateMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("readRegister",
|
||||
|
Reference in New Issue
Block a user