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

added plotting feature using matplotlib #24

Merged
merged 26 commits into from
Apr 26, 2024

Conversation

RabiyaF
Copy link
Collaborator

@RabiyaF RabiyaF commented Mar 11, 2024

Closes #20

The PR adds the plotting feature to Python-RAT. This allows the visualisation of the latest fits of the optimization of the data. The Reflectivity and Scattering Length Density fits are plotted using Matplotlib. These are comparable to the MATLAB plots. This can be seen below by the plots generated using the same data in RAT and Python-RAT.

Task List

  • Added the RATPlots class
  • Added tests.
    Coverage
  • Added doc strings

Additional Information:

  • MATLAB handles error bars differently. It automatically removes cases where the data values are negative on a log scale. Additional logic is added to the RATPlots class to remove cases where data - error is negative to display it correctly on the log scale.
  • Other plotting libraries like Plotly and pyqtgraph were also explored for the plotting feature. But Matplotlib generated good plots and was faster compared to the other libraries in rendering the updated fits onto the plots window.
  • makeSLDProfileXY is always called with a fixed variable nrepeats = 1 in MATLAB. This can probably be removed from the function args in a subsequent refactor.

MATLAB Plots (generated using RAT)
Screenshot 2024-03-10 at 12 47 32

Matplotlib Plots (generated using Python-RAT)
image

@RabiyaF RabiyaF marked this pull request as draft March 11, 2024 16:44
@RabiyaF RabiyaF marked this pull request as ready for review April 18, 2024 20:33
@RabiyaF RabiyaF force-pushed the port-sld-helper-20 branch from 0f8b3fa to 78ea824 Compare April 18, 2024 20:35
@RabiyaF RabiyaF self-assigned this Apr 18, 2024
@RabiyaF RabiyaF added the enhancement New feature or request label Apr 18, 2024
@RabiyaF RabiyaF changed the title added the plotly SLD helper added plotting feature using matplotlib Apr 18, 2024
RAT/plotting.py Outdated Show resolved Hide resolved
RAT/plotting.py Outdated Show resolved Hide resolved
RAT/plotting.py Outdated Show resolved Hide resolved
tests/test_data/plotting/all_layers_1.csv Outdated Show resolved Hide resolved
RAT/plotting.py Outdated Show resolved Hide resolved
RAT/plotting.py Outdated Show resolved Hide resolved
@RabiyaF RabiyaF force-pushed the port-sld-helper-20 branch from ed8f06e to 87d6571 Compare April 25, 2024 15:36
@RabiyaF RabiyaF requested a review from StephenNneji April 25, 2024 16:26
Copy link
Contributor

@StephenNneji StephenNneji left a comment

Choose a reason for hiding this comment

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

Good Job, thanks for your hard work on this one

@StephenNneji StephenNneji merged commit 6bdce54 into RascalSoftware:main Apr 26, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port over plotRefSLDHelper from the MATLAB code
2 participants