gondola 0.12.1__tar.gz → 0.12.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gondola-0.12.1 → gondola-0.12.2}/Cargo.lock +1 -1
- {gondola-0.12.1 → gondola-0.12.2}/Cargo.toml +2 -1
- {gondola-0.12.1 → gondola-0.12.2}/PKG-INFO +1 -1
- gondola-0.12.2/python/gondola/tof/__init__.py +64 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/calibration/tof.rs +2 -2
- {gondola-0.12.1 → gondola-0.12.2}/src/io/telemetry_reader.rs +60 -10
- {gondola-0.12.1 → gondola-0.12.2}/src/lib.rs +13 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/commands.rs +15 -1
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/master_trigger.rs +10 -6
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/settings.rs +13 -56
- gondola-0.12.1/python/gondola/tof/__init__.py +0 -22
- {gondola-0.12.1 → gondola-0.12.2}/.gitignore +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/README.md +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/alert-manifest-test.toml +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/benches/bench.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/diesel.toml +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/publish_to_bluejay.sh +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/pyproject.toml +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/__init__.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/calibration.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/db.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/gaps_flight.db +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/io/__init__.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/reconstruction/__init__.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/tof/analysis.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/tracker/__init__.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/tracker/analysis.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/visual/__init__.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/visual/tof.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/python/gondola/visual/tracker.py +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/calibration/tracker.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/calibration.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/constants.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/database/schema.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/database.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/errors.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/rb_event.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/rb_event_header.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/rb_waveform.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/telemetry_event.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/tof_event.rs +5 -5
- {gondola-0.12.1 → gondola-0.12.2}/src/events/tof_hit.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events/tracker_hit.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/events.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/caraspace/frame.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/caraspace/reader.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/caraspace/socket_reader.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/caraspace/writer.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/caraspace.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/data_source.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/ipbus.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/parsers.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/root_reader.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/serialization.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/streamers.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/tof_reader.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io/tof_writer.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/io.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/cpu_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/heartbeats/data_sink_hb.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/heartbeats/event_builder_hb.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/heartbeats/master_trigger_hb.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/heartbeats.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/ltb_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/mtb_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/pa_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/pb_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/rb_moni_data.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring/run_statistics.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/monitoring.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/bfsw_ack_packet.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/gps_packet.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/magnetometer.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/telemetry_packet.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/telemetry_packet_header.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/telemetry_packet_type.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/tof_packet.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/tof_packet_type.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/tracker.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets/tracker_header.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/packets.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/prelude.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/python.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/random.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/stats.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/alerts.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/algorithms.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/analysis.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/analysis_engine.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/config.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/cuts.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/detector_status.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/master_trigger/control.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/master_trigger/registers.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/rb_paddle_id.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/signal_handler.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/thread_control.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof/tof_response.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tof.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tracker/strips.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/tracker.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/src/version.rs +0 -0
- {gondola-0.12.1 → gondola-0.12.2}/tests/test.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "gondola-core"
|
|
3
|
-
version = "0.12.
|
|
3
|
+
version = "0.12.2"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
|
|
@@ -71,6 +71,7 @@ optional = true
|
|
|
71
71
|
version = "0.1"
|
|
72
72
|
optional = true
|
|
73
73
|
|
|
74
|
+
|
|
74
75
|
[dev-dependencies]
|
|
75
76
|
criterion = "0.4"
|
|
76
77
|
#tempfile = "3.10"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TOF related entities which did not fit anywhere else
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .. import _gondola_core as _gc
|
|
6
|
+
|
|
7
|
+
from . import analysis
|
|
8
|
+
|
|
9
|
+
RBPaddleID = _gc.tof.RBPaddleID
|
|
10
|
+
RBPaddleID.__module__ = __name__
|
|
11
|
+
RBPaddleID.__name__ = "RBPaddleID"
|
|
12
|
+
#RBPaddleID.__doc__ = _gc.tof.RBPaddleID.__doc__
|
|
13
|
+
TofDetectorStatus = _gc.tof.TofDetectorStatus
|
|
14
|
+
TofCommandCode = _gc.tof.TofCommandCode
|
|
15
|
+
TofCommand = _gc.tof.TofCommand
|
|
16
|
+
TofOperationMode = _gc.tof.TofOperationMode
|
|
17
|
+
BuildStrategy = _gc.tof.BuildStrategy
|
|
18
|
+
PreampBiasConfig = _gc.tof.PreampBiasConfig
|
|
19
|
+
RBChannelMaskConfig = _gc.tof.RBChannelMaskConfig
|
|
20
|
+
TriggerConfig = _gc.tof.TriggerConfig
|
|
21
|
+
TofRunConfig = _gc.tof.TofRunConfig
|
|
22
|
+
TofCuts = _gc.tof.TofCuts
|
|
23
|
+
to_board_id_string = _gc.tof.to_board_id_string
|
|
24
|
+
TofAnalysis = analysis.TofAnalysis
|
|
25
|
+
|
|
26
|
+
## command factories
|
|
27
|
+
#start_run = _gc.tof.start_run
|
|
28
|
+
#start_run.__module__ = __name__
|
|
29
|
+
#start_run.__name___ = 'start_run'
|
|
30
|
+
#
|
|
31
|
+
#stop_run = _gc.tof.stop_run
|
|
32
|
+
#stop_run.__module__ = __name__
|
|
33
|
+
#stop_run.__name___ = 'stop_run'
|
|
34
|
+
#
|
|
35
|
+
#enable_verification_run = _gc.tof.enable_verification_run
|
|
36
|
+
#enable_verification_run.__module__ = __name__
|
|
37
|
+
#enable_verification_run.__name___ = 'enable_verification_run'
|
|
38
|
+
#
|
|
39
|
+
#restart_liftofrb = _gc.tof.restart_liftofrb
|
|
40
|
+
#restart_liftofrb.___module__ = __name__
|
|
41
|
+
#restart_liftofrb.__name__ = 'restart_liftofrb'
|
|
42
|
+
#
|
|
43
|
+
#shutdown_all_rbs = _gc.tof.shutdown_all_rbs
|
|
44
|
+
#shutdown_all_rbs.__module__ = __name__
|
|
45
|
+
#shutdown_all_rbs.__name__ = 'shutdown_all_rbs'
|
|
46
|
+
#
|
|
47
|
+
#shutdown_rat = _gc.tof.shutdown_rat
|
|
48
|
+
#shutdown_rat.__module__ = __name__
|
|
49
|
+
#shutdown_rat.__name__ = 'shutdown_rat'
|
|
50
|
+
#
|
|
51
|
+
#shutdown_ratpair = _gc.tof.shutdown_ratpair
|
|
52
|
+
#shutdown_ratpair.__module__ = __name__
|
|
53
|
+
#shutdown_ratpair.__name__ = 'shutdown_ratpair'
|
|
54
|
+
#
|
|
55
|
+
#shutdown_rb = _gc.tof.shutdown_rb
|
|
56
|
+
#shutdown_rb.__module__ = __name__
|
|
57
|
+
#shutdown_rb.__name__ = 'shutdown_rb'
|
|
58
|
+
#
|
|
59
|
+
#shutdown_tofcpu = _gc.tof.shutdown_tofcpu
|
|
60
|
+
#shutdown_tofcpu.__module__ = __name__
|
|
61
|
+
#shutdown_tofcpu.__name__ = 'shutdown_tofcpu'
|
|
62
|
+
#
|
|
63
|
+
|
|
64
|
+
|
|
@@ -1357,7 +1357,7 @@ impl RBCalibrations {
|
|
|
1357
1357
|
|
|
1358
1358
|
/// Self check if the timing constants are sane
|
|
1359
1359
|
pub fn passes_timing_checks(&self) -> bool {
|
|
1360
|
-
for ch in 0..
|
|
1360
|
+
for ch in 0..9 {
|
|
1361
1361
|
let mut mean = 0.0;
|
|
1362
1362
|
for k in 0..NWORDS {
|
|
1363
1363
|
mean += self.tbin[ch][k];
|
|
@@ -1380,7 +1380,7 @@ impl RBCalibrations {
|
|
|
1380
1380
|
|
|
1381
1381
|
/// Self check if the voltage constants are sane
|
|
1382
1382
|
pub fn passes_voltage_checks(&self) -> bool {
|
|
1383
|
-
for ch in 0..
|
|
1383
|
+
for ch in 0..9 {
|
|
1384
1384
|
let mut mean = 0.0;
|
|
1385
1385
|
for k in 0..NWORDS {
|
|
1386
1386
|
mean += self.v_offsets[ch][k];
|
|
@@ -10,6 +10,7 @@ use std::io::{
|
|
|
10
10
|
Seek,
|
|
11
11
|
SeekFrom,
|
|
12
12
|
};
|
|
13
|
+
use std::cmp::Ordering;
|
|
13
14
|
|
|
14
15
|
use crate::prelude::*;
|
|
15
16
|
|
|
@@ -52,7 +53,11 @@ pub struct TelemetryPacketReader {
|
|
|
52
53
|
pub n_duplicates : usize,
|
|
53
54
|
/// A cache to allow to quench duplicates
|
|
54
55
|
/// pkt counter -> pkt checksum
|
|
55
|
-
dedup_cache : HashMap<u16, VecDeque<u16
|
|
56
|
+
dedup_cache : HashMap<u16, VecDeque<u16>>,
|
|
57
|
+
/// If ::cache_all_packets is called, this will hold
|
|
58
|
+
/// all TelemetryPackets sorted by timestamp and
|
|
59
|
+
/// packet counter
|
|
60
|
+
pub packet_cache : Vec<TelemetryPacket>
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
|
|
@@ -102,6 +107,7 @@ impl TelemetryPacketReader {
|
|
|
102
107
|
n_packs_skipped : 0,
|
|
103
108
|
n_duplicates : 0,
|
|
104
109
|
dedup_cache : dedup_cache,
|
|
110
|
+
packet_cache : Vec::<TelemetryPacket>::new()
|
|
105
111
|
};
|
|
106
112
|
packet_reader
|
|
107
113
|
}
|
|
@@ -109,7 +115,35 @@ impl TelemetryPacketReader {
|
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
|
-
|
|
118
|
+
|
|
119
|
+
/// Instead of reading packets one at a time, we can read the entire input
|
|
120
|
+
/// at once and keep it in memory. This allows to sort the packeges.
|
|
121
|
+
///
|
|
122
|
+
/// This comes with a performance cost and extended memory needs, however,
|
|
123
|
+
/// it might be helpful for debugging
|
|
124
|
+
pub fn cache_all_packets(&mut self) {
|
|
125
|
+
loop {
|
|
126
|
+
match self.read_next_item() {
|
|
127
|
+
None => {
|
|
128
|
+
info!("Read all packets!");
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
Some(pack) => {
|
|
132
|
+
self.packet_cache.push(pack);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// sort the packet cache by timestamp and counter of
|
|
137
|
+
// the header
|
|
138
|
+
self.packet_cache.sort_by(|a,b|{
|
|
139
|
+
b.header.get_gcutime().partial_cmp(&a.header.get_gcutime()).unwrap_or(Ordering::Equal)
|
|
140
|
+
.then(b.header.counter.cmp(&a.header.counter))
|
|
141
|
+
});
|
|
142
|
+
// reverse the vector, so that the first packet gets
|
|
143
|
+
// returned first
|
|
144
|
+
self.packet_cache.reverse();
|
|
145
|
+
}
|
|
146
|
+
|
|
113
147
|
pub fn clear_dedup_cache(&mut self) {
|
|
114
148
|
let mut dedup_cache = HashMap::<u16, VecDeque<u16>>::with_capacity(u16::MAX as usize + 1);
|
|
115
149
|
for k in 0..u16::MAX as usize + 1 {
|
|
@@ -197,7 +231,7 @@ impl TelemetryPacketReader {
|
|
|
197
231
|
}
|
|
198
232
|
// read the the size of the packet
|
|
199
233
|
// first we have to skip 6 bytes
|
|
200
|
-
let mut buffer_skip = [0,0,0,0,0,0
|
|
234
|
+
let mut buffer_skip = [0,0,0,0,0,0];
|
|
201
235
|
match self.file_reader.read_exact(&mut buffer_skip) {
|
|
202
236
|
Err(err) => {
|
|
203
237
|
debug!("Unable to read from file! {err}");
|
|
@@ -210,7 +244,7 @@ impl TelemetryPacketReader {
|
|
|
210
244
|
};
|
|
211
245
|
}
|
|
212
246
|
Ok(_) => {
|
|
213
|
-
self.cursor +=
|
|
247
|
+
self.cursor += 6;
|
|
214
248
|
}
|
|
215
249
|
}
|
|
216
250
|
let mut buffer_psize = [0,0];
|
|
@@ -229,9 +263,11 @@ impl TelemetryPacketReader {
|
|
|
229
263
|
}
|
|
230
264
|
}
|
|
231
265
|
let vec_data = buffer_psize.to_vec();
|
|
232
|
-
|
|
266
|
+
// packet size is the size including the header, so for the
|
|
267
|
+
// payload only we have to subtract that.
|
|
268
|
+
let size = parse_u16(&vec_data, &mut 0) - 13;
|
|
233
269
|
let mut temp_buffer = vec![0; size as usize];
|
|
234
|
-
// skip 2 more bytes
|
|
270
|
+
// skip 2 more bytes for the header checksum
|
|
235
271
|
match self.file_reader.read_exact(&mut buffer_psize) {
|
|
236
272
|
Err(_err) => {
|
|
237
273
|
match self.prime_next_file() {
|
|
@@ -324,8 +360,7 @@ impl TelemetryPacketReader {
|
|
|
324
360
|
let mut thead = TelemetryPacketHeader::new();
|
|
325
361
|
thead.sync = 0x90eb;
|
|
326
362
|
thead.packet_type = TelemetryPacketType::from(buffer[0]);
|
|
327
|
-
let ptype = TelemetryPacketType::from(buffer[0]);
|
|
328
|
-
// read the the size of the packet
|
|
363
|
+
//let ptype = TelemetryPacketType::from(buffer[0]);
|
|
329
364
|
let mut buffer_ts = [0,0,0,0];
|
|
330
365
|
match self.file_reader.read_exact(&mut buffer_ts) {
|
|
331
366
|
Err(err) => {
|
|
@@ -381,7 +416,7 @@ impl TelemetryPacketReader {
|
|
|
381
416
|
return None;
|
|
382
417
|
}
|
|
383
418
|
size -= TelemetryPacketHeader::SIZE as u16;
|
|
384
|
-
if
|
|
419
|
+
if thead.packet_type != self.filter && self.filter != TelemetryPacketType::Unknown {
|
|
385
420
|
match self.file_reader.seek(SeekFrom::Current(size as i64)) {
|
|
386
421
|
Err(err) => {
|
|
387
422
|
debug!("Unable to read more data! {err}");
|
|
@@ -536,7 +571,7 @@ reader!(TelemetryPacketReader, TelemetryPacket);
|
|
|
536
571
|
impl TelemetryPacketReader {
|
|
537
572
|
|
|
538
573
|
#[new]
|
|
539
|
-
#[pyo3(signature = (filenames_or_directory, dedup =
|
|
574
|
+
#[pyo3(signature = (filenames_or_directory, dedup = false, start_time = None, end_time = None))]
|
|
540
575
|
fn new_py(filenames_or_directory : &Bound<'_,PyAny>, dedup : bool, start_time : Option<f64>, end_time : Option<f64>) -> PyResult<Self> {
|
|
541
576
|
|
|
542
577
|
let mut string_value = String::from("foo");
|
|
@@ -593,6 +628,21 @@ impl TelemetryPacketReader {
|
|
|
593
628
|
self.count_packets()
|
|
594
629
|
}
|
|
595
630
|
|
|
631
|
+
#[pyo3(name = "cache_all_packets")]
|
|
632
|
+
fn cache_all_packets_py(&mut self) {
|
|
633
|
+
self.cache_all_packets();
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/// Retrieve a copy of the internal packet cache.
|
|
637
|
+
/// This will only yield a meaningful result after
|
|
638
|
+
/// a call to .cache_all_packets(). Since the entire
|
|
639
|
+
/// cache is copied in the processs, this is slow
|
|
640
|
+
/// and might only be helpful for debugging.
|
|
641
|
+
#[pyo3(name = "copy_packet_cache")]
|
|
642
|
+
fn copy_packet_cache(&self) -> Vec<TelemetryPacket> {
|
|
643
|
+
self.packet_cache.clone()
|
|
644
|
+
}
|
|
645
|
+
|
|
596
646
|
//#[getter]
|
|
597
647
|
//fn first(&mut self) -> Option<TofPacket> {
|
|
598
648
|
// self.first_packet()
|
|
@@ -174,6 +174,19 @@ fn tof_py<'_py>(m: &Bound<'_py, PyModule>) -> PyResult<()> {
|
|
|
174
174
|
m.add_class::<TofCuts>()?;
|
|
175
175
|
m.add_class::<PyMasterTrigger>()?;
|
|
176
176
|
m.add_function(wrap_pyfunction!(to_board_id_string, m)?)?;
|
|
177
|
+
// the commands
|
|
178
|
+
m.add_function(wrap_pyfunction!(start_run, m)?)?;
|
|
179
|
+
m.add_function(wrap_pyfunction!(stop_run, m)?)?;
|
|
180
|
+
m.add_function(wrap_pyfunction!(restart_liftofrb, m)?)?;
|
|
181
|
+
m.add_function(wrap_pyfunction!(enable_verification_run, m)?)?;
|
|
182
|
+
m.add_function(wrap_pyfunction!(shutdown_all_rbs, m)?)?;
|
|
183
|
+
m.add_function(wrap_pyfunction!(shutdown_rat, m)?)?;
|
|
184
|
+
m.add_function(wrap_pyfunction!(shutdown_ratpair, m)?)?;
|
|
185
|
+
m.add_function(wrap_pyfunction!(shutdown_rb, m)?)?;
|
|
186
|
+
m.add_function(wrap_pyfunction!(shutdown_tofcpu, m)?)?;
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
177
190
|
Ok(())
|
|
178
191
|
}
|
|
179
192
|
|
|
@@ -527,12 +527,26 @@ pub fn stop_run() -> Option<TofCommand> {
|
|
|
527
527
|
})
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
+
/// Enable verfication runs before every run start
|
|
531
|
+
///
|
|
532
|
+
/// A verification run will not send any event
|
|
533
|
+
/// packets, but only a TofDetectorStatus frame
|
|
534
|
+
#[cfg_attr(feature="pybindings", pyfunction)]
|
|
535
|
+
pub fn enable_verification_run(enabled : bool) -> Option<TofCommand> {
|
|
536
|
+
Some(TofCommand {
|
|
537
|
+
command_code : TofCommandCode::StartValidationRun,
|
|
538
|
+
payload : vec![enabled as u8],
|
|
539
|
+
})
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
530
544
|
/// Run a calibration of all RBs
|
|
531
545
|
///
|
|
532
546
|
/// # Arguments:
|
|
533
547
|
/// * pre_run_calibration : Run the RBCalibration routine before
|
|
534
548
|
/// every run start
|
|
535
|
-
/// * send_packetes : Send the RBCalibration packets
|
|
549
|
+
/// * send_packetes : Send the RBCalibration packets
|
|
536
550
|
/// * save_events : Save the events to the RBCalibration
|
|
537
551
|
/// packets
|
|
538
552
|
#[cfg_attr(feature="pybindings", pyfunction)]
|
|
@@ -511,12 +511,14 @@ pub fn master_trigger(mt_address : &str,
|
|
|
511
511
|
let mut settings : MTBSettings;
|
|
512
512
|
let mut cali_active : bool;
|
|
513
513
|
let mut holdoff : bool;
|
|
514
|
+
let mut veri_active : bool;
|
|
514
515
|
loop {
|
|
515
516
|
match thread_control.lock() {
|
|
516
517
|
Ok(tc) => {
|
|
517
518
|
settings = tc.liftof_settings.mtb_settings.clone();
|
|
518
519
|
cali_active = tc.calibration_active;
|
|
519
520
|
holdoff = tc.holdoff_mtb_thread;
|
|
521
|
+
veri_active = tc.verification_active;
|
|
520
522
|
}
|
|
521
523
|
Err(err) => {
|
|
522
524
|
error!("Can't acquire lock for ThreadControl! Unable to set calibration mode! {err}");
|
|
@@ -772,12 +774,14 @@ pub fn master_trigger(mt_address : &str,
|
|
|
772
774
|
}
|
|
773
775
|
last_event_id = _ev.event_id;
|
|
774
776
|
heartbeat.n_events += 1;
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
777
|
+
if !veri_active {
|
|
778
|
+
match mt_sender.send(_ev) {
|
|
779
|
+
Err(err) => {
|
|
780
|
+
error!("Can not send TofEvent over channel! {err}");
|
|
781
|
+
heartbeat.n_ev_unsent += 1;
|
|
782
|
+
},
|
|
783
|
+
Ok(_) => ()
|
|
784
|
+
}
|
|
781
785
|
}
|
|
782
786
|
}
|
|
783
787
|
}
|
|
@@ -73,6 +73,11 @@ pub struct MTBSettings {
|
|
|
73
73
|
pub tiu_ignore_busy : bool,
|
|
74
74
|
pub tofbot_webhook : String,
|
|
75
75
|
pub hb_send_interval : u64,
|
|
76
|
+
/// Instruct the MTB to ignore the tiu
|
|
77
|
+
/// busy time and instead impose always
|
|
78
|
+
/// the same deadtime of 600mu sec on
|
|
79
|
+
/// itself
|
|
80
|
+
pub use_fixed_deadtime : Option<bool>,
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
impl MTBSettings {
|
|
@@ -93,6 +98,7 @@ impl MTBSettings {
|
|
|
93
98
|
use_combo_trigger : false,
|
|
94
99
|
global_trigger_type : TriggerType::Unknown,
|
|
95
100
|
global_trigger_prescale : 1.0,
|
|
101
|
+
use_fixed_deadtime : None,
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -868,7 +874,11 @@ pub struct LiftofSettings {
|
|
|
868
874
|
/// packet. If a verification run is desired, change this
|
|
869
875
|
/// number to the number of seconds to do the verification
|
|
870
876
|
/// run
|
|
871
|
-
|
|
877
|
+
#[deprecated(since = "0.11", note = "Use flag verfication_rnn and runtime instead!")]
|
|
878
|
+
pub verification_runtime_sec : Option<u32>,
|
|
879
|
+
/// If this is set, don't save anything to disk
|
|
880
|
+
/// and just transmit the TofDetectorStatus packet
|
|
881
|
+
pub verification_run : Option<bool>,
|
|
872
882
|
/// Settings to control the MTB
|
|
873
883
|
pub mtb_settings : MTBSettings,
|
|
874
884
|
/// Settings for the TOF event builder
|
|
@@ -905,7 +915,8 @@ impl LiftofSettings {
|
|
|
905
915
|
run_analysis_engine : true,
|
|
906
916
|
pre_run_calibration : false,
|
|
907
917
|
save_cali_wf : false,
|
|
908
|
-
verification_runtime_sec :
|
|
918
|
+
verification_runtime_sec : None, // no verification run per default
|
|
919
|
+
verification_run : None,
|
|
909
920
|
mtb_settings : MTBSettings::new(),
|
|
910
921
|
event_builder_settings : TofEventBuilderSettings::new(),
|
|
911
922
|
analysis_engine_settings : AnalysisEngineSettings::new(),
|
|
@@ -926,60 +937,6 @@ impl LiftofSettings {
|
|
|
926
937
|
}
|
|
927
938
|
}
|
|
928
939
|
|
|
929
|
-
/// Change a value by giving the specific key as
|
|
930
|
-
/// a string, the value then will be parsed
|
|
931
|
-
/// accordingly
|
|
932
|
-
#[deprecated(since="0.10.0", note="This is a dev deadend and will be nuked!")]
|
|
933
|
-
pub fn set_by_key(&mut self, key : &str, value : String) {
|
|
934
|
-
match key {
|
|
935
|
-
"runtime_sec" => {
|
|
936
|
-
if let Ok(val) = value.parse::<u64>() {
|
|
937
|
-
self.runtime_sec = val;
|
|
938
|
-
} else {
|
|
939
|
-
error!("Unable to parse {value}!");
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
"cpu_moni_interval_sec" => {
|
|
943
|
-
if let Ok(val) = value.parse::<u64>() {
|
|
944
|
-
self.cpu_moni_interval_sec = val;
|
|
945
|
-
} else {
|
|
946
|
-
error!("Unable to parse {value}!");
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
"rb_ignorelist_run" => {
|
|
950
|
-
}
|
|
951
|
-
"run_analysis_engine" => {
|
|
952
|
-
if let Ok(val) = value.parse::<bool>() {
|
|
953
|
-
self.run_analysis_engine = val;
|
|
954
|
-
} else {
|
|
955
|
-
error!("Unable to parse {value}!");
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
"pre_run_calibration" => {
|
|
959
|
-
if let Ok(val) = value.parse::<bool>() {
|
|
960
|
-
self.pre_run_calibration = val;
|
|
961
|
-
} else {
|
|
962
|
-
error!("Unable to parse {value}!");
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
"save_cali_wf" => {
|
|
966
|
-
if let Ok(val) = value.parse::<bool>() {
|
|
967
|
-
self.save_cali_wf = val;
|
|
968
|
-
} else {
|
|
969
|
-
error!("Unable to parse {value}!");
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
"verification_runtime_sec" => {
|
|
973
|
-
if let Ok(val) = value.parse::<u32>() {
|
|
974
|
-
self.verification_runtime_sec = val;
|
|
975
|
-
} else {
|
|
976
|
-
error!("Unable to parse {value}!");
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
_ => error!("Set by key for {} is not implemented!", key)
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
940
|
/// Write the settings to a toml file
|
|
984
941
|
pub fn to_toml(&self, mut filename : String) {
|
|
985
942
|
if !filename.ends_with(".toml") {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
TOF related entities which did not fit anywhere else
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from .. import _gondola_core as _gc
|
|
6
|
-
|
|
7
|
-
from . import analysis
|
|
8
|
-
|
|
9
|
-
RBPaddleID = _gc.tof.RBPaddleID
|
|
10
|
-
TofDetectorStatus = _gc.tof.TofDetectorStatus
|
|
11
|
-
TofCommandCode = _gc.tof.TofCommandCode
|
|
12
|
-
TofCommand = _gc.tof.TofCommand
|
|
13
|
-
TofOperationMode = _gc.tof.TofOperationMode
|
|
14
|
-
BuildStrategy = _gc.tof.BuildStrategy
|
|
15
|
-
PreampBiasConfig = _gc.tof.PreampBiasConfig
|
|
16
|
-
RBChannelMaskConfig = _gc.tof.RBChannelMaskConfig
|
|
17
|
-
TriggerConfig = _gc.tof.TriggerConfig
|
|
18
|
-
TofRunConfig = _gc.tof.TofRunConfig
|
|
19
|
-
TofCuts = _gc.tof.TofCuts
|
|
20
|
-
to_board_id_string = _gc.tof.to_board_id_string
|
|
21
|
-
TofAnalysis = analysis.TofAnalysis
|
|
22
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -789,11 +789,6 @@ impl Serialization for TofEvent {
|
|
|
789
789
|
//println!("{}", next_rb_event);
|
|
790
790
|
te.rb_events.push(next_rb_event);
|
|
791
791
|
}
|
|
792
|
-
let tail = parse_u16(stream, pos);
|
|
793
|
-
if tail != Self::TAIL {
|
|
794
|
-
error!("Decoding of TAIL failed! Got {} instead!", tail);
|
|
795
|
-
return Err(SerializationError::TailInvalid);
|
|
796
|
-
}
|
|
797
792
|
//println!("{}",te);
|
|
798
793
|
|
|
799
794
|
// FIXME - this is slow, use Arc<> instead. However, then make
|
|
@@ -804,6 +799,11 @@ impl Serialization for TofEvent {
|
|
|
804
799
|
te.hits.push(*h);
|
|
805
800
|
}
|
|
806
801
|
}
|
|
802
|
+
let tail = parse_u16(stream, pos);
|
|
803
|
+
if tail != Self::TAIL {
|
|
804
|
+
error!("Decoding of TAIL failed! Got {} instead!", tail);
|
|
805
|
+
return Err(SerializationError::TailInvalid);
|
|
806
|
+
}
|
|
807
807
|
return Ok(te);
|
|
808
808
|
}
|
|
809
809
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|