diff --git a/bluepysnap/simulation.py b/bluepysnap/simulation.py index 892feab3..d6c53cb4 100644 --- a/bluepysnap/simulation.py +++ b/bluepysnap/simulation.py @@ -33,14 +33,14 @@ def _collect_frame_reports(sim): for name in sim.to_libsonata.list_report_names: report = sim.to_libsonata.report(name) report_type = report.sections.name - if report_type == "soma": - from bluepysnap.frame_report import SomaReport - - cls = SomaReport - elif report_type == "all": + if report_type == "all" or report.type.name == "lfp": from bluepysnap.frame_report import CompartmentReport cls = CompartmentReport + elif report_type == "soma": + from bluepysnap.frame_report import SomaReport + + cls = SomaReport else: raise BluepySnapError(f"Report {name}: format {report_type} not yet supported.") diff --git a/tests/data/simulation_config.json b/tests/data/simulation_config.json index e5497bae..0138bbd5 100644 --- a/tests/data/simulation_config.json +++ b/tests/data/simulation_config.json @@ -65,6 +65,14 @@ "end_time": 0.8, "dt": 0.02, "file_name": "compartment_named" + }, + "lfp_report": { + "cells": "Layer23", + "variable_name": "v", + "type": "lfp", + "start_time": 0.2, + "end_time": 0.8, + "dt": 0.02 } } } diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 3410110f..56a2bf99 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -69,9 +69,10 @@ def test_all(): assert isinstance(simulation.spikes, SpikeReport) assert isinstance(simulation.spikes["default"], PopulationSpikeReport) - assert set(simulation.reports) == {"soma_report", "section_report"} + assert set(simulation.reports) == {"soma_report", "section_report", "lfp_report"} assert isinstance(simulation.reports["soma_report"], SomaReport) assert isinstance(simulation.reports["section_report"], CompartmentReport) + assert isinstance(simulation.reports["lfp_report"], CompartmentReport) rep = simulation.reports["soma_report"] assert set(rep.population_names) == {"default", "default2"}