diff --git a/doc/Changelog.md b/doc/Changelog.md index 60a6a82..aee9f7b 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -4,7 +4,7 @@ Changelog {#Changelog} # git master * [130](https://github.com/BlueBrain/Brion/pull/130): - Added brain::CompartmentReportReader and its Python wrapping. + Added brain::CompartmentReportReader and its Python wrapping * [120](https://github.com/BlueBrain/Brion/pull/120), [131](https://github.com/BlueBrain/Brion/pull/131): - New SpikeReport API. - Reimplementation of the high level SpikeReportReader. The new implementation @@ -25,15 +25,15 @@ Changelog {#Changelog} * [117](https://github.com/BlueBrain/Brion/pull/117): Changes and fixes in Brain Python module: - Functions that take gids now preserve the iteration order of the input in - the output arrays/lists. - - Replaced Python sets with numpy arrays in functions returning GID sets. - - Circuit::getXYZNames functions renamed to Circuit::getXYZTypeNames. + the output arrays/lists + - Replaced Python sets with numpy arrays in functions returning GID sets + - Circuit::getXYZNames functions renamed to Circuit::getXYZTypeNames * [113](https://github.com/BlueBrain/Brion/pull/113): - Support for old circuits containing only synapse center positions. + Support for old circuits containing only synapse center positions * [110](https://github.com/BlueBrain/Brion/pull/110): Break PersistentMap out into keyv::Map * [107](https://github.com/BlueBrain/Brion/pull/107): - Added Sphinx generated documentation of the brain python module. + Added Sphinx generated documentation of the brain python module * [102](https://github.com/BlueBrain/Brion/pull/102): Use PersistentMap for caching synapse positions loaded from brain::Circuit * [94](https://github.com/BlueBrain/Brion/pull/94): @@ -41,11 +41,11 @@ Changelog {#Changelog} creating invalid soma sections when the first order sections where connected to arbitrary soma sample points. * [89](https://github.com/BlueBrain/Brion/pull/89): - Python wrapping of brain classes. + Python wrapping of brain classes * [88](https://github.com/BlueBrain/Brion/pull/88): - - Brain namespace enums made strongly typed. + - Brain namespace enums made strongly typed - Fix for brain::Section::getSamples for sections where the first point - appears repeated. + appears repeated * [85](https://github.com/BlueBrain/Brion/pull/85): Implement brain synapses specification * [84](https://github.com/BlueBrain/Brion/pull/84): diff --git a/doc/feature/compartmentReportPy.md b/doc/feature/compartmentReportPy.md new file mode 100644 index 0000000..d49051b --- /dev/null +++ b/doc/feature/compartmentReportPy.md @@ -0,0 +1,86 @@ +High-Level CompartmentReport API for Python {#compartment_report_py} +============ + +## Motivation + +Redesign the current BBPSDK-inspired API for also allowing voltage traces. +The returned data should change to be a matrix[frame, compartment] instead +of the current vector[compartments]. + +## API + +### C++ + +* rename brain::CompartmentReportReader to CompartmentReport +* merge brion::CompartmentReport::loadFrame and loadNeuron in load( startTime, endTime ) + * returns matrix in frame-major order +* Change all timestamps to double + +### Python + + class CompartmentReportView: + def load() + """Load all the available data from this view. + + If the report is empty return None, otherwise return a tuple with a 1D + double ndarray for the frame timestamps and a 2D float ndarray, where + the first index is for frames and the second for compartment offsets.""" + + def load(start, end): + """Load all frames in a time range. + + This function will wait if necessary until the requested time window becomes + available. The return value is the same as for load().""" + + def load(timestamp): + """Load the frame that contains the given timestamp. + + The caller will block until the frame on which the requested timestamp falls + is available. + The return type is a (double, nadarray) tuple where the first element is the + actual timestamp of the frame and the second one is a 1D double ndarray.""" + +## Example + + import brain + + # voltage trace: + reader = brain.CompartmentReport("uri") + view = reader.create_view([1]) + times, trace = view.load() + for time, frame in zip(times, trace): + print "{}, {}".format(time, frame[soma_index(42)]) + + # full frame of sub-target + view = reader.create_view(range(1, 1000)) + time, frame = view.load( 42.f ) + for gid in range(1, 1000): + print "{}, {}".format(gid, frame[soma_index(gid)]) + + def soma_index(gid): + return view.mapping.offsets[mapping.gids.index(gid)][0] + +## Issues + +### 1: Do we need separate functions for frame-based and trace-based access? + +_Resolution: No_ + +The current CRView::load( start, end ) API already allows selecting a single +Neuron and loading all frames. The brion API will need to change (see above). + +### 2: Do we provide column-major memory layout? + +_Resolution: No_ + +We will not reformat the data layout to be column-major, i.e., packing all +samples of a single compartment together. This is an optimization and we do +not expect today to load more than a few neurons for voltage traces. + +### 3: Should we change the time stamps to double? + +_Resolution: Yes_ + +Reasons: Not memory critical since it's not stored much. Python uses double too, +and with plasticity simulations this becomes critical. This will create some +intermediate inconsistency with other classes. diff --git a/doc/feature/feature.md b/doc/feature/feature.md index 2365018..cb91898 100644 --- a/doc/feature/feature.md +++ b/doc/feature/feature.md @@ -3,6 +3,7 @@ RFCs {#rfcs} * @subpage compartment_report * @subpage compartment_report_mpi +* @subpage compartment_report_py * @subpage morphology11 * @subpage spike_reports * @subpage brain_synapses