diff --git a/libertem_qd_mpx/src/background_thread.rs b/libertem_qd_mpx/src/background_thread.rs index 3dbe577e..12bbe1cd 100644 --- a/libertem_qd_mpx/src/background_thread.rs +++ b/libertem_qd_mpx/src/background_thread.rs @@ -11,7 +11,7 @@ use common::{ frame_stack::{FrameMeta, FrameStackForWriting, FrameStackWriteError, WriteGuard}, generic_connection::AcquisitionConfig, tcp::{self, ReadExactError}, - utils::{num_from_byte_slice, three_way_shift, NumParseError}, + utils::{num_from_byte_slice, NumParseError}, }; use ipc_test::{slab::ShmError, SharedSlabAllocator}; use log::{debug, error, info, trace, warn}; @@ -537,6 +537,16 @@ fn passive_acquisition( // hardware trigger): let first_frame_meta: QdFrameMeta = peek_first_frame_header(&mut stream, to_thread_r)?; + match &first_frame_meta.mq1a { + None => warn!("missing mq1a header, this will probably cause issues in raw mode!"), + Some(mq1a) => match mq1a.counter_depth { + 1 | 6 | 12 | 24 => {} + _ => { + warn!("unknown counter depth {}", mq1a.counter_depth); + } + }, + } + acquisition( to_thread_r, from_thread_s, diff --git a/libertem_qd_mpx/src/base_types.rs b/libertem_qd_mpx/src/base_types.rs index 2fe762e0..ac3457ba 100644 --- a/libertem_qd_mpx/src/base_types.rs +++ b/libertem_qd_mpx/src/base_types.rs @@ -415,7 +415,30 @@ impl FrameMeta for QdFrameMeta { } fn get_dtype_string(&self) -> String { - todo!() + let raw_dtype = if let Some(mq1a) = &self.mq1a { + match mq1a.counter_depth { + 1 | 6 => "uint8", + 12 => "uint16", + 24 => "uint32", + _ => { + // FIXME: unknown counter depth; can't determine raw dtype! + "uint8" + } + } + } else { + // FIXME: not really correct, but we can't know the data type if the + // detector doesn't include the mq1a header! + "uint8" + }; + + match self.dtype { + DType::U01 | DType::U08 => "uint8", + DType::U16 => "uint16", + DType::U32 => "uint32", + DType::U64 => "uint64", + DType::R64 => raw_dtype, + } + .to_owned() } fn get_shape(&self) -> (u64, u64) {