Control LED with Siri on RaspberryPi via Apple HomeKit

I have always wanted to try Apple HomeKit out. While I did’t want to spend ridiculous amount of money to just find out I have decided to build this on my own as see.

I had RaspberryPi 3 in home without any purpose. Originaly I bought this computer for learning in electronics and programming. I did some basic stuffs like controling LEDs, LCD etc. and then I bought Arduino for my projects. So it was the right time to get a life to this little guy.

Continue reading “Control LED with Siri on RaspberryPi via Apple HomeKit”


Online visual angle converter

As I face sometimes to converting visual angle to size in pixels and vice versa in some experiments I have decided to adopt a JavaScript tool which runs in a browser to convert these units.

Since I use a lot excelent piece of software called OpenSesame for building my experiments I found a documentation for visual angle conversion from Sebastiaan Mathôt.

So I adopted his Python 2.7 code into JavaScript to be able to quickly convert visual angle units on the run without Python installed. Maybe you find it useful too:


Best macOS backend for graphics in Spyder IDE

This time it will be short review of what I have found. As you can read here I got to work Spyder IDE in macOS as standalone app with Python 3.5 in it (backed it up in DMG file).

As I usually work with EEG data I picked a MNE module for my data analysis tool. In this manner I need to use interactive graphs and plots. On retina screen which is not still managable in Qt5 enviroment from some reason.

So, what to do when using retina resolution at macOS and would like to use interactive plots?

Continue reading “Best macOS backend for graphics in Spyder IDE”

Concatenate epochs across subjects in Python-MNE

I switched to open source science in my case done by open source Python module MNE. Python-MNE has also module for MATLAB (for reading MNE dedicated FIF files containing everything) and C (for source localization and channel corregistration toolbox, which I believe only works on Linux and macOS). It works with Python 3 and above same as with good old 2.7.

Spectral topography of click sound stimulation (just for education purpose).

Continue reading “Concatenate epochs across subjects in Python-MNE”

Decision tree classifier model

Introduction to machine learning

Today we take a closer look at the most basic machine learning algorithm to train on well-known dataset of Iris flowers (it has itself even Wikipedia page) and predict new Iris flowers based on your measurements.

First of all, we need to have Python installed (this tutorial is written for Python 2.7). Then some proper Python IDE or some text editor. I highly recommend Spyder (for Windows) and CodeRunner (for macOS).

We are ready to go. So how machine learning works? Well, you need some dataset and some classifier. Each dataset has to contain some measurements e.g., attributes and some labels of class e.g., predictors. Each row represents one instance. On the other hand, classifier is considered as instance of sci-kit learn library object (programmatically speaking). So we need some dataset and create instance of some classifier to train it.

Continue reading “Decision tree classifier model”

Data science with Python? No problem!

Maybe you think what is the purpose of using Python when MATLAB is around (or maybe Maple, Mathematica or even R). First of all I lived in paradigm that Python is only good for learning and for proper coding I would rather use C++ and for scientific computation MATLAB or R.

My EEG expertize is based on MATLABs toolbox EEGLAB. I faced too many times compatability issues (newer version of MATLAB versus newer version of EEGLAB) and so slow performace (in some tasks). Since then I re-discovered a Python programming language and started to experiment with it.

Then i found excelent tool for EEG analysis Python-MNE, machine learning and others. Not even that works everywhere and it is open-source but it is soooo faster than MATLAB. Did I mention that every Python module I have tried had great documentation with gallery of most wanted exampled from scratch to final product? And tutorials on GitHub? No? Well, that’s why I try to switch to Python as many scientists are nowadays.

Continue reading “Data science with Python? No problem!”