Skip to content

Commit

Permalink
Use libsonata for getting the framereport file name (#172)
Browse files Browse the repository at this point in the history
* require libsonata>=0.1.16
  • Loading branch information
joni-herttuainen committed Nov 3, 2022
1 parent f4edefe commit 47e1b06
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Breaking Changes
- The NodeStorage & EdgeStorage classes were removed
- point_neuron is no longer supported
- Some column data types in the nodes and edges DataFrames returned by the `get()` method may be `float` or `int` instead of `object`.
- require ``libsonata>=0.1.16``

Version v0.13.1
---------------
Expand Down
15 changes: 2 additions & 13 deletions bluepysnap/frame_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Frame report access."""
import logging
from pathlib import Path

import numpy as np
import pandas as pd
Expand All @@ -29,23 +28,13 @@

L = logging.getLogger(__name__)

REPORT_EXTENSION = ".h5"


def _collect_population_reports(frame_report, cls):
return {
population: cls(frame_report, population) for population in frame_report.population_names
}


def _get_reader(reader_report, cls):
path = reader_report.simulation.output.output_dir
# TODO: change to use reader_report.to_libsonata.file_name when fixed in libsonata
file_name = reader_report.config.get("file_name", reader_report.name) + REPORT_EXTENSION
path = str(Path(path, file_name))
return cls(path)


class PopulationFrameReport:
"""Access to PopulationFrameReport data."""

Expand All @@ -66,7 +55,7 @@ def __init__(self, frame_report, population_name):
@staticmethod
def _get_reader(frame_report, population_name):
"""Access to the population compartment reader."""
return _get_reader(frame_report, ElementReportReader)[population_name]
return ElementReportReader(frame_report.to_libsonata.file_name)[population_name]

@property
def name(self):
Expand Down Expand Up @@ -202,7 +191,7 @@ def __init__(self, simulation, report_name):
@cached_property
def _frame_reader(self):
"""Access to the compartment report reader."""
return _get_reader(self, ElementReportReader)
return ElementReportReader(self.to_libsonata.file_name)

@property
def to_libsonata(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, *args, **kwargs):
"cached_property>=1.0",
"h5py>=3.0.1,<4.0.0",
"jsonschema>=4.0.0,<5.0.0",
"libsonata>=0.1.13,<1.0.0",
"libsonata>=0.1.16,<1.0.0",
"morphio>=3.0.0,<4.0.0",
"morph-tool>=2.4.3,<3.0.0",
"neurom>=1.6",
Expand Down
1 change: 1 addition & 0 deletions tests/data/simulation_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"variable_name": "m",
"sections": "soma",
"type": "compartment",
"file_name": "soma_report",
"start_time": 0,
"end_time": 1000.0,
"dt": 0.01,
Expand Down
1 change: 1 addition & 0 deletions tests/test_frame_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_config(self):
"variable_name": "m",
"sections": "soma",
"type": "compartment",
"file_name": "soma_report",
"start_time": 0,
"end_time": 1000.0,
"dt": 0.01,
Expand Down

0 comments on commit 47e1b06

Please sign in to comment.