pub struct RBCalibrations {
pub rb_id: u8,
pub d_v: f32,
pub timestamp: u32,
pub serialize_event_data: bool,
pub v_offsets: [[f32; 1024]; 9],
pub v_dips: [[f32; 1024]; 9],
pub v_inc: [[f32; 1024]; 9],
pub tbin: [[f32; 1024]; 9],
pub vcal_data: Vec<RBEvent>,
pub tcal_data: Vec<RBEvent>,
pub noi_data: Vec<RBEvent>,
}
Fields§
§rb_id: u8
§d_v: f32
§timestamp: u32
§serialize_event_data: bool
§v_offsets: [[f32; 1024]; 9]
§v_dips: [[f32; 1024]; 9]
§v_inc: [[f32; 1024]; 9]
§tbin: [[f32; 1024]; 9]
§vcal_data: Vec<RBEvent>
§tcal_data: Vec<RBEvent>
§noi_data: Vec<RBEvent>
Implementations§
Source§impl RBCalibrations
impl RBCalibrations
pub const NSKIP: usize = 2usize
pub const SINMAX: usize = 60usize
pub const DVCUT: f32 = 15f32
pub const NOMINALFREQ: f32 = 2f32
pub const CALFREQ: f32 = 0.0250000004f32
Sourcepub fn assemble_from_flightcal(
fcal_t: RBCalibrationsFlightT,
fcal_v: RBCalibrationsFlightV,
) -> Result<Self, CalibrationError>
pub fn assemble_from_flightcal( fcal_t: RBCalibrationsFlightT, fcal_v: RBCalibrationsFlightV, ) -> Result<Self, CalibrationError>
Re-assemble a RBCalibration from chopped up parts
Sourcepub fn emit_flighttcal(&self) -> RBCalibrationsFlightT
pub fn emit_flighttcal(&self) -> RBCalibrationsFlightT
Return the timing part of the calibration in a package digestable by the flight computer.
Additonal compression by using f16
Sourcepub fn emit_flightvcal(&self) -> RBCalibrationsFlightV
pub fn emit_flightvcal(&self) -> RBCalibrationsFlightV
Return the voltage part of the calibration in a package digestable by the flight computer.
Additional compression by using f16
Sourcepub fn clean_input_data(&mut self)
pub fn clean_input_data(&mut self)
Remove events with invalid traces or event fragment bits set
pub fn apply_vcal_constants( &self, adc: &Vec<f32>, channel: usize, stop_cell: usize, ) -> Vec<f32>
Sourcepub fn timing_calibration(
&self,
edge: &Edge,
apply_vcal: bool,
) -> Result<Vec<Vec<f32>>, CalibrationError>
pub fn timing_calibration( &self, edge: &Edge, apply_vcal: bool, ) -> Result<Vec<Vec<f32>>, CalibrationError>
Sourcepub fn calibrate(&mut self) -> Result<(), CalibrationError>
pub fn calibrate(&mut self) -> Result<(), CalibrationError>
Call to the calibration routine, using the set input data
Sourcepub fn spike_cleaning(
voltages: &mut Vec<Vec<f32>>,
stop_cell: u16,
) -> Result<(), WaveformError>
pub fn spike_cleaning( voltages: &mut Vec<Vec<f32>>, stop_cell: u16, ) -> Result<(), WaveformError>
Apply the spike cleaning to all channels
Sourcepub fn voltages(
&self,
channel: usize,
stop_cell: usize,
adc: &Vec<u16>,
waveform: &mut Vec<f32>,
)
pub fn voltages( &self, channel: usize, stop_cell: usize, adc: &Vec<u16>, waveform: &mut Vec<f32>, )
Apply the voltage calibration to a single channel FIXME - mixing of naming conventions for the channels
FIXME - make it return Result<(), CalibrationError>
§Arguments
- channel : Channel id 1-9
- stop_cell : This channels stop cell
- adc : Uncalibrated channel data
- waveform : Pre-allocated array to hold calibrated waveform data.
Sourcepub fn nanoseconds(
&self,
channel: usize,
stop_cell: usize,
times: &mut Vec<f32>,
)
pub fn nanoseconds( &self, channel: usize, stop_cell: usize, times: &mut Vec<f32>, )
Apply the timing calibration to a single channel
This will allocate the array for the waveform time bins (unit is ns)
§Arguments
- channel : Channel id 1-9
- stop_cell : This channels stop cell
pub fn new(rb_id: u8) -> Self
Sourcepub fn discard_data(&mut self)
pub fn discard_data(&mut self)
Discard the data to reduce the memory footprint
Sourcepub fn from_file(
filename: String,
discard_data: bool,
) -> Result<Self, SerializationError>
pub fn from_file( filename: String, discard_data: bool, ) -> Result<Self, SerializationError>
Gets the calibration from a file which has the RBCalibration stored in a TofPacket
E.g. if it was written with TofPacketWriter
Sourcepub fn from_txtfile(filename: &Path) -> Self
pub fn from_txtfile(filename: &Path) -> Self
Load a calibration from an asci file This is deperacted and only kept for compatibility reasons with older data
§Arguments:
- filename : human readable textfile with all calibraiton constants
Sourcepub fn get_id_from_filename(&mut self, filename: &Path) -> u8
pub fn get_id_from_filename(&mut self, filename: &Path) -> u8
Infer the readoutboard id from the filename
Assuming a certain naming scheme for the filename “rbXX_cal.txt” we extract the readoutboard id
Trait Implementations§
Source§impl Clone for RBCalibrations
impl Clone for RBCalibrations
Source§fn clone(&self) -> RBCalibrations
fn clone(&self) -> RBCalibrations
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RBCalibrations
impl Debug for RBCalibrations
Source§impl Default for RBCalibrations
impl Default for RBCalibrations
Source§impl Display for RBCalibrations
impl Display for RBCalibrations
Source§impl From<&Path> for RBCalibrations
impl From<&Path> for RBCalibrations
Source§impl From<&RBCalibrations> for TofPacket
impl From<&RBCalibrations> for TofPacket
Source§fn from(calib: &RBCalibrations) -> Self
fn from(calib: &RBCalibrations) -> Self
Source§impl From<&mut RBCalibrations> for TofPacket
impl From<&mut RBCalibrations> for TofPacket
Source§fn from(calib: &mut RBCalibrations) -> Self
fn from(calib: &mut RBCalibrations) -> Self
Source§impl FromRandom for RBCalibrations
impl FromRandom for RBCalibrations
fn from_random() -> Self
Source§impl Packable for RBCalibrations
impl Packable for RBCalibrations
const PACKET_TYPE: PacketType = PacketType::RBCalibration
Source§fn pack(&self) -> TofPacketwhere
Self: Serialization,
fn pack(&self) -> TofPacketwhere
Self: Serialization,
Source§impl PartialEq for RBCalibrations
impl PartialEq for RBCalibrations
Source§impl Serialization for RBCalibrations
impl Serialization for RBCalibrations
Source§const SIZE: usize = 294_918usize
const SIZE: usize = 294_918usize
const HEAD: u16 = 43_690u16
const TAIL: u16 = 21_845u16
Source§fn from_bytestream(
bytestream: &Vec<u8>,
pos: &mut usize,
) -> Result<Self, SerializationError>
fn from_bytestream( bytestream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, SerializationError>
Source§fn to_bytestream(&self) -> Vec<u8>
fn to_bytestream(&self) -> Vec<u8>
Source§fn verify_fixed(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<(), SerializationError>
fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), SerializationError>
Source§fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_slice(
_slice: &[u8],
_start_pos: usize,
) -> Result<Self, SerializationError>where
Self: Sized,
impl StructuralPartialEq for RBCalibrations
Auto Trait Implementations§
impl Freeze for RBCalibrations
impl RefUnwindSafe for RBCalibrations
impl Send for RBCalibrations
impl Sync for RBCalibrations
impl Unpin for RBCalibrations
impl UnwindSafe for RBCalibrations
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read more