Skip to content

MEAlytics as Python package

Besides the GUI, the MEA analysis tool can also be called as a python library, and has a few functions that can be of use to the user. Let’s walk through an example to fully analyse a MEA file.

Analysing MEA file

Firstly, import the necessary functions and assign a variable that points to your raw data file:

1
2
3
from MEAlytics.mea import analyse_wells, get_default_parameters

fileadress='C:/mea_data/mea_experiment.h5'

Next, we retrieve the dictionary containing the default parameters so we can alter the analysis. In this case we turn on multiprocessing to speed up the analysis.

1
2
parameters = get_default_parameters()
parameters['use multiprocessing'] = True

Finally, pass all the arguments to the analyse_wells function to initiate the analysis. Because we turned on multiprocessing, we must use and “if __name__ == ‘__main__’: “ guard here. Otherwise, the application will eventually create an infinite number of processes and eventually crash.

1
2
if __name__ == '__main__':
    analyse_wells(fileadress=fileadress, parameters=parameters)

In the end, it should look like this:

1
2
3
4
5
6
7
8
9
from MEAlytics.mea import analyse_wells, get_default_parameters

fileadress='C:/mea_data/mea_experiment.h5'

parameters = get_default_parameters()
parameters['use multiprocessing'] = True

if __name__ == '__main__':
    analyse_wells(fileadress=fileadress, parameters=parameters)