Skip to main content

Generated from aind-library-template

Project description

aind_disrnn_utils

License Code Style semantic-release: angular Interrogate Coverage Python

Usage

Creating a dataset

  • Obtain a list of NWB files you wish to fit the model to
import aind_dynamic_foraging_multisession_analysis.multisession_load as ms_load
import aind_disrnn_utils as dl

nwbs, df_trials = ms_load.make_multisession_trials_df(nwb_files)
dataset = dl.create_disrnn_dataset(df_trials)
  • You don't need to use make_multisession_trials_df, but the trials data frame does need to have a column "ses_idx" that splits trials into sessions.

Predefined datasets

This Code Ocean Capsule can be used for loading a list of sessions and saving the result as a dataframe: Code Ocean Capsule

The resulting data assets can be used like:

import pandas as pd
import aind_disrnn_utils.data_loader as dl
df = pd.read_csv('/data/disrnn_dataset_774212/disrnn_dataset.csv')
dataset = dl.create_disrrn_dataset(df)
Dataset name mouse id # trials # sessions data asset ID Task
disrnn_dataset_774212 774212 16184 31 ad5ec889-f4e0-45a2-802c-f843266d3cce Uncoupled Without Baiting
disrnn_dataset_779531 779531 7272 12 64fa1cb4-8af8-4d96-a965-3454d59439f6 Uncoupled Without Baiting
disrnn_dataset_781173 781173 8132 15 9788eb8d-ea88-4c60-bacc-1a23efd2f5e1 Uncoupled Without Baiting
disrnn_dataset_781162 781162 6417 12 8eaa487e-e78c-4635-b24b-eabe680a55ae Uncoupled Without Baiting
disrnn_dataset_778077 778077 8336 15 76fc65d3-eec4-4578-a20d-499193fc920e Uncoupled Without Baiting

The datasets can be combined to fit easily:

import pandas as pd
import aind_disrnn_utils.data_loader as dl

mice = [77412, 779531, 781173, 781162, 778077]
dfs = []
for mouse in mice:
    dfs.append(pd.read_csv('/data/disrnn_dataset_{}/disrnn_dataset.csv'.format(mouse)))
df = pd.concat(dfs)
dataset = dl.create_disrrn_dataset(df)

Saving results

After fitting the network, you can add the latent states and predictions back into the dataframe of trials:

df_trials = dl.add_model_results(df_trials, network_states.__array__(), yhat, ignore_policy=ignore_policy)

Installation

To install the software from PyPi

pip install aind-disrnn-utils

To use the software, in the root directory, run

pip install -e .

To develop the code, run

pip install -e . --group dev

Note: --group flag is available only in pip versions >=25.1

Alternatively, if using uv, run

uv sync

Level of Support

  • Occasional updates: We are planning on occasional updating this tool with no fixed schedule. Community involvement is encouraged through both issues and pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aind_disrnn_utils-0.0.15.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aind_disrnn_utils-0.0.15-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file aind_disrnn_utils-0.0.15.tar.gz.

File metadata

  • Download URL: aind_disrnn_utils-0.0.15.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aind_disrnn_utils-0.0.15.tar.gz
Algorithm Hash digest
SHA256 066d4b9520a9f710f69d1accb995edaf7ac90de49ad12c665437f09e8d6cf0a5
MD5 51e3fb17d15839d35b38693372a1fc24
BLAKE2b-256 583e33139d47c3c94b65761c149014fe30637e4b8f2d15cdc94a75a2b891d6b7

See more details on using hashes here.

File details

Details for the file aind_disrnn_utils-0.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for aind_disrnn_utils-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 a0eed304b1d8e37e15e37f68aae90d61d84e1a13454eab4d55cfc9012789404b
MD5 336d9e6c8029d323b3e4ce1c8382ca0f
BLAKE2b-256 bc9037c6749eb30ec8a9f1f0bd623869b36e452fd81cce6efdde6d674a6b1b13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page