PointProcessDecoder.Core 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PointProcessDecoder.Core --version 0.1.0                
NuGet\Install-Package PointProcessDecoder.Core -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PointProcessDecoder.Core" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PointProcessDecoder.Core --version 0.1.0                
#r "nuget: PointProcessDecoder.Core, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PointProcessDecoder.Core as a Cake Addin
#addin nuget:?package=PointProcessDecoder.Core&version=0.1.0

// Install PointProcessDecoder.Core as a Cake Tool
#tool nuget:?package=PointProcessDecoder.Core&version=0.1.0                

PointProcessDecoder

This repo contains a C# implementation of the Bayesian state space point process neural decoder. The code is based on the TorchSharp library for .NET/C# and is inspired by the replay_trajectory_classification repository from the Eden-Kramer Lab. It provides a flexible framework for performing neural decoding of observations from spike-train or clusterless mark data.

Overview

The goal of this software is to perform neural decoding. Bayesian state-space models, in particular, provide a framework to model the transitions between states based on neural activity and point processes capture the probabilistic relationship between neural activity and observations.

Features

  • Flexible - many components of the model support custom or user-defined classes with the appropriate interface.
  • TorchSharp integration - supports both CPU and GPU-acceleration

Steps to Build

  1. Install .NET 8: Download the .NET SDK if you haven't already.

  2. Clone the repository:

git clone https://github.com/ncguilbeault/PointProcessDecoder.cs
cd PointProcessDecoder
  1. Restore dependencies:
dotnet restore
  1. Build the solution:
dotnet build

Quickstart

Here is a minimal example of how to use the decoder in a console app:

using PointProcessDecoder.Core;
using PointProcessDecoder.Plot;
using PointProcessDecoder.Simulation;

namespace DecoderDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // 1. Load data.
            // Example: Generate simulated data
            (position, spikeCounts) = Simulation.Utilities.InitializeSimulation1D(
                numNeurons: 40,
                placeFieldRadius: 0.8,
                firingThreshold: 0.2
            );

            // 2. Create the model and select parameters.
            var model = new PointProcessModel(
                estimationMethod: Core.Estimation.EstimationMethod.KernelDensity,
                transitionsType: Core.Transitions.TransitionsType.Uniform,
                encoderType: Core.Encoder.EncoderType.SortedSpikeEncoder,
                decoderType: Core.Decoder.DecoderType.StateSpaceDecoder,
                stateSpaceType: Core.StateSpace.StateSpaceType.DiscreteUniformStateSpace,
                likelihoodType: Core.Likelihood.LikelihoodType.Poisson,
                minStateSpace: [0],
                maxStateSpace: [120],
                stepsStateSpace: [50],
                observationBandwidth: [5],
                stateSpaceDimensions: 1,
                nUnits: 40
            );

            // 4. Encode neural data and observations
            model.Encode(spikeCounts, position);

            // 5. Predict or decode observations from spikes
            var prediction = model.Decode(spikeCounts);

            // 6. Display results
            Heatmap plotPrediction = new(
                xMin: 0,
                xMax: steps * cycles,
                yMin: 0,
                yMax: 120,
                title: "Prediction"
            );

            plotPrediction.Show<float>(
                prediction
            );

            plotPrediction.Save(png: true);
        }
    }
}

References

This work is based on several previously published works. If you use this software, consider citing the following:

  1. Denovellis, E. L., Gillespie, A. K., Coulter, M. E., Sosa, M., Chung, J. E., Eden, U. T., & Frank, L. M. (2021). Hippocampal replay of experience at real-world speeds. Elife, 10, e64505.

  2. Sodkomkham, D., Ciliberti, D., Wilson, M. A., Fukui, K. I., Moriyama, K., Numao, M., & Kloosterman, F. (2016). Kernel density compression for real-time Bayesian encoding/decoding of unsorted hippocampal spikes. Knowledge-Based Systems, 94, 1-12.

Contributions and feedback are welcome!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on PointProcessDecoder.Core:

Package Downloads
PointProcessDecoder.Cpu

A wrapper for TorchSharp-cpu. Enables running the PointProcessDecoder package on the CPU cross-platform.

PointProcessDecoder.Cuda.Linux

A wrapper for TorchSharp-cuda-linux. Enables running the PointProcessDecoder package on the GPU on linux.

PointProcessDecoder.Simulation

A library for running simulations of neural and behavioral data. Designed for use with the PointProcessDecoder package.

PointProcessDecoder.Cuda.Windows

A wrapper for TorchSharp-cuda-windows. Enables running the PointProcessDecoder package on the GPU on windows.

PointProcessDecoder.Plot

A plotting library for the PointProcessDecoder package. Uses the OxyPlot package.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.1 5 1/9/2025
0.1.0 6 1/9/2025