Skip to content

Add a python equivalent to MATLABs smoothdata and use in Bayes plots#208

Open
MikeSullivan7 wants to merge 1 commit into
RascalSoftware:mainfrom
MikeSullivan7:bayes_plots_smoothing_moving_average
Open

Add a python equivalent to MATLABs smoothdata and use in Bayes plots#208
MikeSullivan7 wants to merge 1 commit into
RascalSoftware:mainfrom
MikeSullivan7:bayes_plots_smoothing_moving_average

Conversation

@MikeSullivan7
Copy link
Copy Markdown
Collaborator

@MikeSullivan7 MikeSullivan7 commented May 19, 2026

This PR fixes the issue with the Bayes plots smoothing not functioning correctly for background parameters. The issue comes from the use of scipy.ndimage.gaussian_filter1d instead of a moving average smoothing as is used in MATLAB: smoothdata(N, 'movmean').

This PR fixes the issue by implimenting a python version of smoothdata and the function has been benchmarked against results from MATLAB.
smoothdata automatically calculates the averaging window to use but there is no real explanation on how this is calculated. This has been set to 8 as default as this is the value used by MATLAB for RAT data most commonly.

Benchmark for noisy data:
MATLAB vs Python smoothing

Example of new smoothing for Substrate Roughness example:
image

Old smoothing:
python Gaussian smoothing

New smoothing:
python mov_avg smoothing

@MikeSullivan7 MikeSullivan7 marked this pull request as ready for review May 20, 2026 12:25
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.

1 participant