Brion  1.5.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

 ~CompartmentReport ()
 Close compartment report. More...
 
 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
 CompartmentReport (const std::string &source, const GIDSet &gids=GIDSet())
 Open given source to a compartment report for reading. More...
 
void updateMapping (const GIDSet &gids)
 Update compartment mapping wrt the given GIDs. More...
 
const GIDSet & getGIDs () const
 
const SectionOffsets & getOffsets () const
 Get the current mapping of each section of each neuron in each simulation frame buffer. More...
 
const CompartmentCounts & getCompartmentCounts () const
 Get the number of compartments for each section of each neuron provided by the GID set via updateMapping(). More...
 
size_t getNumCompartments (const size_t index) const
 Get the number of compartments for the given neuron. More...
 
float getStartTime () const
 
float getEndTime () const
 
float getTimestep () const
 
const std::string & getDataUnit () const
 
const std::string & getTimeUnit () const
 
size_t getFrameSize () const
 
floatsPtr loadFrame (const float timestamp) const
 Load report values at the given time stamp. More...
 
void setBufferSize (const size_t size)
 Set the size of the stream buffer for loaded frames. More...
 
size_t getBufferSize () const
 
void clearBuffer ()
 Clears all buffered frames to free memory. More...
 
Write API
 CompartmentReport (const std::string &source, const CompartmentReportFormat format, const bool overwrite=false)
 Open given source to a compartment report for writing. More...
 
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...
 
bool writeCompartments (const uint32_t gid, const uint16_ts &counts)
 Write the compartment counts for each section for one cell. More...
 
bool writeFrame (const uint32_t gid, const floats &voltages, const float timestamp)
 Write the voltages for one cell at a point in time. More...
 
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 38 of file compartmentReport.h.

Constructor & Destructor Documentation

brion::CompartmentReport::~CompartmentReport ( )

Close compartment report.

Version
1.0
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::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::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

void brion::CompartmentReport::clearBuffer ( )

Clears all buffered frames to free memory.

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

Flush data to output.

Returns
true on success.
Version
1.0
size_t brion::CompartmentReport::getBufferSize ( ) const
Returns
the number of the simulation frame buffers.
Version
1.0
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
const std::string& brion::CompartmentReport::getDataUnit ( ) const
Returns
the data unit of the report.
Version
1.0
float brion::CompartmentReport::getEndTime ( ) const
Returns
the current end time of the report.
Version
1.0
size_t brion::CompartmentReport::getFrameSize ( ) const
Returns
the size of a loaded report frame.
Version
1.0
const GIDSet& brion::CompartmentReport::getGIDs ( ) const
Returns
the current considered GIDs.
Version
1.0
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
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::CompartmentReport::getStartTime ( ) const
Returns
the current start time of the report.
Version
1.0
float brion::CompartmentReport::getTimestep ( ) const
Returns
the sampling time interval of the report.
Version
1.0
const std::string& brion::CompartmentReport::getTimeUnit ( ) const
Returns
the time unit of the report.
Version
1.0
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
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
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
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
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
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: