Skip to content

Instantly share code, notes, and snippets.

View pietromarchesi's full-sized avatar

Pietro Marchesi pietromarchesi

  • University of Amsterdam
View GitHub Profile
@pietromarchesi
pietromarchesi / mutual_info.py
Created December 23, 2016 12:50 — forked from GaelVaroquaux/mutual_info.py
Estimating entropy and mutual information with scikit-learn
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
These computations rely on nearest-neighbor statistics
'''
import numpy as np
library(psych)
"
Analyze the difference between change and initial value.
Source:
Tu, Y. K. (2016). Testing the relation between percentage change
and baseline value. Scientific reports, 6.
"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
n_stim = 3
n_responses = 2
trial_size = 10
n_trials_per_stimtype = 50
n_neurons = 84
single_trial_data = np.zeros([n_trials_per_stimtype, n_neurons, n_stim, n_responses, trial_size])
single_trial_data.fill(np.NaN)
import numpy as np
n_stim = 3
n_responses = 2
trial_size = 10
n_trials_per_stimtype = 50
n_neurons = 4
single_trial_data = np.zeros([n_trials_per_stimtype, n_neurons, n_stim, n_responses, trial_size])
single_trial_data.fill(np.NaN)

Setting up a Python environment on JULIA with virtualenvwrapper

I find the system Python I want to use by doing

$ module avail python

Then we can load Python 3.6 with

$ module load python/3.6.1

Python environments on the JULIA system

There are different tools for managing virtual Python environments (see this answer on Stack Overflow for an overview). Here we give some instructions on how to get started using virtual environments on the JULIA system using venv (Python 3 support only) and virtualenvwrapper (an extension of the popular virtualenv, which can be used with both Python 2 and 3).

Recommended: managing environments using venv (Python 3 only)

venv is a package automatically shipped with Python 3. This method is quite straightforward, but it does not support Python 2 (for that, you can look at the second method using virtualenvwrapper which works for both Python 2 and 3).

To begin, we find the Python installation that we want to use by doing

$ module avail python

Python environments on the JULIA system

There are different tools for managing virtual Python environments (see this answer on Stack Overflow for an overview). Here we give some instructions on how to get started using virtual environments on the JULIA system using venv (Python 3 support only) and virtualenvwrapper (an extension of the popular virtualenv, which can be used with both Python 2 and 3).

Recommended: managing environments using venv (Python 3 only)

venv is a package automatically shipped with Python 3. This method is quite straightforward, but it does not support Python 2 (for that, you can look at the second method using virtualenvwrapper which works for both Python 2 and 3).

To begin, we find the Python installation that we want to use by doing

$ module avail python
@pietromarchesi
pietromarchesi / sciluigi_slurm_example.py
Created February 1, 2018 16:12
SciLuigi workflow for SLURM
import os
import luigi
import sciluigi
class MyWorkflow(sciluigi.WorkflowTask):
runmode = luigi.Parameter()
def workflow(self):
if self.runmode == 'local':