added python documentation

This commit is contained in:
2026-09-08 19:16:09 +02:00
parent 6c0a3631c1
commit 7c44b01f38
10 changed files with 378 additions and 33 deletions
+28
View File
@@ -20,3 +20,31 @@ def SensorConfig(sensor_geometry, group_configs):
sensor_config_cls = getattr(strixelremap, f"SensorConfig_{N}PixelGroups")
return sensor_config_cls(sensor_geometry, group_configs)
# helper function for easier documentation of templated strixel_to_pixel_maps
def strixel_to_pixel_maps(sensor_config : SensorConfig, placement : strixelremap.SensorModulePlacement, user_roi : strixelremap.InclusiveROI, bond_shift : strixelremap.BondShift = strixelremap.BondShift(0, 0)) -> list[strixelremap.StrixelGroupToPixelMap]:
"""
Creates a StrixeltoPixelMap for all GroupConfigs in a SensorConfig
Parameters
----------
sensor_config : SensorConfig
Configuration of the sensor, including all configurations of the strixel groups.
placement : SensorModulePlacement
Placement and orientation of the sensor on the module.
user_roi : InclusiveROI
User-defined region of interest. (in global module coordinates)
bond_shift : BondShift, optional
Shift applied to the bond positions. Default is (0, 0).
Returns
-------
list[StrixelGroupToPixelMap]
map(row, col) contains the flattened pixel index of the corresponding source pixel in the user-provided input ROI for strixel defined at (row, col).
An entry of -1 indicates that the corresponding strixel position has no valid source pixel.
"""
return strixelremap.strixel_to_pixel_maps_pybindfunc(sensor_config, placement, user_roi, bond_shift)
+2
View File
@@ -1,4 +1,6 @@
from .SensorConfig import SensorConfig
from .SensorConfig import strixel_to_pixel_maps
from .._aare.strixelremap import *
@@ -97,42 +97,44 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("user_roi").noconvert(), py::arg("placement").noconvert(),
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx25 strixel group on a Jungfrau ILGAD sensor
Parameters
----------
user_roi : InclusiveROI
ROI in global module coordinate system.
placement : SensorModulePlacement
Placement and orientation of the sensor on the module.
bond_shift : BondShift, optional
Bonding shift applied before the configured sensor placement rotation. Default is (0, 0).
Returns
-------
StrixelGroupToPixelMap
map(row, col) contains the flattened pixel index of the corresponding source pixel in the user-provided input ROI for strixel defined at (row, col).
An entry of -1 indicates that the corresponding strixel position has no valid source pixel.
)");
Generates a strixel-to-pixel remapping map for the Strx25 strixel group on a Jungfrau ILGAD sensor
Parameters
----------
user_roi : InclusiveROI
ROI in global module coordinate system.
placement : SensorModulePlacement
Placement and orientation of the sensor on the module.
bond_shift : BondShift, optional
Bonding shift applied before the configured sensor placement rotation. Default is (0, 0).
Returns
-------
StrixelGroupToPixelMap
map(row, col) contains the flattened pixel index of the corresponding source pixel in the user-provided input ROI for strixel defined at (row, col).
An entry of -1 indicates that the corresponding strixel position has no valid source pixel.
)");
m.attr("jungfrau_ilgad_singlechip_15um_strixel_map") = py::cpp_function(
&aare::remap::generate::jungfrau_ilgad_singlechip_15um_strixel_map,
py::arg("user_roi").noconvert(), py::arg("placement").noconvert(),
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx15 strixel group on a Jungfrau ILGAD sensor
Parameters
----------
user_roi : InclusiveROI
ROI in global module coordinate system.
placement : SensorModulePlacement
Placement and orientation of the sensor on the module.
bond_shift : BondShift, optional
Bonding shift applied before the configured sensor placement rotation. Default is (0, 0).
Returns
-------
StrixelGroupToPixelMap
map(row, col) contains the flattened pixel index of the corresponding source pixel in the user-provided input ROI for strixel defined at (row, col).
An entry of -1 indicates that the corresponding strixel position has no valid source pixel.
)");
Generates a strixel-to-pixel remapping map for the Strx15 strixel group on a Jungfrau ILGAD sensor
Parameters
----------
user_roi : InclusiveROI
ROI in global module coordinate system.
placement : SensorModulePlacement
Placement and orientation of the sensor on the module.
bond_shift : BondShift, optional
Bonding shift applied before the configured sensor placement rotation. Default is (0, 0).
Returns
-------
StrixelGroupToPixelMap
map(row, col) contains the flattened pixel index of the corresponding source pixel in the user-provided input ROI for strixel defined at (row, col).
An entry of -1 indicates that the corresponding strixel position has no valid source pixel.
)");
m.attr("jungfrau_ilgad_singlechip_18um_strixel_map") = py::cpp_function(
&aare::remap::generate::jungfrau_ilgad_singlechip_18um_strixel_map,
@@ -140,6 +142,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx18 strixel group on a Jungfrau ILGAD sensor
Parameters
----------
user_roi : InclusiveROI
@@ -161,6 +164,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a list of strixel-to-pixel remapping map for each strixel group on a Jungfrau ILGAD quad sensor
Parameters
----------
user_roi : InclusiveROI
@@ -184,6 +188,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx25 strixel group on a Jungfrau TEW sensor
Parameters
----------
user_roi : InclusiveROI
@@ -205,6 +210,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx15 strixel group on a Jungfrau TEW sensor
Parameters
----------
user_roi : InclusiveROI
@@ -226,6 +232,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the Strx18 strixel group on a Jungfrau TEW sensor
Parameters
----------
user_roi : InclusiveROI
@@ -247,6 +254,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a list of strixel-to-pixel remapping map for each strixel group on a Jungfrau TEW sensor
Parameters
----------
user_roi : InclusiveROI
@@ -270,6 +278,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the bottom half of the Strx25 strixel group on a Jungfrau ILGAD quad sensor
Parameters
----------
user_roi : InclusiveROI
@@ -291,6 +300,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the top half of the Strx25 strixel group on a Jungfrau ILGAD quad sensor
Parameters
----------
user_roi : InclusiveROI
@@ -312,6 +322,7 @@ void define_predefinedStrixelPixelMaps(py::module &m) {
py::arg("bond_shift").noconvert() = aare::remap::defs::BondShift{0, 0},
R"(
Generates a strixel-to-pixel remapping map for the entire Strx25 strixel group on a Jungfrau ILGAD quad sensor
Parameters
----------
user_roi : InclusiveROI
@@ -223,11 +223,11 @@ void define_RemapAlgorithm(py::module &m) {
Parameters
----------
input : np.array
input : np.array[uint16_t, 2]
Original array
order_map : np.array[ssize_t, 2]
Rule for remapping
output : np.array
output : np.array[uint16_t, 2]
Remapped array
)");
@@ -236,7 +236,8 @@ void define_RemapAlgorithm(py::module &m) {
template <std::size_t N>
void define_RemapAlgorithmforSensorConfig(py::module &m) {
m.def("strixel_to_pixel_maps", &aare::remap::algo::strixel_to_pixel_maps<N>,
m.def("strixel_to_pixel_maps_pybindfunc",
&aare::remap::algo::strixel_to_pixel_maps<N>,
py::arg("sensor_config").noconvert(),
py::arg("placement").noconvert(), py::arg("user_roi").noconvert(),
py::arg("bond_shift").noconvert() =