Skip to content

Conversation

@edeno
Copy link
Collaborator

@edeno edeno commented Aug 7, 2025

Description

Fixes #1358

This pull request ensures that the results directory is created if it doesn't already exist before saving output files in both the clusterless and sorted spikes decoding modules. This change improves reliability by preventing errors when writing results to non-existent directories.

Directory creation improvements:

  • In src/spyglass/decoding/v1/clusterless.py, the make method now creates the results directory using Path(config["SPYGLASS_ANALYSIS_DIR"]) / nwb_file_name before generating and saving results files.
  • In src/spyglass/decoding/v1/sorted_spikes.py, the make method similarly ensures the results directory exists before saving results.

Checklist:

  • This PR should be accompanied by a release: (yes/no/unsure)
  • If release, I have updated the CITATION.cff
  • This PR makes edits to table definitions: (yes/no)
  • If table edits, I have included an alter snippet for release notes.
  • If this PR makes changes to position, I ran the relevant tests locally.
  • I have updated the CHANGELOG.md with PR number and description.
  • I have added/edited docs/notebooks to reflect the changes

@edeno edeno requested a review from Copilot August 7, 2025 19:46

This comment was marked as outdated.

@edeno edeno changed the title Make sure parent directory exists Make sure parent directory exists in decoding Aug 7, 2025
@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.71%. Comparing base (4a198e5) to head (f2fd46c).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1362      +/-   ##
==========================================
+ Coverage   69.66%   69.71%   +0.05%     
==========================================
  Files         103      103              
  Lines       12532    12539       +7     
==========================================
+ Hits         8730     8742      +12     
+ Misses       3802     3797       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edeno edeno requested review from CBroz1 and Copilot August 8, 2025 14:20

This comment was marked as outdated.

@edeno edeno requested a review from Copilot August 8, 2025 15:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where decoding operations could fail if the results directory doesn't exist by ensuring parent directories are created before saving output files. This addresses issue #1358 and improves the reliability of the decoding modules.

Key changes:

  • Added directory creation logic in both clusterless and sorted spikes decoding modules
  • Refactored path construction to use a shared results_dir variable for better maintainability
  • Updated changelog to document the fix

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/spyglass/decoding/v1/sorted_spikes.py Added results directory creation and refactored path construction in the make method
src/spyglass/decoding/v1/clusterless.py Added results directory creation and refactored path construction in the make method
CHANGELOG.md Added entry documenting the decoding directory creation fix

@edeno edeno requested a review from MichaelCoulter August 8, 2025 15:05
@edeno edeno added this to the 0.5.6 milestone Aug 8, 2025
@edeno edeno merged commit 78996dd into master Aug 11, 2025
6 checks passed
@edeno edeno deleted the fix-decoding-path branch August 11, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing nwb file error when populating SortedSpikesDecodingV1

3 participants