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 = 2
pub const SINMAX: usize = 60
pub const DVCUT: f32 = 15.0
pub const NOMINALFREQ: f32 = 2.0
pub const CALFREQ: f32 = 0.025
Sourcepub fn assemble_from_flightcal(
fcal_t: RBCalibrationFlightT,
fcal_v: RBCalibrationFlightV,
) -> Result<Self, CalibrationError>
pub fn assemble_from_flightcal( fcal_t: RBCalibrationFlightT, fcal_v: RBCalibrationFlightV, ) -> Result<Self, CalibrationError>
Re-assemble a RBCalibration from chopped up parts
Sourcepub fn emit_flighttcal(&self) -> RBCalibrationFlightT
pub fn emit_flighttcal(&self) -> RBCalibrationFlightT
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) -> RBCalibrationFlightV
pub fn emit_flightvcal(&self) -> RBCalibrationFlightV
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 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
Sourcepub fn passes_timing_checks(&self) -> bool
pub fn passes_timing_checks(&self) -> bool
Self check if the timing constants are sane
Sourcepub fn passes_voltage_checks(&self) -> bool
pub fn passes_voltage_checks(&self) -> bool
Self check if the voltage constants are sane
Sourcepub fn check(&self) -> bool
pub fn check(&self) -> bool
Check voltage and timing constants for sanity
for each RB channel take distribution of 1024 calibration constants and confirm
Tcal: average value between 0.48824 and 0.48834 standard deviation between 0.08 and 0.15. Most common problem: avg of tcal distribution is < 0.48824
Vcal1 (offsets): average value between 4200 and 5200 standard deviation less than 150
Vcal2 (droop): average value between -0.5 and 0.5 print out a warning if the standard deviation for any channel is > 5.0 Note that ch1 on any particular board has a more dramatic droop so if ch1 droop is the only channel on the board with this warning, it can be ignored
Vcal3 (gain): average value between 0.06 and 0.07 standard deviation less than 0.00025
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 FromRandom for RBCalibrations
Available on crate feature random only.
impl FromRandom for RBCalibrations
random only.fn from_random() -> Self
Source§impl PartialEq for RBCalibrations
impl PartialEq for RBCalibrations
Source§impl Serialization for RBCalibrations
impl Serialization for RBCalibrations
Source§const SIZE: usize
const SIZE: usize
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 guess_size(
stream: &Vec<u8>,
pos: usize,
offset: usize,
) -> Result<(usize, usize, usize), SerializationError>
fn guess_size( stream: &Vec<u8>, pos: usize, offset: usize, ) -> Result<(usize, usize, usize), SerializationError>
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_bytestream_alt(
bytestream: &Vec<u8>,
pos: &mut usize,
) -> Result<Self, SerializationError>where
Self: Sized,
fn from_bytestream_alt(
bytestream: &Vec<u8>,
pos: &mut usize,
) -> Result<Self, SerializationError>where
Self: Sized,
Source§impl TofPackable for RBCalibrations
impl TofPackable for RBCalibrations
const TOF_PACKET_TYPE: TofPacketType = TofPacketType::RBCalibration
const TOF_PACKET_TYPE_ALT: TofPacketType = TofPacketType::Unknown
Source§fn pack(&self) -> TofPacketwhere
Self: Serialization,
fn pack(&self) -> TofPacketwhere
Self: Serialization,
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> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.