Skip to content

Commit

Permalink
use fromstream
Browse files Browse the repository at this point in the history
  • Loading branch information
schwarzmario committed Jan 8, 2025
1 parent f8a4fbe commit 6db4542
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/daq2lh5/llama/llama_header_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def decode_header(self, f_in: io.BufferedReader) -> lgdo.Struct:
f_in.seek(0) # should be there anyhow, but re-set if not
header = f_in.read(16) # read 16 bytes
n_bytes_read += 16
evt_data_32 = np.fromstring(header, dtype=np.uint32)
evt_data_16 = np.fromstring(header, dtype=np.uint16)
evt_data_32 = np.frombuffer(header, dtype=np.uint32)
evt_data_16 = np.frombuffer(header, dtype=np.uint16)

# line0: magic bytes
magic = evt_data_32[0]
Expand Down
2 changes: 1 addition & 1 deletion src/daq2lh5/llama/llama_streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __read_bytes(self) -> tuple[bytes | None, int]:
return None, -1 # EOF, I guess
self.in_stream.seek(position) # go back to 1st position of event header

header_data_32 = np.fromstring(data1, dtype=np.uint32)
header_data_32 = np.frombuffer(data1, dtype=np.uint32)
fch_id = (header_data_32[0] >> 4) & 0x00000FFF

event_length_32 = self.header_decoder.get_channel_configs()[fch_id][
Expand Down

0 comments on commit 6db4542

Please sign in to comment.