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

#539 Add dtype arg to synthetic.step_function #1018

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lefthandlou
Copy link

Description

Hello! This is my first open source contribution. I have read the Contributing docs and done my best to follow all the guidelines.

Adds dtype argument to synthetic.step_function, per issue #539

Fixes #539

Implemented changes

Insert a description of the changes implemented in the pull request.

  • Add dtype argument
  • Update docstring

Type of change

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change is or requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • [ x] pytest suite using tox, per contributor guidelines
  • [ x] manual testing locally

Checklist:

  • [ x] My code follows the style guidelines of this project
  • [ x] I have performed a self-review of my own code
  • [ x] I have commented my code, particularly in hard-to-understand areas
  • [ x] I have made corresponding changes to the documentation
  • [ x] My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • [ x] New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • [ x] I have checked my code and corrected any misspellings

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (53d818c) to head (2a53aa5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1018   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           78        78           
  Lines         3560      3560           
  Branches       629       629           
=========================================
  Hits          3560      3560           

☔ 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.

Copy link
Contributor

@dkrako dkrako left a comment

Choose a reason for hiding this comment

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

Great first contribution!

Can you add one or two test cases to tests/unit/synthetic/step_function_test.py? A case for np.float64 and np.int64 would be nice.

You can simply copy one of the existing parametrizations like this one:

pytest.param(
{'length': 10, 'steps': [5], 'values': [0], 'start_value': 1},
{'value': np.concatenate([np.ones(5), np.zeros(5)])},
id='length_10_start_value_1_step_5_to_0',
),

For the id just add the dtype as a suffix, i.e. length_10_start_value_1_step_5_to_0_int64.

@SiQube can you help out with the mypy typing error? I'm confused why mypy complains. Maybe using numpy.typing.DTypeLike would work?

src/pymovements/synthetic/step_function.py:34: error: Incompatible default for argument "dtype" (default has type "type[floating[Any]]", argument has type "dtype[Any]")  [assignment]

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.

add dtype argument to synthetic.step function
2 participants