Skip to content

Commit

Permalink
Merge pull request #428 from Hjorthmedh/neuromod_redux2
Browse files Browse the repository at this point in the history
Neuromod redux2
  • Loading branch information
Hjorthmedh authored Sep 10, 2024
2 parents c6b922a + f3cb61d commit f3abf06
Show file tree
Hide file tree
Showing 12 changed files with 2,196 additions and 13 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
from snudda.input.input_tuning import InputTuning

# Create a separate dir for Neuromodulation Basal Ganglia Data while tuning
snudda_data = os.getenv("SNUDDA_DATA")

network_path = os.path.join("..", "networks", "dspn_DA_bath")

print(f"Creating network in {network_path}")

input_tuning = InputTuning(network_path, snudda_data=snudda_data)

neurons_path = os.path.join("$DATA", "neurons", "striatum")

input_tuning.setup_network(neurons_path=neurons_path,
num_replicas=1,
neuron_types="dspn",
reaction_diffusion_file="reaction_diffusion_D1_bath.json",
network_random_seed=1234)
input_tuning = None


from snudda import Snudda
snd = Snudda(network_path=network_path)
snd.setup_input(input_config="input.json")
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This is to prevent NEURON from trying to open display
unset DISPLAY

export SNUDDA_DATA="$HOME/BasalGangliaData/data"

JOBDIR=../networks/dspn_DA_bath


echo "Running Dardel_setup_neuromodulation_network: $JOBDIR"

echo "SLURM_PROCID = $SLURM_PROCID"

if [ "$SLURM_PROCID" -gt 0 ]; then
mock_string="Not main process"
else
echo "Running"
python Dardel_setup_neuromodulation_network.py
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash -l
#SBATCH --partition=main
#SBATCH -o log/Simulate-%j-output.txt
#SBATCH -e log/Simulate-%j-error.txt
#SBATCH -t 0:59:00
#SBATCH --time-min=0:59:00
#SBATCH -J Simulate
#SBATCH -A naiss2024-5-306
#SBATCH --nodes=1
#SBATCH --tasks-per-node=51
#SBATCH --mail-type=ALL

ulimit -s unlimited
module load snic-env

source $HOME/Snudda/snudda_env/bin/activate
SNUDDA_DIR=/cfs/klemming/home/"${USER:0:1}"/$USER/Snudda

export SNUDDA_DATA="/cfs/klemming/home/${USER:0:1}/$USER/BasalGangliaData/data"

# Create the network

export N_WORKERS=$SLURM_NTASKS

# This will stop NEURON from failing with "can't open DISPLAY"
unset DISPLAY

NETWORK_DIR=../networks/dspn_modulation
echo "Calling Dardel_setup_neuromodulation_network.sh"
export FI_CXI_DEFAULT_VNI=$(od -vAn -N4 -tu < /dev/urandom)
srun -n 1 -N 1 --exact --overlap --mem=0 Dardel_setup_neuromodulation_network.sh


NETWORK_INFO_FILE=$NETWORK_DIR/network-synapses.hdf5
NETWORK_INPUT_FILE=$NETWORK_DIR/input-spikes.hdf5

echo "Network dir: "$NETWORK_DIR

export PATH=$SNUDDA_DIR/snudda_env/bin/:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CRAY_LD_LIBRARY_PATH
export PYTHONPATH=$SNUDDA_DIR/snudda_env/lib/python3.11/

export CXX=CC
export CC=cc
export FC=ftn
export MPICC=cc
export MPICXX=CC

CC --version

pushd $SNUDDA_DIR/examples/parallel/KTH_PDC/neuromodulation

rm mechanisms
ln -s $SNUDDA_DATA/neurons/mechanisms/ mechanisms

rm -r x86_64

echo "About to run nrnivmodl"
which nrnivmodl

export FI_CXI_DEFAULT_VNI=$(od -vAn -N4 -tu < /dev/urandom)
srun -n 1 nrnivmodl -incflags "-lltdl=/usr/lib64/libltdl.so.7 -lreadline=/lib64/libreadline.so.7 -lncurses=/lib64/libncurses.so.6.1" -loadflags "-DLTDL_LIBRARY=/usr/lib64/libltdl.so.7 -DREADLINE_LIBRARY=/lib64/libreadline.so.7 -DNCURSES_LIBRARY=/lib64/libncurses.so.6.1" mechanisms/

popd

export FI_CXI_DEFAULT_VNI=$(od -vAn -N4 -tu < /dev/urandom)
srun -n $N_WORKERS $SNUDDA_DIR/examples/parallel/KTH_PDC/neuromodulation/x86_64/special -mpi -python $SNUDDA_DIR/snudda/simulate/simulate.py dummy_file dummy_file --simulation_config dspn_bath_experiment_config.json




Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"network_file": "../networks/dspn_DA_bath/network-synapses.hdf5",
"input_file": "../networks/dspn_DA_bath/input-spikes.hdf5",
"output_file": "../networks/dspn_DA_bath/simulation/dspn-output.hdf5",
"log_file": "../networks/dspn_DA_bath/log/network-simulation-log.txt",
"sample_dt": 0.01,
"time": 5,
"record_all_soma": true,

"rxd_enable_extracellular": false,
"bath_application": {
"DA": {
"time": [0, 1.99, 2, 3, 3.01, 10],
"concentration": [0, 0, 60e-6, 60e-6, 0, 0]
}
},

"record_density_mechanism": {
"kir_ms.modulation_factor": {
"neuron_id": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],
"section_id": [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
"section_x": [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
}
},
"record_rxd_species_concentration_all_compartments": [["PKAc", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]], ["DA", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]]]

}
24 changes: 24 additions & 0 deletions examples/parallel/KTH_PDC/neuromodulation/dspn_DA_bath/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"dspn": {
"cortical": {
"generator": "poisson",
"start": [0.5, 2, 3.5],
"end": [1.5, 3, 4.5],
"frequency": [10, 10, 10],
"parameter_file": "tmglut_DA_parameters.json",
"mod_file": "tmGlut"
},

"GABA": {
"generator": "poisson",
"type": "GABA",
"start": [0.5, 2, 3.5],
"end": [1.5, 3, 4.5],
"frequency": [5, 5, 5],
"num_inputs": 100,
"conductance": 5e-10,
"mod_file": "tmGabaA",
"parameter_file": "$DATA/synapses/striatum/PlanertFitting-DD-tmgaba-fit.json"
}
}
}
Loading

0 comments on commit f3abf06

Please sign in to comment.