diff --git a/commonutils.py b/commonutils.py index a8d1de0..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 List +from typing import List, 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): + 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) @@ -177,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\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 +194,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))