(self, start_index=0, count=-1, autoscale=True, raw_components=False)
return data
Reads the specified number of samples starting at the specified index from the associated data file.

        Parameters
        ----------
        start_index : int, default 0
            Starting sample index from which to read.
        count : int, default -1
            Number of samples to read. -1 will read whole file.
        autoscale : bool, default True
            If dataset is in a fixed-point representation, scale samples from (min, max) to (-1.0, 1.0)
        raw_components : bool, default False
            If True read and return the sample components (individual I & Q for complex, samples for real)
            with no conversions or interleaved channels.

        Returns
        -------
        data : ndarray
            Samples are returned as an array of float or complex, with number of dimensions equal to NUM_CHANNELS_KEY.
Reads the specified number of samples starting at the specified index from the associated data file.
Reads the specified number of samples starting at the specified index from the associated data file .
def read_samples(self, start_index=0, count=-1, autoscale=True, raw_components=False):
        '''
        Reads the specified number of samples starting at the specified index from the associated data file.

        Parameters
        ----------
        start_index : int, default 0
            Starting sample index from which to read.
        count : int, default -1
            Number of samples to read. -1 will read whole file.
        autoscale : bool, default True
            If dataset is in a fixed-point representation, scale samples from (min, max) to (-1.0, 1.0)
        raw_components : bool, default False
            If True read and return the sample components (individual I & Q for complex, samples for real)
            with no conversions or interleaved channels.

        Returns
        -------
        data : ndarray
            Samples are returned as an array of float or complex, with number of dimensions equal to NUM_CHANNELS_KEY.
        '''
        if count == 0:
            raise IOError('Number of samples must be greater than zero, or -1 for all samples.')
        elif start_index + count > self.sample_count:
            raise IOError("Cannot read beyond EOF.")
        if self.data_file is None:
            if self.get_global_field(self.METADATA_ONLY_KEY, False):
                # only if data_file is `None` allows access to dynamically generated datsets
                raise SigMFFileError("Cannot read samples from a metadata only distribution.")
            else:
                raise SigMFFileError("No signal data file has bfeen associated with the metadata.")

        dtype = dtype_info(self.get_global_field(self.DATATYPE_KEY))
        is_complex_data = dtype['is_complex']
        is_fixedpoint_data = dtype['is_fixedpoint']
        is_unsigned_data = dtype['is_unsigned']
        data_type_in = dtype['sample_dtype']
        component_type_in = dtype['component_dtype']
        sample_size = dtype['sample_size']
        component_size = dtype['component_size']

        data_type_out = np.dtype("f4") if not is_complex_data else np.dtype("f4, f4")
        num_channels = self.get_num_channels()

        fp = open(self.data_file, "rb")
        fp.seek(start_index * sample_size * num_channels, 0)

        data = np.fromfile(fp, dtype=data_type_in, count=count*num_channels)
        if num_channels != 1:
            # return reshaped view for num_channels
            # first dimension will be double size if `is_complex_data`
            data = data.reshape(data.shape[0] // num_channels, num_channels)
        if not raw_components:
            data = data.astype(data_type_out)
            if autoscale and is_fixedpoint_data:
                data = data.view(np.dtype("f4"))
                if is_unsigned_data:
                    data -= 2**(component_size*8-1)
                data *= 2**-(component_size*8-1)
                data = data.view(data_type_out)
            if is_complex_data:
                data = data.view(np.complex64)
        else:
            data = data.view(component_type_in)

        fp.close()
        return data
def read_samples ( self , start_index = 0 , count = - 1 , autoscale = True , raw_components = False ) : if count == 0 : raise IOError ( 'Number of samples must be greater than zero, or -1 for all samples.' ) elif start_index + count > self . sample_count : raise IOError ( "Cannot read beyond EOF." ) if self . data_file is None : if self . get_global_field ( self . METADATA_ONLY_KEY , False ) : # only if data_file is `None` allows access to dynamically generated datsets raise SigMFFileError ( "Cannot read samples from a metadata only distribution." ) else : raise SigMFFileError ( "No signal data file has bfeen associated with the metadata." ) dtype = dtype_info ( self . get_global_field ( self . DATATYPE_KEY ) ) is_complex_data = dtype [ 'is_complex' ] is_fixedpoint_data = dtype [ 'is_fixedpoint' ] is_unsigned_data = dtype [ 'is_unsigned' ] data_type_in = dtype [ 'sample_dtype' ] component_type_in = dtype [ 'component_dtype' ] sample_size = dtype [ 'sample_size' ] component_size = dtype [ 'component_size' ] data_type_out = np . dtype ( "f4" ) if not is_complex_data else np . dtype ( "f4, f4" ) num_channels = self . get_num_channels ( ) fp = open ( self . data_file , "rb" ) fp . seek ( start_index * sample_size * num_channels , 0 ) data = np . fromfile ( fp , dtype = data_type_in , count = count * num_channels ) if num_channels != 1 : # return reshaped view for num_channels # first dimension will be double size if `is_complex_data` data = data . reshape ( data . shape [ 0 ] // num_channels , num_channels ) if not raw_components : data = data . astype ( data_type_out ) if autoscale and is_fixedpoint_data : data = data . view ( np . dtype ( "f4" ) ) if is_unsigned_data : data -= 2 ** ( component_size * 8 - 1 ) data *= 2 ** - ( component_size * 8 - 1 ) data = data . view ( data_type_out ) if is_complex_data : data = data . view ( np . complex64 ) else : data = data . view ( component_type_in ) fp . close ( ) return data