pypore.i_o.abstract_reader module

class pypore.i_o.abstract_reader.AbstractReader

Bases: object

This is an abstract class showing the methods that subclasses must override.

-Subclasses should implement opening full data files. -Subclasses should implement lazy loading with pypore.i_o.abstract_reader.get_next_blocks()
__init__

Opens a data file, reads relevant parameters, and returns then open file and parameters.

Parameters:filename (StringType) – Filename to open and read parameters.

If there was an error opening the files, params will have ‘error’ key with string description.

close()

(Note this is a cpdef wrapper around the cdef method close_c(). If using Cython, you can directly call the cdef version.)

Closes the file and the reader.

get_all_data(bool decimate=False)

(Note this is a cpdef wrapper around the cdef method get_all_data_c(). If using Cython, you can call the cdef version directly.)

Reads and returns all of the data in the file.

Parameters:decimate (BooleanType) – Whether or not to decimate the data. Default is False.
Returns:List of numpy arrays, one for each channel of the data.
get_filename()

(Note this is a cpdef wrapper around the cdef method get_next_blocks_c(). If using Cython, you can call the cdef version directly.) :returns: the filename being read.

get_next_blocks(long n_blocks=1)

(Note this is a cpdef wrapper around the cdef method get_next_blocks_c(). If using Cython, you can call the cdef version directly.)

Gets the next n_blocks (~5000 data points per block) of data from filename.

Parameters:n_blocks (IntType) – Number of blocks to read and return.
Returns:ListType<np.array> – List of numpy arrays, one for each channel of the data.
get_points_per_channel_total()

(Note this is a cpdef wrapper around the cdef method get_next_blocks_c(). If using Cython, you can call the cdef version directly.)

Returns:the total number of points in each channel of data.
get_sample_rate()

(Note this is a cpdef wrapper around the cdef method get_next_blocks_c(). If using Cython, you can call the cdef version directly.)

Returns:sample rate of the file.
points_per_channel_total
sample_rate