Skip to content

Commit 46ec913

Browse files
committed
#527 including NY head model file at startup
1 parent 6ce7292 commit 46ec913

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ RUN jupyter labextension disable @jupyterlab/hub-extension
5353
RUN chown $NB_UID .
5454
RUN chown -R $NB_UID workspace
5555

56-
# Temp fixes for eeg plots
57-
RUN wget -P `pip show LFPykit | grep "Location:" | awk '{print $2"/lfpykit"}'` https://www.parralab.org/nyhead/sa_nyhead.mat
5856

5957
USER $NB_UID
6058

netpyne_ui/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
import logging
2+
import sys
3+
import os
4+
15
from jupyter_geppetto.webapi import RouteManager
26
from netpyne_ui import api
7+
from netpyne_ui.constants import HERE
38
import sentry_sdk
49

510
sentry_sdk.init(
611
"https://d8bf7e40eec34cb9891f6dd8207b5e83@sentry.metacell.us/6"
712
)
813

14+
def init_eeg():
15+
import sys
16+
from netpyne_ui.constants import HERE
17+
# FIXES library asking for input to download
18+
sys.stdin = open(os.path.join(HERE, "resources/stdin.txt"),'r')
19+
from lfpykit.eegmegcalc import NYHeadModel
20+
try:
21+
NYHeadModel() # Downloads the model if does not exist
22+
except:
23+
logging.error("Error initializing the EEG head model", exc_info=True)
24+
25+
from multiprocessing import Process
26+
thread = Process(target = init_eeg)
27+
thread.start()
28+
29+
sys.stdin = open(os.path.join(HERE, "stdin.txt"),'r') # FIXES library asking for input to download -- eg lfpykit models
30+
31+
932
RouteManager.add_controller(api.NetPyNEController)
33+
34+

netpyne_ui/netpyne_geppetto.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ def __init__(self):
7575
if not simulations.local.is_running():
7676
[experiments.set_to_error(e) for e in running_exps]
7777

78+
# sys.stdin = open(os.path.join(constants.HERE, "stdin.txt"),'r') # FIXES library asking for input to download -- eg lfpykit models
79+
80+
# from ipykernel import kernelbase
81+
82+
# def raw_input(self, prompt=''):
83+
# return "y"
84+
# kernelbase.Kernel.raw_input = raw_input
85+
86+
# from lfpykit.eegmegcalc import NYHeadModel
87+
# NYHeadModel()
7888

7989
def getData(self):
8090
return {

netpyne_ui/resources/stdin.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
y
2+
y
3+
y
4+
y
5+
y

0 commit comments

Comments
 (0)