Brion  1.6.0
The Blue Brain C++ I/O library
brion::CompartmentReport Class Reference

Read & write access to a CompartmentReport. More...

#include <compartmentReport.h>

+ Inheritance diagram for brion::CompartmentReport:
+ Collaboration diagram for brion::CompartmentReport:

Public Member Functions

BRION_API ~CompartmentReport ()
 Close compartment report. More...
 
BRION_API CompartmentReport (const URI &uri, const int mode, const GIDSet &gids=GIDSet())
 Open given URI to a compartment report for reading and/or writing. More...
 
Read API
BRION_API CompartmentReport (const std::string &source, const GIDSet &gids=GIDSet())
 Open given source to a compartment report for reading. More...
 
BRION_API void updateMapping (const GIDSet &gids)
 Update compartment mapping wrt the given GIDs. More...
 
BRION_API const GIDSetgetGIDs () const
 
BRION_API const SectionOffsetsgetOffsets () const
 Get the current mapping of each section of each neuron in each simulation frame buffer. More...
 
BRION_API const CompartmentCountsgetCompartmentCounts () const
 Get the number of compartments for each section of each neuron provided by the GID set via updateMapping(). More...
 
BRION_API size_t getNumCompartments (const size_t index) const
 Get the number of compartments for the given neuron. More...
 
float BRION_API getStartTime () const
 
BRION_API float getEndTime () const
 
BRION_API float getTimestep () const
 
BRION_API const std::string & getDataUnit () const
 
BRION_API const std::string & getTimeUnit () const
 
BRION_API size_t getFrameSize () const
 
BRION_API floatsPtr loadFrame (const float timestamp) const
 Load report values at the given time stamp. More...
 
BRION_API void setBufferSize (const size_t size)
 Set the size of the stream buffer for loaded frames. More...
 
BRION_API size_t getBufferSize () const
 
BRION_API void clearBuffer ()
 Clears all buffered frames to free memory. More...
 
Write API
BRION_API CompartmentReport (const std::string &source, const CompartmentReportFormat format, const bool overwrite=false)
 Open given source to a compartment report for writing. More...
 
BRION_API void writeHeader (const float startTime, const float endTime, const float timestep, const std::string &dunit, const std::string &tunit)
 Write the header information of this report. More...
 
BRION_API bool writeCompartments (const uint32_t gid, const uint16_ts &counts)
 Write the compartment counts for each section for one cell. More...
 
BRION_API bool writeFrame (const uint32_t gid, const floats &voltages, const float timestamp)
 Write the voltages for one cell at a point in time. More...
 
BRION_API bool flush ()
 Flush data to output. More...
 

Detailed Description

Read & write access to a CompartmentReport.

The supported types are binary (r), HDF5 (rw) and stream (rw) reports.

Following RAII, this class is ready to use after the creation and will ensure release of resources upon destruction.

Definition at line 39 of file compartmentReport.h.

Constructor & Destructor Documentation

BRION_API brion::CompartmentReport::~CompartmentReport ( )

Close compartment report.

Version
1.0
BRION_API brion::CompartmentReport::CompartmentReport ( const URI &  uri,
const int  mode,
const GIDSet gids = GIDSet() 
)

Open given URI to a compartment report for reading and/or writing.

Parameters
uriURI to compartment report. The report type is deduced from here.
modethe brion::AccessMode bitmask
gidsthe neurons of interest in READ_MODE
Exceptions
std::runtime_errorif compartment report could be opened for read or write, cannot be overwritten or it is not valid
Version
1.4
BRION_API brion::CompartmentReport::CompartmentReport ( const std::string &  source,
const GIDSet gids = GIDSet() 
)

Open given source to a compartment report for reading.

An empty GIDSet loads all data from the report.

Parameters
sourcefilepath to compartment report
gidsthe neurons of interest
Exceptions
std::runtime_errorif source is not a valid compartment report
Version
1.0
Deprecated:
BRION_API brion::CompartmentReport::CompartmentReport ( const std::string &  source,
const CompartmentReportFormat  format,
const bool  overwrite = false 
)

Open given source to a compartment report for writing.

Parameters
sourcefilepath to compartment report
formatoutput format of the report
overwritetrue to allow overwrite of existing file
Exceptions
std::runtime_errorif source is not a valid compartment report or if location cannot be overwritten
Version
1.0
Deprecated:

Member Function Documentation

BRION_API void brion::CompartmentReport::clearBuffer ( )

Clears all buffered frames to free memory.

Version
1.0
BRION_API bool brion::CompartmentReport::flush ( )

Flush data to output.

Returns
true on success.
Version
1.0
BRION_API size_t brion::CompartmentReport::getBufferSize ( ) const
Returns
the number of the simulation frame buffers.
Version
1.0
BRION_API const CompartmentCounts& brion::CompartmentReport::getCompartmentCounts ( ) const

Get the number of compartments for each section of each neuron provided by the GID set via updateMapping().

The neuron index is derived from the order in the GID set provided by updateMapping().

Returns
the compartment counts for each section for each neuron
Version
1.0
BRION_API const std::string& brion::CompartmentReport::getDataUnit ( ) const
Returns
the data unit of the report.
Version
1.0
BRION_API float brion::CompartmentReport::getEndTime ( ) const
Returns
the current end time of the report.
Version
1.0
BRION_API size_t brion::CompartmentReport::getFrameSize ( ) const
Returns
the size of a loaded report frame.
Version
1.0
BRION_API const GIDSet& brion::CompartmentReport::getGIDs ( ) const
Returns
the current considered GIDs.
Version
1.0
BRION_API size_t brion::CompartmentReport::getNumCompartments ( const size_t  index) const

Get the number of compartments for the given neuron.

The neuron index is derived from the order in the GID set provided by updateMapping().

Parameters
indexneuron index per current GID set
Returns
number of compartments for the given neuron
Version
1.0
BRION_API const SectionOffsets& brion::CompartmentReport::getOffsets ( ) const

Get the current mapping of each section of each neuron in each simulation frame buffer.

For instance, getOffsets()[1][15] retrieves the lookup index for the frame buffer for section 15 of neuron with index 1. The neuron index is derived from the order in the GID set provided by updateMapping().

Returns
the offset for each section for each neuron
Version
1.0
float BRION_API brion::CompartmentReport::getStartTime ( ) const
Returns
the current start time of the report.
Version
1.0
BRION_API float brion::CompartmentReport::getTimestep ( ) const
Returns
the sampling time interval of the report.
Version
1.0
BRION_API const std::string& brion::CompartmentReport::getTimeUnit ( ) const
Returns
the time unit of the report.
Version
1.0
BRION_API floatsPtr brion::CompartmentReport::loadFrame ( const float  timestamp) const

Load report values at the given time stamp.

Parameters
timestampthe time stamp of interest
Returns
the report values if found at timestamp, 0 otherwise
Version
1.0
BRION_API void brion::CompartmentReport::setBufferSize ( const size_t  size)

Set the size of the stream buffer for loaded frames.

Configures the number of simulation frame buffers for stream readers. When the consumer is slower than the producer, the producer will block once these buffers are exhausted, otherwise the consumer will block on data availability. A minimum of 1 frame is buffered.

Parameters
sizethe new size of the frame buffer.
Version
1.0
BRION_API void brion::CompartmentReport::updateMapping ( const GIDSet gids)

Update compartment mapping wrt the given GIDs.

An empty gids set loads all data from the report.

Parameters
gidsthe neurons of interest
Version
1.0
BRION_API bool brion::CompartmentReport::writeCompartments ( const uint32_t  gid,
const uint16_ts &  counts 
)

Write the compartment counts for each section for one cell.

This should only be called after writeHeader().

Parameters
gidthe GID of the cell
countsthe number of compartments per section
Returns
false if saving was not successful, true otherwise
Version
1.0
BRION_API bool brion::CompartmentReport::writeFrame ( const uint32_t  gid,
const floats &  voltages,
const float  timestamp 
)

Write the voltages for one cell at a point in time.

This should only be called after all the required mapping has been saved before.

Parameters
gidthe GID of the cell
voltagesthe voltages per compartment to save
timestampthe timestamp in ms where for this voltages
Returns
false if saving was not successful, true otherwise
Version
1.0
BRION_API void brion::CompartmentReport::writeHeader ( const float  startTime,
const float  endTime,
const float  timestep,
const std::string &  dunit,
const std::string &  tunit 
)

Write the header information of this report.

Parameters
startTimethe start time of the report
endTimethe end time of the report
timestepthe timestep between report frames
dunitthe unit of the data, e.g. mV
tunitthe unit of the time, e.g. ms
Exceptions
std::invalid_argumentif any passed argument is invalid
Version
1.0

The documentation for this class was generated from the following file: