Skip to main content

PlotDataExport

PlotDataExport

Classes

Name
struct PlotDataExport::HeatmapExportMetadata
Metadata written as comment header in the CSV output.
struct PlotDataExport::PerTrialHeatmapInput
Per-trial data for one unit, suitable for per-trial CSV export.
struct PlotDataExport::HistogramSeriesInput
Input descriptor for one histogram series in a PSTH export.
struct PlotDataExport::HistogramExportMetadata
Metadata written as comment header in the CSV output.
struct PlotDataExport::RasterSeriesInput
Input descriptor for one event series in a raster export.
struct PlotDataExport::RasterExportMetadata
Metadata written as comment header in the CSV output.

Functions

Name
std::string exportHeatmapToCSV(std::vector< std::string > const & unit_keys, std::vector< CorePlotting::HeatmapRowData > const & rows, HeatmapExportMetadata const & metadata ={}, std::string_view delimiter =“,”)
Export aggregate heatmap data to a wide-matrix CSV string.
std::string exportHeatmapPerTrialToCSV(std::vector< PerTrialHeatmapInput > const & data, HeatmapExportMetadata const & metadata ={}, std::string_view delimiter =“,”)
Export per-trial heatmap data to a long-form tidy CSV string.
std::string exportHistogramToCSV(std::vector< HistogramSeriesInput > const & series, HistogramExportMetadata const & metadata ={}, std::string_view delimiter =“,”)
Export histogram/PSTH data to a CSV string.
std::string exportRasterToCSV(std::vector< RasterSeriesInput > const & series, RasterExportMetadata const & metadata ={}, std::string_view delimiter =“,”)
Export raster/event plot data to a CSV string.

Functions Documentation

function exportHeatmapToCSV

inline std::string exportHeatmapToCSV(
    std::vector< std::string > const & unit_keys,
    std::vector< CorePlotting::HeatmapRowData > const & rows,
    HeatmapExportMetadata const & metadata ={},
    std::string_view delimiter =","
)

Export aggregate heatmap data to a wide-matrix CSV string.

Parameters:

  • unit_keys Names for each unit row (e.g. DataManager key strings)
  • rows Heatmap row data (one element per unit)
  • metadata Optional metadata for the comment header
  • delimiter Column delimiter (default: comma)

Return: CSV string ready to be written to a file

Precondition:

  • unit_keys.size() == rows.size()
  • All rows have the same number of bins.

Produces one row per unit where columns are the time-bin values. The header row contains the bin center values as column names, preceded by “unit_key”.

Bin centers are reconstructed from the first row’s bin_start and bin_width. If rows is empty the output contains only the metadata comment header.

auto csv = exportHeatmapToCSV(unit_keys, pipeline_result.rows,
                              {"stimulus_onset", 1000.0, "FiringRateHz", "Binning"});

function exportHeatmapPerTrialToCSV

inline std::string exportHeatmapPerTrialToCSV(
    std::vector< PerTrialHeatmapInput > const & data,
    HeatmapExportMetadata const & metadata ={},
    std::string_view delimiter =","
)

Export per-trial heatmap data to a long-form tidy CSV string.

Parameters:

  • data Per-trial data, one element per unit
  • metadata Optional metadata for the comment header
  • delimiter Column delimiter (default: comma)

Return: CSV string ready to be written to a file

Precondition: For each entry in data, times.size() == per_trial_values[i].size() for all trial indices i.

Produces one row per (unit, trial, time bin) combination. Columns: unit_key, trial_index, bin_center, value.

PerTrialHeatmapInput input;
input.unit_key = "unit_A";
input.times = rate_with_trials.estimate.times;
input.per_trial_values = rate_with_trials.trials.per_trial_values;
auto csv = exportHeatmapPerTrialToCSV({input}, metadata);

function exportHistogramToCSV

inline std::string exportHistogramToCSV(
    std::vector< HistogramSeriesInput > const & series,
    HistogramExportMetadata const & metadata ={},
    std::string_view delimiter =","
)

Export histogram/PSTH data to a CSV string.

Parameters:

  • series Vector of histogram series to export
  • metadata Optional metadata for the comment header
  • delimiter Column delimiter (default: comma)

Return: CSV string ready to be written to a file

Precondition: All entries in series must have non-null data pointers.

Produces a long-form tidy CSV with one row per (bin, series) pair. Multiple series are interleaved, distinguished by the event_key column.

HistogramSeriesInput input{"spikes", &histogram_data};
auto csv = exportHistogramToCSV({input}, {"stimulus_onset", 1000.0, "FiringRateHz", "Binning"});

function exportRasterToCSV

inline std::string exportRasterToCSV(
    std::vector< RasterSeriesInput > const & series,
    RasterExportMetadata const & metadata ={},
    std::string_view delimiter =","
)

Export raster/event plot data to a CSV string.

Parameters:

  • series Vector of event series to export
  • metadata Optional metadata for the comment header
  • delimiter Column delimiter (default: comma)

Return: CSV string ready to be written to a file

Precondition: All entries in series must have non-null gathered and time_frame pointers.

Produces a long-form tidy CSV with one row per event occurrence. Multiple event series are interleaved, distinguished by the event_key column.

Relative time is computed as: event.time() - gathered.alignmentTimeAt(trial)

auto gathered = gather(spikes, trials);
RasterSeriesInput input{"spikes", &gathered, time_frame.get()};
auto csv = exportRasterToCSV({input}, {"stimulus_onset", 1000.0});

Updated on 2026-11-13 at 20:25:41 +0000