IO classes to read files in the different format Asari lab is acquiring from: hdf5, rhd, raw, npy, all adapted from the SpykingCircus project by Pierre Yger and Olivier Marre https://spyking-circus.readthedocs.io/en/latest/
%load_ext autoreload
%autoreload 2

atoi[source]

atoi(text)

natural_keys[source]

natural_keys(text)

alist.sort(key=natural_keys) sorts in human order http://nedbatchelder.com/blog/200712/human_sorting.html (See Toothy's implementation in the comments)

filter_per_extension[source]

filter_per_extension(files, extension)

print_and_log(to_print, level='info', logger=None, display=True)

print_info(lines)

Prints informations messages, enhanced graphical aspects.

print_error(lines)

Prints errors messages, enhanced graphical aspects.

get_offset[source]

get_offset(data_dtype, dtype_offset)

class DataFile[source]

DataFile(file_name, params, is_empty=False, stream_mode=None)

A generic class that will represent how the program interacts with the data. Such an abstraction layer should allow people to write their own wrappers, for several file formats, with or without parallel write, streams, and so on. Note that depending on the complexity of the datastructure, this extra layer can slow down the code.

read_header[source]

read_header(fid)

Reads the Intan File Format header from the given file.

get_bytes_per_data_block[source]

get_bytes_per_data_block(header)

Calculates the number of bytes in each 60-sample datablock.

read_qstring[source]

read_qstring(fid)

Read Qt style QString.

The first 32-bit unsigned number indicates the length of the string (in bytes). If this number equals 0xFFFFFFFF, the string is null.

Strings are stored as unicode.

class RHDFile[source]

RHDFile(file_name, params, is_empty=False, stream_mode=None) :: DataFile

A generic class that will represent how the program interacts with the data. Such an abstraction layer should allow people to write their own wrappers, for several file formats, with or without parallel write, streams, and so on. Note that depending on the complexity of the datastructure, this extra layer can slow down the code.

class H5File[source]

H5File(file_name, params, is_empty=False, stream_mode=None) :: DataFile

A generic class that will represent how the program interacts with the data. Such an abstraction layer should allow people to write their own wrappers, for several file formats, with or without parallel write, streams, and so on. Note that depending on the complexity of the datastructure, this extra layer can slow down the code.

class RawBinaryFile[source]

RawBinaryFile(file_name, params, is_empty=False, stream_mode=None) :: DataFile

A generic class that will represent how the program interacts with the data. Such an abstraction layer should allow people to write their own wrappers, for several file formats, with or without parallel write, streams, and so on. Note that depending on the complexity of the datastructure, this extra layer can slow down the code.

class NumpyFile[source]

NumpyFile(file_name, params, is_empty=False, stream_mode=None) :: RawBinaryFile

A generic class that will represent how the program interacts with the data. Such an abstraction layer should allow people to write their own wrappers, for several file formats, with or without parallel write, streams, and so on. Note that depending on the complexity of the datastructure, this extra layer can slow down the code.

load_all_data[source]

load_all_data(datafile:DataFile)

Read all the data contained by a file. For rhd and hdf5, correspond to the ephy channels. To read the ADC data, see load_all_data_adc

load_all_data_adc[source]

load_all_data_adc(datafile:DataFile, channel_idx=0)

Read all the data contained by a file. For rhd and hdf5, correspond to the adc channels. To read the ephy data, see load_all_data

load_all_data_dig_in[source]

load_all_data_dig_in(datafile:DataFile, channel_idx=0)

Read all the data contained by a file. For rhd and hdf5, correspond to the adc channels. To read the ephy data, see load_all_data

load_all_data_both[source]

load_all_data_both(datafile:DataFile)

Read all the data contained by a file. For rhd and hdf5, correspond to the adc channels. To read the ephy data, see load_all_data

export_adc_raw[source]

export_adc_raw(datafile:DataFile, output_fn='', channel_idx=0)

Exports a datafile adc channel to a single raw binary file. Useful to reduce disk usage after that spike sorting is done.

export_dig_in_raw[source]

export_dig_in_raw(datafile:DataFile, output_fn='', channel_idx=0)

Exports a datafile adc channel to a single raw binary file. Useful to reduce disk usage after that spike sorting is done.

export_raw[source]

export_raw(datafile:DataFile, output_fn='')

Exports a datafile adc channel to a single raw binary file. Useful to reduce disk usage after that spike sorting is done.

export_both_raw[source]

export_both_raw(datafile:DataFile)

Exports a both raw data, adc and ephy.

load_adc_raw[source]

load_adc_raw(filepath, sampling_rate=30000)

Loads adc raw data, in the format exported by export_adc_raw

load_digin_raw[source]

load_digin_raw(filepath, sampling_rate=30000)

Loads adc raw data, in the format exported by export_adc_raw

load_sync_raw[source]

load_sync_raw(filepath, sampling_rate=10000)

Loads the sync files made by labview for Asari Lab 2P setup