Skip to content

Commit

Permalink
Issue reading LFP reports (#251)
Browse files Browse the repository at this point in the history
* Issue reading LFP reports
 - Change the logic to also check the report "type" and if it is "lfp" select a CompartmentReport

* Address feedback to make it more clear
  • Loading branch information
jorblancoa authored Dec 6, 2023
1 parent c094e4f commit 19866e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bluepysnap/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
8 changes: 8 additions & 0 deletions tests/data/simulation_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
3 changes: 2 additions & 1 deletion tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit 19866e0

Please sign in to comment.