From ddfa9e11b1f7fbd8c8400bc3cde5687408db1c0f Mon Sep 17 00:00:00 2001 From: Alessandro Cattabiani Date: Thu, 24 Jul 2025 15:01:35 +0200 Subject: [PATCH 1/2] target_type is no more target_type was an enum that was built from the combination of section_type and compartments (this was a bool). Now we have 2 enums that are passed by string in report.conf. This has several benefits: - inspection: we can understand more easily what we are passing - de-correlation: we can change one enum without changing the other - no need of special encoding/decoding: before we needed to pack and unpack the enums into 1 - easier to expand in case more options arise Drawbacks: - less performant since we need to encode/decode with strings I think the drawback are totally ininfluent. Report parsing is not performance critical and clarity and simplicity should rein here --- commonutils.py | 5 +++-- ringtest.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commonutils.py b/commonutils.py index 26ef42f..ddc6bf6 100644 --- a/commonutils.py +++ b/commonutils.py @@ -168,7 +168,7 @@ def setup_nrnbbcore_register_mapping(rings): return recordlist def write_report_config(output_file, report_name, target_name, report_type, report_variable, - unit, report_format, target_type, dt, start_time, end_time, gids, + unit, report_format, sections, compartments, dt, start_time, end_time, gids, buffer_size=8, scaling: Literal["none", "area"] = "area"): """ Writes the configuration for a report to a file. Check the docs here: @@ -189,7 +189,8 @@ def write_report_config(output_file, report_name, target_name, report_type, repo report_variable, unit, report_format, - target_type, + sections, + compartments, dt, start_time, end_time, diff --git a/ringtest.py b/ringtest.py index be04886..b0e9067 100644 --- a/ringtest.py +++ b/ringtest.py @@ -175,7 +175,7 @@ def create_rings(): sim_conf_file = "sim.conf" if settings.rank == 0: write_report_config(report_conf_file, "soma.h5", "Mosaic", "compartment", "v", - "mV", "SONATA", 2, 1, 0, tstop, list(range(ncell))) + "mV", "SONATA", "soma", "center", 1, 0, tstop, list(range(ncell))) write_spike_config(report_conf_file, "spikes.h5", ["default"], [0]) write_sim_config(sim_conf_file, "corenrn_data", report_conf_file, tstop) coreneuron.sim_config=sim_conf_file From 6649eae1bcdfdd092129ec0e473e54507949135c Mon Sep 17 00:00:00 2001 From: Alessandro Cattabiani Date: Thu, 24 Jul 2025 15:35:52 +0200 Subject: [PATCH 2/2] fix write --- commonutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commonutils.py b/commonutils.py index ddc6bf6..6acbbb9 100644 --- a/commonutils.py +++ b/commonutils.py @@ -182,7 +182,7 @@ def write_report_config(output_file, report_name, target_name, report_type, repo with report_conf.open("wb") as fp: # Write the formatted string to the file fp.write(b"1\n") - fp.write(("%s %s %s %s %s %s %d %lf %lf %lf %d %d %s\n" % ( + fp.write(("%s %s %s %s %s %s %s %s %lf %lf %lf %d %d %s\n" % ( report_name, target_name, report_type,