Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codespell: action, config, tox config to detect typos, some typos fixed #151

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Special thanks to Francesco P. Battaglia
*neuroseries* (<https://github.com/NeuroNetMem/neuroseries>) packages,
the latter constituting the core of *pynapple*.

This package was developped by Guillaume Viejo
This package was developed by Guillaume Viejo
(<https://github.com/gviejo>) and other members of the Peyrache Lab.

Logo: Sofia Skromne Carrasco, 2021.
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated.
Put your new functionality into a function with a docstring, and add
the feature to the list in README.nd.
the feature to the list in README.md.
3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and
for PyPy.
<!-- Check
Expand Down
2 changes: 1 addition & 1 deletion docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ In 2021, Guillaume and other trainees in Adrien's lab decided to fork from neuro
------------------

- First release on PyPI.
- Firt minimal version
- First minimal version
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Special thanks to Francesco P. Battaglia
*neuroseries* (<https://github.com/NeuroNetMem/neuroseries>) packages,
the latter constituting the core of *pynapple*.

This package was developped by Guillaume Viejo
This package was developed by Guillaume Viejo
(<https://github.com/gviejo>) and other members of the Peyrache Lab.

Logo: Sofia Skromne Carrasco, 2021.
4 changes: 2 additions & 2 deletions docs/notebooks/pynapple-core-notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
"source": [
"## Time support\n",
"\n",
"A key feature of how pynapple manipulates time series is an inherent time support object defined for Ts, Tsd, TsdFrame and TsGroup objects. The time support object is defined as an IntervalSet that provides the time serie with a context. For example, the restrict operation will automatically update the time support object for the new time series. Ideally, the time support object should be defined for all time series when instantiating them. If no time series is given, the time support is inferred from the start and end of the time series. \n",
"A key feature of how pynapple manipulates time series is an inherent time support object defined for Ts, Tsd, TsdFrame and TsGroup objects. The time support object is defined as an IntervalSet that provides the time series with a context. For example, the restrict operation will automatically update the time support object for the new time series. Ideally, the time support object should be defined for all time series when instantiating them. If no time series is given, the time support is inferred from the start and end of the time series. \n",
"\n",
"In this example, a TsGroup is instantiated with and without a time support. Notice how the frequency of each Ts element is changed when the time support is defined explicitly."
]
Expand Down Expand Up @@ -484,7 +484,7 @@
"source": [
"time_support = nap.IntervalSet(start = 0, end = 200, time_units = 's')\n",
"\n",
"my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 10)), time_units = 's'), # here a simple dictionnary\n",
"my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 10)), time_units = 's'), # here a simple dictionary\n",
" 1:nap.Ts(t = np.sort(np.random.uniform(0, 100, 20)), time_units = 's'),\n",
" 2:nap.Ts(t = np.sort(np.random.uniform(0, 100, 30)), time_units = 's')}\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/pynapple-io-notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"source": [
"Here it shows all the subjects (in this case only A2929), all the sessions and all of the derivatives folders. It shows as well all the NPZ files that contains a pynapple object and the NWB files.\n",
"\n",
"The object project behaves like a nested dictionnary. It is then easy to loop and navigate through a hierarchy of folders when doing analyses. In this case, we are gonna take only the session A2929-200711."
"The object project behaves like a nested dictionary. It is then easy to loop and navigate through a hierarchy of folders when doing analyses. In this case, we are gonna take only the session A2929-200711."
]
},
{
Expand Down Expand Up @@ -293,7 +293,7 @@
"source": [
"## 3. Metadata\n",
"\n",
"A good practice for sharing datasets is to write as many metainformation as possible. Following BIDS specifications, any data files should be accompagned by a JSON sidecar file. "
"A good practice for sharing datasets is to write as many metainformation as possible. Following BIDS specifications, any data files should be accompanied by a JSON sidecar file. "
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/pynapple-old-io-notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"\n",
"This script demonstrates how to load data in pynapple.\n",
"\n",
"The general workflow of loading a session is described by the infographic below. As it is challenging to accomodate all possible types of format, we aimed to keep the IO of pynapple minimal while allowing the user to inherit the base loader and import their own custom io functions. The base loader is thus responsible for initializing the NWB file containing the tracking data, the epochs and the session informations. An example of a custom IO class is shown at the end of this tutorial.\n",
"The general workflow of loading a session is described by the infographic below. As it is challenging to accommodate all possible types of format, we aimed to keep the IO of pynapple minimal while allowing the user to inherit the base loader and import their own custom io functions. The base loader is thus responsible for initializing the NWB file containing the tracking data, the epochs and the session information. An example of a custom IO class is shown at the end of this tutorial.\n",
"\n",
"\n",
"<!-- <img src=\"images/base_loader_pynapple.png\" width=700 height=700 /> -->\n",
Expand Down Expand Up @@ -81,10 +81,10 @@
"\n",
"The tracking tab allows to load tracking data saved with a CSV file. Reading a CSV file is always a challenge when the header is unknown. The default csv file should contains only one row for the header with the column names. The first column should be the time index in seconds. Other formats are DeepLabCut and Optitrack.\n",
"\n",
"Frame alignement can vary as well. Pynapple offers three ways to align the tracking frames :\n",
"Frame alignment can vary as well. Pynapple offers three ways to align the tracking frames :\n",
"- Global timestamps: the time column of the CSV file contains the timestamps aligned to the global timeframe of the session.\n",
"- Local timestamps: the time column of the CSV file contains the timestamps aligned to one epoch. In this case, the user should select which epoch.\n",
"- TTL detection: a binary file containing TTL pulses for each tracking frame is located within the folder and can be loaded. Alignement is made with TTL detection.\n",
"- TTL detection: a binary file containing TTL pulses for each tracking frame is located within the folder and can be loaded. Alignment is made with TTL detection.\n",
"\n",
"In this example session, Tracking was made with Optitrack and TTL pulses were written to an analogin file recorded by an Intan RHD2000 recording system. The parameters for the tracking tab are shown below.\n",
"\n",
Expand Down Expand Up @@ -244,7 +244,7 @@
" success = self.load_my_nwb(path)\n",
" if success: loading_my_data = False\n",
"\n",
" # Bypass if data have already been transfered to nwb\n",
" # Bypass if data have already been transferred to nwb\n",
" if loading_my_data:\n",
" self.load_my_data(path)\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/notebooks/pynapple-quick-start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"***\n",
"\n",
"This notebook is meant to provide an overview of pynapple by going through:\n",
"1. **Input output (IO)**. In this case, pynapple will load a session containing data processed with NeuroSuite and automatically create a [NWB file](https://pynwb.readthedocs.io/en/stable/). See this [notebook](https://peyrachelab.github.io/pynapple/notebooks/pynapple-io-notebook/) for more informations about IO and how to make a custom IO.\n",
"2. **Core functions** that handle time series, interval sets and groups of time series. See this [notebook](https://peyrachelab.github.io/pynapple/notebooks/pynapple-core-notebook/) for a detailled usage of the core functions.\n",
"1. **Input output (IO)**. In this case, pynapple will load a session containing data processed with NeuroSuite and automatically create a [NWB file](https://pynwb.readthedocs.io/en/stable/). See this [notebook](https://peyrachelab.github.io/pynapple/notebooks/pynapple-io-notebook/) for more information about IO and how to make a custom IO.\n",
"2. **Core functions** that handle time series, interval sets and groups of time series. See this [notebook](https://peyrachelab.github.io/pynapple/notebooks/pynapple-core-notebook/) for a detailed usage of the core functions.\n",
"3. **Process functions**. A small collection of high-level functions widely used in system neuroscience. This [notebook](https://peyrachelab.github.io/pynapple/notebooks/pynapple-process-notebook/) details those functions. Examples of higher analysis can be found in the collaborative repository [pynacollada](https://github.com/PeyracheLab/pynacollada).\n",
"\n"
]
Expand Down Expand Up @@ -125,7 +125,7 @@
"source": [
"*spikes* is a [TsGroup](https://peyrachelab.github.io/pynapple/core.ts_group/) object. It allows to group together time series with different timestamps and couple metainformation to each neuron. In this case, the location of where the neuron was recorded has been added when loading the session for the first time.\n",
"\n",
"In this case, the TsGroup holds 15 neurons and it is possible to access, similar to a dictionnary, the spike times of a single neuron: "
"In this case, the TsGroup holds 15 neurons and it is possible to access, similar to a dictionary, the spike times of a single neuron: "
]
},
{
Expand Down Expand Up @@ -340,7 +340,7 @@
"id": "2caf07b6",
"metadata": {},
"source": [
"The epochs above the threshold can be accessed through the time support of the Tsd object. The time support is an important concept in the pynapple package. It helps the user to define the epochs for which the time serie should be defined. By default, Ts, Tsd and TsGroup objects possess a time support (defined as an IntervalSet). It is recommended to pass the time support when instantiating one of those objects."
"The epochs above the threshold can be accessed through the time support of the Tsd object. The time support is an important concept in the pynapple package. It helps the user to define the epochs for which the time series should be defined. By default, Ts, Tsd and TsGroup objects possess a time support (defined as an IntervalSet). It is recommended to pass the time support when instantiating one of those objects."
]
},
{
Expand Down Expand Up @@ -811,7 +811,7 @@
"id": "fcdb8fa1",
"metadata": {},
"source": [
"From the previous figure, we can see that neurons 0 and 1 fires for opposite directions during wake. Therefore we expect their cross-correlograms to show a trough around 0 time lag, meaning those two neurons do not fire spikes together. A similar trough during sleep for the same pair thus indicates a persistence of their coordination even if the animal is not moving its head."
"From the previous figure, we can see that neurons 0 and 1 fires for opposite directions during wake. Therefore we expect their cross-correlograms to show a through around 0 time lag, meaning those two neurons do not fire spikes together. A similar through during sleep for the same pair thus indicates a persistence of their coordination even if the animal is not moving its head."
]
},
{
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/tutorial_pynapple_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@
# Multiple time series with different time stamps
# (.i.e. a group of neurons with different spike times from one session)
# can be grouped with the TsGroup object.
# The TsGroup behaves like a dictionnary but it is also possible to slice with a list of indexes
# The TsGroup behaves like a dictionary but it is also possible to slice with a list of indexes


my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 1000)), time_units = 's'), # here a simple dictionnary
my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 1000)), time_units = 's'), # here a simple dictionary
1:nap.Ts(t = np.sort(np.random.uniform(0, 100, 2000)), time_units = 's'),
2:nap.Ts(t = np.sort(np.random.uniform(0, 100, 3000)), time_units = 's')}

tsgroup = nap.TsGroup(my_ts)

print(tsgroup, '\n')
print(tsgroup[0], '\n') # dictionnary like indexing returns directly the Ts object
print(tsgroup[0], '\n') # dictionary like indexing returns directly the Ts object
print(tsgroup[[0,2]]) # list like indexing

# Operations such as restrict can thus be directly applied to the TsGroup as well as other operations.
Expand Down Expand Up @@ -118,15 +118,15 @@

# ## Time support
# A key element of the manipulation of time series by pynapple is the inherent time support defined for Ts, Tsd, TsdFrame and TsGroup objects.
# The time support is defined as an IntervalSet that provides the time serie with a context.
# The time support is defined as an IntervalSet that provides the time series with a context.
# For example,, the restrict operation will update automatically the time support to the new time series.
# Ideally the time support should be defined for all time series when instantiating them.
# If no time series is given, the time support is inferred from the start and end of the time series.
# In this example, a TsGroup is instantiated with and without a time support. Notice how the frequency of each Ts element is changed when the time support is defined explicitely.
# In this example, a TsGroup is instantiated with and without a time support. Notice how the frequency of each Ts element is changed when the time support is defined explicitly.

time_support = nap.IntervalSet(start = 0, end = 100, time_units = 's')

my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 10)), time_units = 's'), # here a simple dictionnary
my_ts = {0:nap.Ts(t = np.sort(np.random.uniform(0, 100, 10)), time_units = 's'), # here a simple dictionary
1:nap.Ts(t = np.sort(np.random.uniform(0, 100, 20)), time_units = 's'),
2:nap.Ts(t = np.sort(np.random.uniform(0, 100, 30)), time_units = 's')}

Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/tutorial_pynapple_quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# The first step is to load the session with the function *load_session*.
# When loading a session for the first time, pynapple will show a GUI
# in order for the user to provide the information about the session, the subject, the tracking, the epochs and the neuronal data.
# When informations has been entered, a [NWB file](https://pynwb.readthedocs.io/en/stable/) is created.
# When information has been entered, a [NWB file](https://pynwb.readthedocs.io/en/stable/) is created.
# In this example dataset, the NWB file already exists.

data = nap.load_session(data_directory, 'neurosuite')
Expand All @@ -57,10 +57,10 @@

# *spikes* is a TsGroup object.
# It allows to group together time series with different timestamps and associate metainformation about each neuron.
# Under the hood, it wraps a dictionnary.
# Under the hood, it wraps a dictionary.
# In this case, the location of where the neuron was recorded has been added when loading the session for the first time.
#
# In this case it holds 15 neurons and it is possible to access, similar to a dictionnary, the spike times of a single neuron:
# In this case it holds 15 neurons and it is possible to access, similar to a dictionary, the spike times of a single neuron:

neuron_0 = spikes[0]
neuron_0
Expand Down Expand Up @@ -112,7 +112,7 @@

# The epochs above the threshold can be accessed through the time support of the Tsd object.
# The time support is an important concept in the pynapple package.
# It helps the user to define the epochs for which the time serie should be defined.
# It helps the user to define the epochs for which the time series should be defined.
# By default, Ts, Tsd and TsGroup objects possess a time support (defined as an IntervalSet).
# It is recommended to pass the time support when instantiating one of those objects.

Expand Down Expand Up @@ -277,7 +277,7 @@
plt.figure(figsize=(16,5))
plt.subplot(211)
# create a raster plot
# To create a raster plot, we can convert the tsgroup to a tsd and assing to each spikes the order of the peaks
# To create a raster plot, we can convert the tsgroup to a tsd and assign to each spikes the order of the peaks
spikes_adn_tsd = spikes_adn.to_tsd("order")
# And plot it
plt.plot(spikes_adn_tsd.restrict(subep), '|', markersize = 10)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ dependencies:
- pip:
- alabaster==0.7.12
- arrow==1.2.1
- astroid==2.6.6
- asteroid==2.6.6
- astunparse==1.6.3
- atomicwrites==1.4.0
- autopep8==1.5.7
Expand Down
6 changes: 3 additions & 3 deletions pynapple/core/interval_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, start, end=None, time_units="s", **kwargs):
time_units : str, optional
Time unit of the intervals ('us', 'ms', 's' [default])
**kwargs
Additional parameters passed ot pandas.DataFrame
Additional parameters passed to pandas.DataFrame

Returns
-------
Expand Down Expand Up @@ -324,7 +324,7 @@ def drop_short_intervals(self, threshold, time_units="s"):
threshold : numeric
Time threshold for "short" intervals
time_units : None, optional
The time units for the treshold ('us', 'ms', 's' [default])
The time units for the threshold ('us', 'ms', 's' [default])

Returns
-------
Expand All @@ -347,7 +347,7 @@ def drop_long_intervals(self, threshold, time_units="s"):
threshold : numeric
Time threshold for "long" intervals
time_units : None, optional
The time units for the treshold ('us', 'ms', 's' [default])
The time units for the threshold ('us', 'ms', 's' [default])

Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions pynapple/core/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ def restrict(self, ep):

def count(self, *args, **kwargs):
"""
Count occurences of events within bin_size or within a set of bins defined as an IntervalSet.
Count occurrences of events within bin_size or within a set of bins defined as an IntervalSet.
You can call this function in multiple ways :

1. *tsd.count(bin_size=1, time_units = 'ms')*
-> Count occurence of events within a 1 ms bin defined on the time support of the object.
-> Count occurrence of events within a 1 ms bin defined on the time support of the object.

2. *tsd.count(1, ep=my_epochs)*
-> Count occurent of events within a 1 second bin defined on the IntervalSet my_epochs.
Expand Down
Loading