From 0dafdf2acf78fcaca1e3934d1255754d167b86c2 Mon Sep 17 00:00:00 2001 From: Alessandro Cattabiani Date: Mon, 21 Jul 2025 13:03:57 +0200 Subject: [PATCH 1/3] add scaling to report.conf --- commonutils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commonutils.py b/commonutils.py index a8d1de0..9478db4 100644 --- a/commonutils.py +++ b/commonutils.py @@ -169,7 +169,7 @@ def setup_nrnbbcore_register_mapping(rings): 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, - buffer_size=8): + buffer_size=8, scaling="Area"): import struct num_gids = len(gids) report_conf = Path(output_file) @@ -177,7 +177,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\n" % ( + fp.write(("%s %s %s %s %s %s %d %lf %lf %lf %d %d %s\n" % ( report_name, target_name, report_type, @@ -189,7 +189,8 @@ def write_report_config(output_file, report_name, target_name, report_type, repo start_time, end_time, num_gids, - buffer_size + buffer_size, + scaling )).encode()) # Write the array of integers to the file in binary format fp.write(struct.pack(f'{num_gids}i', *gids)) From 775315eb63755f4854315c8e57b311da8b79341d Mon Sep 17 00:00:00 2001 From: Alessandro Cattabiani Date: Mon, 21 Jul 2025 15:59:20 +0200 Subject: [PATCH 2/3] docs --- commonutils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/commonutils.py b/commonutils.py index 9478db4..732794b 100644 --- a/commonutils.py +++ b/commonutils.py @@ -2,7 +2,7 @@ import os from neuron import h from pathlib import Path -from typing import List +from typing import Literal def mkdir_p(path): try: @@ -169,7 +169,12 @@ def setup_nrnbbcore_register_mapping(rings): 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, - buffer_size=8, scaling="Area"): + buffer_size=8, scaling: Literal["none", "area"] = "area"): + """ + Writes the configuration for a report to a file. Check the docs here: + + https://sonata-extension.readthedocs.io/en/latest/sonata_simulation.html#reports + """ import struct num_gids = len(gids) report_conf = Path(output_file) From 6f4c682bbeb1864be70d752c3a6aaf62b64a4ce2 Mon Sep 17 00:00:00 2001 From: Alessandro Cattabiani Date: Mon, 21 Jul 2025 16:00:40 +0200 Subject: [PATCH 3/3] fix typo --- commonutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commonutils.py b/commonutils.py index 732794b..26ef42f 100644 --- a/commonutils.py +++ b/commonutils.py @@ -2,7 +2,7 @@ import os from neuron import h from pathlib import Path -from typing import Literal +from typing import List, Literal def mkdir_p(path): try: