Visitar URL original
[SLA] Add helper function `merge_voltage_clusters` by rocco8773 · Pull Request #3037 · PlasmaPy/PlasmaPy · GitHub
Skip to content

[SLA] Add helper function merge_voltage_clusters - #3037

Merged
rocco8773 merged 116 commits into
PlasmaPy:mainfrom
rocco8773:sla_merge_voltage_clusters
Jul 29, 2025
Merged

rocco8773 merged 116 commits into
PlasmaPy:mainfrom
rocco8773:sla_merge_voltage_clusters

Conversation

@rocco8773

@rocco8773 rocco8773 commented Jun 14, 2025 •

Copy link
Copy Markdown
Member

Add helper function merge_voltage_clusters to the plasmapy.analysis.swept_langmuir module. This function takes the two time series voltage and current arrays of a swept langmuir signal and merges clusters/islands of closely spaced voltage values. Since several langmuir analysis techniques requires differentiation, the often irregularly spaced voltage signals can cause erratic behavior during differentiation. Merging clusters can help "smooth out" the signal for differentiation.

Note

PR #3034 needs to be merged first.

@rocco8773 rocco8773 added plasmapy.analysis Related to the plasmapy.analysis subpackage feature For new functionality, excluding breaking changes labels Jun 14, 2025
@github-actions github-actions Bot added testing packaging Related to packaging or distribution python Pull requests that update Python code labels Jun 14, 2025
@codecov

codecov Bot commented Jun 14, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.92308% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.50%. Comparing base (e881bfe) to head (35ae4a5).
⚠️ Report is 65 commits behind head on main.

Files with missing lines Patch % Lines
src/plasmapy/analysis/swept_langmuir/helpers.py 96.92% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3037      +/-   ##
==========================================
+ Coverage   94.70%   95.50%   +0.79%     
==========================================
  Files         108      108              
  Lines        9740     9869     +129     
  Branches     1474     1501      +27     
==========================================
+ Hits         9224     9425     +201     
+ Misses        323      254      -69     
+ Partials      193      190       -3     

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

"""
is_regular_grid = False
if np.count_nonzero(mask_zero_diff) > 0:
# is_regular_grid = False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# is_regular_grid = False

Comment on lines +287 to +288
new_voltage = np.full(voltage.shape, np.nan, dtype=voltage.dtype)
new_current = np.full(current.shape, np.nan, dtype=current.dtype)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I keep forgetting numpy.full exists. 😅


return voltage.copy(), current.copy()

# condition voltage_step_size ... Round 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the comment say why round 2 is needed? 🤔

@rocco8773
rocco8773 enabled auto-merge (squash) July 29, 2025 23:12
@rocco8773
rocco8773 merged commit 836cafd into PlasmaPy:main Jul 29, 2025
@rocco8773
rocco8773 deleted the sla_merge_voltage_clusters branch July 29, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Related to continuous integration feature For new functionality, excluding breaking changes linters Code linters and autoformatters packaging Related to packaging or distribution plasmapy.analysis Related to the plasmapy.analysis subpackage python Pull requests that update Python code static type checking testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants