コード例 #1
0
 def fix_data(self, raw_data, is_randomized, is_alternate_bit):
     del is_randomized, is_alternate_bit
     cm_data = None
     if self.verify:
         data = self._get_data_and_check_df(raw_data)
     elif self.is_filtered_data:
         data = funcs.fix_data([d >> 8 for d in raw_data], 24, 24, True) 
     else:
         data, cm_data = self._get_data_and_common_mode(raw_data)
     return data, cm_data
コード例 #2
0
 def _get_data_and_check_df(self, data):
     
     # figure out the expected metadata
     df_code = self.df_map[self.df]
     check = ((df_code + 2) << 4) | 0x06
     check_mask = 0x000000FF
     
     # check metadata
     for d in data:
         if (d & check_mask) != check:
             raise errs.HardwareError("Invalid metadata")
             
     return funcs.fix_data([d >> 8 for d in data], 24, 24, True) 
コード例 #3
0
    def collect(
        self,
        num_samples,
        trigger,
        timeout=5,
        is_randomized=False,
        is_alternate_bit=False,
    ):
        num_samples = num_samples * self.num_channels
        funcs.start_collect(self, num_samples, trigger, timeout)
        self.vprint('Data collect done.')
        self.vprint('Reading data')

        num_bytes, raw_data = self.controller.data_receive_uint16_values(
            end=num_samples)
        if num_bytes != num_samples * 2:
            raise errs.HardwareError("Didn't get all bytes")
        self.vprint('Data read done')

        data = funcs.fix_data(raw_data, self.num_bits, self.alignment,
                              self.is_bipolar, is_randomized, is_alternate_bit)
        return funcs.scatter_data(data, self.num_channels)
コード例 #4
0
 def fix_data(self, raw_data, is_randomized, is_alternate_bit):
     return funcs.fix_data(raw_data, self.num_bits, self.alignment,
                           self.is_bipolar, is_randomized, is_alternate_bit)
コード例 #5
0
 def fix_data(self, raw_data, is_randomized, is_alternate_bit):
     raw_data = self._get_data(raw_data)
     return funcs.fix_data(raw_data, self.num_bits, 16, self.is_bipolar,
                           is_randomized, is_alternate_bit)
コード例 #6
0
 def fix_data(self, raw_data, is_randomized, is_alternate_bit):
     raw_data = self._get_data_subset(raw_data)
     self._check_data(raw_data)
     return funcs.fix_data([d >> 14 for d in raw_data], self.num_bits, 18,
                           self.is_bipolar, is_randomized, is_alternate_bit)
コード例 #7
0
 def _get_all_data(self, raw_data):
     cm_data = funcs.fix_data(raw_data[:], 7, 7, True)
     cm_data = funcs.uint32_to_int32(cm_data)
     data = funcs.fix_data([int(d >> 7) for d in raw_data], 24, 24, True)
     overflow = [(d & 0x80000000) != 0 for d in raw_data]
     return data, cm_data, overflow
コード例 #8
0
 def fix_data(self, raw_data, is_randomized, is_alternate_bit):
     if self.verify:
         raw_data = self._get_data(raw_data)
     return funcs.fix_data(raw_data, self.num_bits, self.alignment,
                           self.is_bipolar, is_randomized, is_alternate_bit)
コード例 #9
0
 def _get_data_and_common_mode(self, raw_data):
     cm_data = funcs.fix_data(raw_data[:], 8, 18, True)
     cm_data = funcs.uint32_to_int32(cm_data)
     data = funcs.fix_data([int(d >> 18) for d in raw_data], 14, 14, True)
     return data, cm_data