Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
jorblancoa committed Nov 26, 2024
1 parent 21f8aff commit 79b6c0a
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions neurodamus/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,33 +947,33 @@ def _report_write_coreneuron_config(self, rep_conf, target, rep_params):

if SimConfig.restore_coreneuron:
CoreConfig.update_tstop(rep_params.name, target_spec.name, rep_params.end)
else:
# for sonata config, compute target_type from user inputs
if "Sections" in rep_conf and "Compartments" in rep_conf:
def _compute_corenrn_target_type(section_type, compartment_type):
sections = ["all", "soma", "axon", "dend", "apic"]
compartments = ["center", "all"]
if section_type not in sections:
raise ConfigurationError(f"Report: invalid section type '{section_type}'")
if compartment_type not in compartments:
raise ConfigurationError(f"Report: invalid compartment type "
f"{compartment_type}")
if section_type == "all": # for "all sections", support only target_type=0
return 0
# 0=Compartment, Section { 2=Soma, 3=Axon, 4=Dendrite, 5=Apical, 6=SomaAll ... }
return sections.index(section_type)+1+4*compartments.index(compartment_type)

section_type = rep_conf.get("Sections")
compartment_type = rep_conf.get("Compartments")
target_type = _compute_corenrn_target_type(section_type, compartment_type)

reporton_comma_separated = ",".join(rep_params.report_on.split())
core_report_params = (
(rep_params.name, target_spec.name, rep_params.rep_type, reporton_comma_separated)
+ rep_params[3:5] + (target_type,) + rep_params[5:8]
+ (target.get_gids(), SimConfig.corenrn_buff_size)
)
CoreConfig.write_report_config(*core_report_params)
return True

# for sonata config, compute target_type from user inputs
if "Sections" in rep_conf and "Compartments" in rep_conf:
def _compute_corenrn_target_type(section_type, compartment_type):
sections = ["all", "soma", "axon", "dend", "apic"]
compartments = ["center", "all"]
if section_type not in sections:
raise ConfigurationError(f"Report: invalid section type '{section_type}'")
if compartment_type not in compartments:
raise ConfigurationError(f"Report: invalid compartment type {compartment_type}")
if section_type == "all": # for "all sections", support only target_type=0
return 0
# 0=Compartment, Section { 2=Soma, 3=Axon, 4=Dendrite, 5=Apical, 6=SomaAll ... }
return sections.index(section_type)+1+4*compartments.index(compartment_type)

section_type = rep_conf.get("Sections")
compartment_type = rep_conf.get("Compartments")
target_type = _compute_corenrn_target_type(section_type, compartment_type)

reporton_comma_separated = ",".join(rep_params.report_on.split())
core_report_params = (
(rep_params.name, target_spec.name, rep_params.rep_type, reporton_comma_separated)
+ rep_params[3:5] + (target_type,) + rep_params[5:8]
+ (target.get_gids(), SimConfig.corenrn_buff_size)
)
CoreConfig.write_report_config(*core_report_params)
return True

def _report_setup(self, report, rep_conf, target, rep_type):
Expand Down

0 comments on commit 79b6c0a

Please sign in to comment.