Skip to content
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: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
files: .*.py$
- id: end-of-file-fixer
- id: trailing-whitespace
files: .*.py$
- id: check-yaml
- id: check-added-large-files
- id: check-toml
- id: end-of-file-fixer
files: .*.py$
- id: check-yaml
- id: check-added-large-files
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8
hooks:
- id: ruff
args: [ --fix, --exit-zero ]
args: [--fix]
- id: ruff-format

- repo: local
- repo: local
hooks:
- id: pytest
- id: pytest
name: pytest
entry: uv run pytest tests/
language: system
Expand Down
127 changes: 58 additions & 69 deletions neuroEncoder
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def main(args):

# Now that we have the linearization function, we can get the true target
helper.get_true_target(
l_function, in_place=True, show=show_figures, speedMask=True
windowSizeMS, l_function, in_place=True, show=show_figures, speedMask=True
)
Comment on lines 247 to 249
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect function call: The method signature for get_true_target was changed to accept windowSizeMS as the first parameter (line 436-438), but this call doesn't provide it. This will cause a TypeError since windowSizeMS is now a required positional argument. The call should be: helper.get_true_target(windowSizeMS, l_function, in_place=True, show=show_figures, speedMask=True)

Copilot uses AI. Check for mistakes.

Parameters = Params(
Expand Down Expand Up @@ -551,7 +551,7 @@ def main(args):
):
print("Testing sleep set")
# Test sleep as NN
outputs_sleep = TrainerBayes.test_sleep_as_NN(
TrainerBayes.test_sleep_as_NN(
DataHelper.fullBehavior,
bayesMatrices,
windowSizeMS=windowSizeMS,
Expand Down Expand Up @@ -687,9 +687,10 @@ def main(args):
or args.redo
):
num_augmentations = args.num_augmentations
print("num_augmentations", num_augmentations)
if num_augmentations is None:
num_augmentations = 4 if args.window < 0.504 else 2
if Parameters.dataAugmentation:
print("num_augmentations", num_augmentations)
if num_augmentations is None:
num_augmentations = 4 if args.window < 0.504 else 2
NNTrainer.train(
DataHelper.fullBehavior,
windowSizeMS=windowSizeMS,
Expand Down Expand Up @@ -750,22 +751,19 @@ def main(args):
strideFactor=strideFactor,
extract_spikes_counts=True,
)
try:
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="training",
useSpeedMask=True,
training_data=NNTrainer.training_data,
force=args.redo,
l_function=l_function,
)
except:
pass
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="training",
useSpeedMask=True,
training_data=NNTrainer.training_data,
force=args.redo,
l_function=l_function,
)

if (
not os.path.exists(
Expand All @@ -792,22 +790,19 @@ def main(args):
strideFactor=strideFactor,
extract_spikes_counts=True,
)
try:
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
force=args.redo,
target=args.target,
phase=args.phase,
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
)
except:
pass
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
force=args.redo,
target=args.target,
phase=args.phase,
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
)

if (
not os.path.exists(
Expand All @@ -834,22 +829,19 @@ def main(args):
extract_spikes_counts=True,
)

try:
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="cond",
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
force=args.redo,
)
except:
pass
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="cond",
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
force=args.redo,
)

if (
not os.path.exists(
Expand All @@ -876,22 +868,19 @@ def main(args):
extract_spikes_counts=True,
)

try:
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="post",
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
force=args.redo,
)
except:
pass
print_results.print_results(
NNTrainer.folderResult,
windowSizeMS=windowSizeMS,
show=show_figures,
lossSelection=0.5,
euclidean=False,
target=args.target,
phase="post",
training_data=NNTrainer.training_data,
useSpeedMask=True,
l_function=l_function,
force=args.redo,
)

if args.test_sleep and (
not os.path.exists(
Expand Down
30 changes: 22 additions & 8 deletions neuroencoders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,26 @@
__version__ = "0.0.0" # fallback if not installed

from . import (
decoder,
fullEncoder,
importData,
openEphysExport,
resultAnalysis,
simpleBayes,
transformData,
utils,
decoder as decoder,
)
from . import (
fullEncoder as fullEncoder,
)
from . import (
importData as importData,
)
from . import (
openEphysExport as openEphysExport,
)
from . import (
resultAnalysis as resultAnalysis,
)
from . import (
simpleBayes as simpleBayes,
)
from . import (
transformData as transformData,
)
from . import (
utils as utils,
)
4 changes: 2 additions & 2 deletions neuroencoders/decoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
- Decoder (from decode)
"""

from . import decode
from .decode import Decoder
from . import decode as decode
from .decode import Decoder as Decoder
4 changes: 2 additions & 2 deletions neuroencoders/fullEncoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
- an_network (module containing neural network architectures)
"""

from . import an_network
from .an_network import LSTMandSpikeNetwork
from . import an_network as an_network
from .an_network import LSTMandSpikeNetwork as LSTMandSpikeNetwork
Loading