gondola_core/tracker/
strips.rs

1// This file is part of gaps-online-software and published 
2// under the GPLv3 license
3
4#[cfg(feature="pybindings")]
5pub use pyo3::prelude::*; 
6
7use crate::constants::SILI_RADIUS;
8
9/// A helper to plot detector strip
10///
11/// Assuming there ia a single SiLi-waver at 0,0, return positions and 
12/// line lengths to indicate the grooves which separate the strips with 
13/// lines. These can then be used by either matplotlib.pyplothlines or
14/// matplotlib.pyplot.vlines depending 
15/// on the orientation of the wafer
16#[cfg_attr(feature="pybindings", pyfunction)]
17pub fn strip_lines() -> [(f32, f32);8] {
18  let mut strip_lines = [(0.0,0.0);8];   
19  let sw  =  [0.2*16.34907456f32/2.0, 0.2* 10.32502464f32/2.0,
20              0.2* 9.23299776f32/2.0, 0.2*  8.84362752f32/2.0,
21              0.2*-8.84362752f32/2.0, 0.2* -9.23299776f32/2.0,
22             -0.2*10.32502464f32/2.0, 0.2*-16.34907456f32/2.0];
23  //sw  = 0.2*np.array(sw)
24  let mut l_pos = [0.0f32;7];
25  l_pos[0] = sw[1] + sw[2] + sw[3];
26  l_pos[1] = sw[2] + sw[3];
27  l_pos[2] = sw[3];
28  l_pos[3] = 0.0;
29  l_pos[4] = -1.0*l_pos[2];
30  l_pos[5] = -1.0*l_pos[1];
31  l_pos[6] = -1.0*l_pos[0];
32  let radii = [SILI_RADIUS*0.8,
33               SILI_RADIUS*0.95, SILI_RADIUS,
34               SILI_RADIUS, SILI_RADIUS,
35               SILI_RADIUS*0.95,
36               SILI_RADIUS*0.8];
37  for k in 0..l_pos.len() {
38    strip_lines[k] = (radii[k], l_pos[k]);
39  }
40  strip_lines
41}
42
43