Skip to content

Commit

Permalink
fixed bug AllenInstitute#7, and added dockerfiles for ubuntu and fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasc committed Oct 3, 2016
1 parent 5ebf180 commit 3de5649
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
.cache
update.sh
doc
.DS_Store
Expand Down
3 changes: 2 additions & 1 deletion dipde/internals/externalpopulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sympy.parsing.sympy_parser as symp
from sympy.utilities.lambdify import lambdify
from sympy.abc import t as sym_t
from sympy import Piecewise


class ExternalPopulation(object):
Expand Down Expand Up @@ -48,7 +49,7 @@ class ExternalPopulation(object):
def __init__(self, firing_rate, record=False, **kwargs):

self.firing_rate_string = str(firing_rate)
self.closure = lambdify(sym_t,symp.parse_expr(self.firing_rate_string))
self.closure = lambdify(sym_t, symp.parse_expr(self.firing_rate_string, local_dict={'Heaviside': lambda x: Piecewise((0, x < 0), (1, x > 0), (.5, True))}))

self.record = record
self.type = "external"
Expand Down
12 changes: 12 additions & 0 deletions docker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This version of dipde supports docker images for Fedora 24 and Ubuntu 16. Other OS versions may work, but are not currently tested; if you need a docker image that is not supported email the MAINTAINER for help.

To build the docker images:
1) Install docker: https://docs.docker.com/engine/installation/
2) cd to the dipde docker directory
3) Run:
3a) Fedora: docker build --tag alleninstitute/dipde:fedora24 -f ./fedora_24_python.dockerfile .
3b) Ubuntu: docker build --tag alleninstitute/dipde:ubuntu16 -f ./ubuntu_16.04_python.dockerfile .
4) Run the dipde tests to validate the installation:
export DIPDEDIR=`pwd`'/../'
4a) Fedora: docker run -v $DIPDEDIR:/python/dipde -t -i alleninstitute/dipde:fedora24 python setup.py test
4b) Ubuntu: docker run -v $DIPDEDIR:/python/dipde -t -i alleninstitute/dipde:ubuntu16 python setup.py test
14 changes: 14 additions & 0 deletions docker/fedora_24_python.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM fedora:24

MAINTAINER Nicholas Cain <[email protected]>

RUN dnf -y install \
python \
python-matplotlib \
python-pip \
python-scipy \
python-pytest

RUN pip install sympy
ENV PYTHONPATH /python/dipde
WORKDIR /python/dipde
10 changes: 10 additions & 0 deletions docker/ubuntu_16.04_python.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:16.04

MAINTAINER Nicholas Cain <[email protected]>

RUN apt-get update
RUN apt-get -y install python python-pip python-scipy python-pytest python-matplotlib

RUN pip install sympy
ENV PYTHONPATH /python/dipde
WORKDIR /python/dipde

0 comments on commit 3de5649

Please sign in to comment.