spkit.io.read_hdf

spkit.io.read_hdf(file_name, fs=25000, max_volt=1000, base_key='Data', signal_hkeys=['Recording_0', 'AnalogStream', 'Stream_0'], signal_key='ChannelData', info_key='InfoChannel', verbose=False, return_all=False, ch_axis=0)

Reading HDF File

Reading HDF File with default setting for MEA HDF files

Hierarchical Data Format

Parameters:
file_name: str,
  • full path of hdf file

fs: int, (default=25KHz)
  • sampling frequency

max_volt: scalar, (default=1000)
  • used while scaling the voltage of signal. It is the maximum voltage of stimulus.

  • If max_volt=None, no scalling is performed and raw values are returned,

  • Default datatype of signal recoridng is usually ‘int32’, which leades to range from -32768 to 32767

  • if max_volt is not None, then return signal values will be float32 and from -max_volt to max_volt

base_key: str, default=’Data’
  • First key of Hierarchical formatting

signal_hkeys: list of str,
  • default=[‘Recording_0’,’AnalogStream’,’Stream_0’]

  • Sequence of keys, where signal of each recorded channel is stored.

  • Exclude the final key of signals

signal_key: str, default=’ChannelData’
  • Final key for signals

info_key: str, default=’InfoChannel’
  • key for channel information, stored in signal_hkeys, for each channel

verbose: bool
  • To display file and signal info

return_all,bool, Default=False
ch_axis: int {0,1},default=0

if 0: shape of X (nch, n) if 1: shape of X (n,nch)

Returns:
Xarray of (n_ch,n)
  • n_ch = number of channels (i.e. 60), n number of samples, (if ch_axis=0)

  • if keys to hierarchical is given correctly, else file object is returned as X

fs:int,
  • Sampling frequency, same as passed to function

ch_labels: list of labels
  • labels of each channel, if correct keys are provided, else, either None,

  • or info of each channel is returned

Examples

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import requests
>>> import spkit as sp
>>> path = 'https://spkit.github.io/data_samples/files/MEA_Sample_North_1000mV_1Hz.h5'
>>> file_name= 'MEA_Sample_North_1000mV_1Hz.h5'
>>> req = requests.get(path)
>>> with open(file_name, 'wb') as f:
        f.write(req.content)
>>> fs = 25000
>>> X,fs,ch_labels = sp.io.read_hdf(file_name,fs=fs,verbose=1)
>>> # General Example
>>> # file_name = 'full_accessible_path/to_hdf_file.hdf'
>>> # X,fs,ch_labels = sp.io.read_hdf(file_name)

Examples using spkit.io.read_hdf

MEA: Step-wise Analysis: Example

MEA: Step-wise Analysis: Example