@@ -31,11 +31,11 @@ def parse_direct_events(de_data: bytes) -> dict[str, npt.ArrayLike]:
3131 IMAP-Hi direct event data information is stored in
3232 48-bits as follows:
3333
34- | Read 48-bits into 2, 16 , 10, 10, 10, bits. Each of these breaks
34+ | Read 48-bits into 16, 2 , 10, 10, 10, bits. Each of these breaks
3535 | down as:
3636 |
37- | start_bitmask_data - 2 bits (tA=1, tB=2, tC1=3, META=0)
3837 | de_tag - 16 bits
38+ | start_bitmask_data - 2 bits (tA=1, tB=2, tC1=3)
3939 | tof_1 - 10 bit counter
4040 | tof_2 - 10 bit counter
4141 | tof_3 - 10 bit counter
@@ -70,16 +70,16 @@ def parse_direct_events(de_data: bytes) -> dict[str, npt.ArrayLike]:
7070 # direct events.
7171 # Considering the 6-bytes of data for each DE as 3 2-byte words,
7272 # each word contains the following:
73- # word_0: 2-bits of Trigger ID, upper 14 -bits of de_tag
74- # word_1: lower 2-bits of de_tag , 10-bits tof_1, upper 4-bits of tof_2
73+ # word_0: full 16 -bits is the de_tag
74+ # word_1: 2-bits of Trigger ID , 10-bits tof_1, upper 4-bits of tof_2
7575 # word_2: lower 6-bits of tof_2, 10-bits of tof_3
7676 data_uint16 = np .reshape (
7777 np .frombuffer (de_data , dtype = ">u2" ), (3 , - 1 ), order = "F"
7878 ).astype (np .uint16 )
7979
8080 de_dict = dict ()
81- de_dict ["trigger_id " ] = ( data_uint16 [0 ] >> 14 ). astype ( np . uint8 )
82- de_dict ["de_tag " ] = (data_uint16 [0 ] << 2 ) + ( data_uint16 [ 1 ] >> 14 )
81+ de_dict ["de_tag " ] = data_uint16 [0 ]
82+ de_dict ["trigger_id " ] = (data_uint16 [1 ] >> 14 ). astype ( np . uint8 )
8383 de_dict ["tof_1" ] = (data_uint16 [1 ] & int (b"00111111_11110000" , 2 )) >> 4
8484 de_dict ["tof_2" ] = ((data_uint16 [1 ] & int (b"00000000_00001111" , 2 )) << 6 ) + (
8585 data_uint16 [2 ] >> 10
0 commit comments