def transform_streamels(self, streamels): check_1d_bit_sequence(streamels, 'Encrypt') self.nbits = streamels.size bytes_required = nbytes_to_encrypt(self.nbits) bits_required = bytes_required * NBITS_IN_BYTE streamels2 = np.zeros(bits_required, streamel_dtype) streamels2['kind'] = ValueFormats.Discrete streamels2['lower'] = 0 streamels2['upper'] = 1 streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): check_1d_bit_sequence(streamels, 'Decrypt') if streamels.size != self.expect_nbits: msg = 'I expect %d bits to decrypt.' % self.expect_nbits raise UnsupportedSpec(msg) streamels2 = np.zeros(self.ngoodbits, streamel_dtype) streamels2['kind'] = ValueFormats.Discrete streamels2['lower'] = 0 streamels2['upper'] = 1 streamels2['default'] = self.transform_value(streamels['default']) return streamels2