pypore.data_file_opener module

Created on May 23, 2013

@author: parkin

pypore.data_file_opener.get_next_blocks()

Gets the next n blocks (~5000 data points) of data from filename.

Parameters:
  • datafile (DataFile) – An already open pypore.filetypes.data_file.DataFile.
  • params (DictType) –

    Parameters of the file, usually the ones returned from prepare_data_file().

    • Assumes ‘.h5’ extension is Pypore HDF5 format.
    • Assumes ‘.log’ extension is Chimera data. Chimera data requires a ‘.mat’ file with the same name to be in the same folder.
    • Assumes ‘.hkd’ extension is Heka data.
    • Assumes ‘.mat’ extension is Gaby’s format.
  • n (IntType) – Number of blocks to read and return.
Returns:

ListType<np.array> – List of numpy arrays, one for each channel of the data.

pypore.data_file_opener.open_data()

Opens a datafile and returns a dictionary with the data in ‘data’. If unable to return, will return an error message.

Parameters:
  • filename (StringType) –

    Filename to open.

    • Assumes ‘.h5’ extension is Pypore HDF5 format.
    • Assumes ‘.log’ extension is Chimera data. Chimera data requires a ‘.mat’ file with the same name to be in the same folder.
    • Assumes ‘.hkd’ extension is Heka data.
    • Assumes ‘.mat’ extension is Gaby’s format.
  • decimate (BooleanType) – Whether or not to decimate the data. Default is False.
Returns:

DictType – dictionary with data in the ‘data’ key. If there is an error, it will return a dictionary with ‘error’ key containing a String error message.

pypore.data_file_opener.prepare_data_file()

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

Parameters:filename (StringType) –

Filename to open and read parameters.

  • Assumes ‘.h5’ extension is Pypore HDF5 format.
  • Assumes ‘.log’ extension is Chimera data. Chimera data requires a ‘.mat’ file with the same name to be in the same folder.
  • Assumes ‘.hkd’ extension is Heka data.
  • Assumes ‘.mat’ extension is Gaby’s format.
Returns:2 things:
  1. datafile – already opened pypore.filetypes.data_file.DataFile.
  2. params – parameters read from the file.

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