Skip to content

0.3.0 - #1179

Open
DominiqueMakowski wants to merge 23 commits into
masterfrom
dev
Open

0.3.0#1179
DominiqueMakowski wants to merge 23 commits into
masterfrom
dev

Conversation

@DominiqueMakowski

@DominiqueMakowski DominiqueMakowski commented Mar 2, 2026

Copy link
Copy Markdown
Member

Roadmap

RSP

  • Add rsp_segment() (similar to ppg_segment())
  • Add the cycle overlay plots to RSP
  • Streamline rsp_plot() (same as ppg_plot())

PPG

  • Detect PPG diastolic peaks? (between each peak and the next trough)
  • Add PPG amplitude calculation (reduction can be indicative of vasoconstriction in stress, cold)
  • Document peak-extraction methods (PPG)
  • add more PPG detectors (@peterhcharlton)
  • hrv_rsa(): Add method argument to compute only one RSA signal. Do something with warning that will be thrown when using bio_process() on signals < 32 sec where it will complain that the signal is too short to compute RSA with one of these methods.

Misc

Copilot AI review requested due to automatic review settings March 2, 2026 16:04
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on maintenance and minor improvements to the NeuroKit2 library. It updates the pandas dependency to ensure compatibility with newer versions and refines data processing logic in read_acqknowledge by switching to ffill() for missing data imputation. Additionally, it enhances the epochs_create function to correctly handle 'string' data types during column sanitization and includes general code formatting improvements for better readability.

Highlights

  • Dependency Update: The pandas dependency in pyproject.toml has been updated to >=2.0.0, ensuring compatibility with newer pandas versions.
  • Data Imputation Improvement: The read_acqknowledge function now uses ffill() instead of fillna(method="pad") for forward-filling missing data, which is a more modern and explicit way to achieve the same result.
  • Epoch Creation Enhancement: The epochs_create function has been updated to correctly handle 'string' data types alongside 'object' when sanitizing column data, improving robustness.
  • Code Readability: Minor formatting adjustments have been applied to function signatures and error messages in read_acqknowledge.py and epochs_create.py to enhance code readability.
Changelog
  • neurokit2/data/read_acqknowledge.py
    • Reformatted function signature for improved readability.
    • Reformatted error message for better presentation.
    • Replaced pd.Series.fillna(method="pad") with pd.Series.ffill() for forward-filling missing values.
  • neurokit2/epochs/epochs_create.py
    • Reformatted lines for better readability.
    • Modified select_dtypes to include 'string' alongside 'object' when sanitizing column data types.
  • pyproject.toml
    • Updated the pandas dependency specification from <3.0.0 to >=2.0.0.
Activity
  • No specific activity (comments, reviews, progress) was provided in the context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on updating the pandas dependency to version 2.0.0 or higher. The changes made in read_acqknowledge.py and epochs_create.py are appropriate adjustments for compatibility with the new pandas version, such as using ffill() instead of the deprecated fillna(method='pad') and including the 'string' dtype in type selections. I have one minor suggestion to use an f-string for better code readability when constructing an error message.

Comment thread neurokit2/data/read_acqknowledge.py Outdated
Comment on lines +73 to +74
"NeuroKit error: read_acqknowledge(): couldn't find the following file: "
+ filename

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For improved readability and consistency with modern Python practices, consider using an f-string for formatting the error message.

Suggested change
"NeuroKit error: read_acqknowledge(): couldn't find the following file: "
+ filename
f"NeuroKit error: read_acqknowledge(): couldn't find the following file: {filename}"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 appears to be part of the v0.3.0 prep work, primarily updating pandas compatibility/requirements and making small pandas-2-friendly adjustments in epoch creation and AcqKnowledge import.

Changes:

  • Update core dependency constraint to require pandas>=2.0.0.
  • Adjust epochs_create() dtype sanitization to also consider pandas string dtype columns.
  • Replace deprecated fillna(method="pad") usage with .ffill() in read_acqknowledge().

Reviewed changes

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

File Description
pyproject.toml Updates pandas dependency requirement to >=2.0.0.
neurokit2/epochs/epochs_create.py Updates dtype sanitization logic to include string dtype columns.
neurokit2/data/read_acqknowledge.py Switches to .ffill() for forward-filling missing samples (pandas 2 friendly).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

).items():
# Check whether columns are indices or label/condition
values = column.unique().tolist()
zero_or_one = all(x in [0, 1] for x in values)

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

zero_or_one = all(x in [0, 1] for x in values) can raise when values contains pd.NA (common with pandas string dtype). Consider filtering missing values first (e.g., drop/skip NA) before the membership test, or use a pandas/NumPy NA-safe check so epochs_create() doesn't crash on missing labels/conditions.

Suggested change
zero_or_one = all(x in [0, 1] for x in values)
# Filter out missing values (e.g., pd.NA, np.nan) before membership test
non_na_values = [x for x in values if not pd.isna(x)]
zero_or_one = bool(non_na_values) and all(x in (0, 1) for x in non_na_values)

Copilot uses AI. Check for mistakes.
Comment on lines 223 to 224
values = column.unique().tolist()
zero_or_one = all(x in [0, 1] for x in values)

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

There are tests for epochs_create(), but none appear to cover missing event labels/conditions (e.g., pd.NA) or pre-existing string dtype columns. Adding a regression test for those cases would help prevent crashes in the dtype-sanitization loop introduced/expanded here.

Suggested change
values = column.unique().tolist()
zero_or_one = all(x in [0, 1] for x in values)
# Use non-missing values only to avoid ambiguous comparisons with pd.NA
values = column.dropna().unique().tolist()
zero_or_one = len(values) > 0 and all(x in [0, 1] for x in values)

Copilot uses AI. Check for mistakes.
Comment thread pyproject.toml
"requests",
"numpy>=2.0.0",
"pandas<3.0.0",
"pandas>=2.0.0",

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description reads like a general roadmap and references Issue #593, but this PR’s actual change here is adjusting the pandas dependency. Please update the PR description (or title) to reflect the concrete changes being made in this release/PR so reviewers and future readers can understand intent and impact.

Copilot uses AI. Check for mistakes.
@DominiqueMakowski

Copy link
Copy Markdown
Member Author

@DerAndereJohannes sorry ot bother you aggain, was curious what do you think is the best pipeline & process to autoformat, should we run ruff format manually before comitting?

@DerAndereJohannes

Copy link
Copy Markdown
Collaborator

Have you installed pre-commit for your local version of the repository? This should automatically do the formatting on commit! Or did that somehow fail?

Also since you are targeting pandas version 3, this might be something a bit more major, should we consider doing v1.0.0? Then we can start to use the last number as quick patches if e.g., a dependency needs to be capped etc. Like in the example of pandas, we would just do for version v1.0.1 instead of needing to do a v0.2.14 - Which looks a bit more major

@codecov-commenter

codecov-commenter commented Mar 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.17%. Comparing base (ff419d9) to head (9f3a1a5).

Files with missing lines Patch % Lines
neurokit2/data/read_acqknowledge.py 62.50% 3 Missing ⚠️
neurokit2/signal/signal_recompose.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1179      +/-   ##
==========================================
+ Coverage   57.78%   58.17%   +0.39%     
==========================================
  Files         310      310              
  Lines       15680    15702      +22     
==========================================
+ Hits         9060     9135      +75     
+ Misses       6620     6567      -53     

☔ View full report in Codecov by Harness.
📢 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.

@DominiqueMakowski

Copy link
Copy Markdown
Member Author

Have you installed pre-commit for your local version of the repository?

How do you do that?

should we consider doing v1.0.0?

Instead of 0.3.0? you're probably right yes, I think we're long overdue having a 1.0 :)

@DerAndereJohannes

Copy link
Copy Markdown
Collaborator

https://neuropsychology.github.io/NeuroKit/resources/contributing.html#setting-up-your-environment
And
https://neuropsychology.github.io/NeuroKit/resources/contributing.html#pre-commit-hooks-automatic-formatting ;-)

Yeah, I think we should respond quite quick to install errors when they happen and I think this is the best way of doing it

@DominiqueMakowski

Copy link
Copy Markdown
Member Author

ngl it's a bit embarrassing of me not to have bothered looking into our docs but alas' 😅

@pull-request-size pull-request-size Bot added size/XS and removed size/S labels Mar 2, 2026
@DerAndereJohannes

Copy link
Copy Markdown
Collaborator

Happens to the best of us 😉

- Lowers package size to under 1 MB
@pull-request-size pull-request-size Bot added size/S and removed size/XS labels Mar 3, 2026
Lyroth001 and others added 8 commits March 17, 2026 11:09
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…to readAcqFix

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
[Fix] Read acqknowledge now tries to convert sample rate to int
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Mar 19, 2026
- Adds default return values to different ecg functions if there is no r
  peak
- Adds warnings that there was no R peak for the user
- Solves Issue #1151
[Fix] Handle errors when no ECG R Peak is found in ecg_process
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 19, 2026
@stale

stale Bot commented Jun 7, 2026

Copy link
Copy Markdown

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale Bot added the wontfix This will not be worked on label Jun 7, 2026
@stale stale Bot removed the wontfix This will not be worked on label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants