This repository performs automated parameter optimization to maximize calcium Ca2+ influx in the trunk of a CA1 pyramidal neuron model while minimizing calcium influx in oblique dendrites, using the Optuna framework for hyperparameter tuning.
The pipeline simulates dendritic currents using a custom CurrentscapePipeline
, then evaluates performance via:
trunk_score()
: quantifies Ca2+ current in the distal trunkoblique_penalty()
: penalizes Ca2+ current in oblique branches
The goal is to maximize trunk Ca2+ influx while suppressing unwanted oblique branch activation.
main_full_pipeline.py
: orchestrates the optimization loopCurrentscapePipeline.py
: defines neuron model and simulation logiccustom_objective_scores.py
: defines custom scoring functions
Use Python 3.9+ and install dependencies with:
pip install -r requirements.txt
Before running simulations, you need to compile NEURON's .mod
files.
Navigate to the folder containing the .mod
files:
cd simulator/model/density_mechs
And run the nrnivmodl
tool from NEURON.
If NEURON has trouble finding compiled mechanisms, consider copying them into the root folder and re-running nrnivmodl
.
More information about NEURON: https://neuron.yale.edu/neuron
More information about working with .mod files: https://www.neuron.yale.edu/phpBB/viewtopic.php?t=3263
More information about compiling .mod files: https://nrn.readthedocs.io/en/latest/guide/faq.html#how-do-i-compile-mod-files
- Suggest Parameters:
gcar
,gkslow
,gcar_trunk
, andgkslow_trunk
are optimized.
- Run Simulation:
- A current injection protocol is simulated via
CurrentscapePipeline
.
- A current injection protocol is simulated via
- Score Simulation:
- High
trunk_score
→ rewarded - High
oblique_penalty
→ penalized
- High
- Optimize:
- Optuna runs 50 trials to maximize the objective.
- Visualization:
- Configure inputs and run
visualization_optuna.py
to visualize the top 5 scoring parameter sets.
- Configure inputs and run