Skip to content

Commit

Permalink
Allow API configuration to preserve the axons during setup (#155)
Browse files Browse the repository at this point in the history
## Context
With BlueConfig one could ask a circuit to preserve the axons in full
detail via a config entry `DetailedAxons`.

However, that options was never made globally available via a flag,
which enables it also for Sonata simulations.

This PR covers that.

## Scope
 - Introduce the new Neurodamus top-level option `keep_axon`
- Propagate to all Detailed neuron circuits which don't set the option
explicitly.

## Testing
in the testing environment under `test/ngv_wip` with the patched
`emodels_atp_1p4` one must see

**Script:**
```python
nd = neurodamus.Neurodamus(
    "simulation_config.json",
    keep_axon=True,
    auto_init=False,
    cleanup_atexit=False,
    logging_level=2,
)
nd.init()
nd.run()
```
**Output:**
```
[VERB]  -> Keeping axons ENABLED
...
[INFO] Executing actions after stdinit...
[INFO] Now deleting the axon!
REPLACING AXON!
[INFO] Now deleting the axon!
REPLACING AXON!
```

## Review
* [x] PR description is complete
* [x] Coding style (imports, function length, New functions, classes or
files) are good
* [ ] Unit/Scientific test added
* [ ] Updated Readme, in-code, developer documentation

Co-authored-by: Weina Ji <[email protected]>
  • Loading branch information
ferdonline and WeinaJi authored Jul 24, 2024
1 parent 2aef700 commit 773915f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions neurodamus/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class CliOptions(ConfigT):
simulator = None
dry_run = False
num_target_ranks = None
keep_axon = False
coreneuron_direct_mode = False

# Restricted Functionality support, mostly for testing
Expand Down Expand Up @@ -581,7 +582,12 @@ def _extra_circuits(config: _SimConfig, run_conf):
if field in config.base_circuit and field not in circuit_info:
log_verbose(" > Inheriting '%s' from base circuit", field)
circuit_info[field] = config.base_circuit[field]

circuit_info.setdefault("nrnPath", False)
if config.cli_options.keep_axon and circuit_info["Engine"].__name__ == "METypeEngine":
log_verbose("Keeping axons ENABLED")
circuit_info.setdefault("DetailedAxon", True)

extra_circuits[name] = _make_circuit_config(circuit_info, req_morphology=False)
extra_circuits[name]._name = name

Expand Down

0 comments on commit 773915f

Please sign in to comment.