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

Improve third derivative #148

Merged
merged 4 commits into from
Dec 6, 2024
Merged

Conversation

GuiMacielPereira
Copy link
Collaborator

Description of work:
Previous third derivative result was padded with 6 zeros on each side.
This improvement extends the range and the function by 6 indices on each side, so that when the third derivative is taken, the size of the resulting array is 12 indices less than the input (6 on each side).

So in essence this just means that I am extending the range before taking the derivative so that after the derivative the size matches the size before the extension.

This just makes sure the derivative is continuous and does not including zero padding, which contributes to a smoother ncp profile (orange line is corrected):

third-derivative-smooth

To test:
Activate an environment with mantidworkbench installed:

  • Checkout this branch and install with pip install .
  • run mvesuvio config
  • Open Mantid workbench and open file ~/.mvesuvio/analysis_inputs.py
  • Click Run
  • Plot workspace analysis_inputs_fwd_0_1.0079_fse_sum and check that curve is smooth at the edges

Extend kinematic arrays (and subsquently y-space arrays and resolution arrays),
so that when the third derivative is taken, no zero padding is necessary.

Adjust arrays inside ncp fit to fit shape [6: -6] coming from third derivative.
Needed to fix unit tests to take into account that kinematic, y-space and
resolution arrays are extended by 6 indices on the edges
Also renamed function to more pythonic style.
And added tests for function to extend range.
Since the final profile changed slightly, needed to update the benchmark for
the system tests. Took this opportunity to run the system tests on a single
MS iteration, instead of the three that were before.
@GuiMacielPereira GuiMacielPereira marked this pull request as ready for review December 4, 2024 16:34
@GuiMacielPereira GuiMacielPereira self-assigned this Dec 4, 2024
@SilkeSchomann
Copy link
Collaborator

I am getting the following AttributeError when running the script:
AttributeError: module 'analysis_inputs' has no attribute 'BackwardAnalysisInputs' File "C:/Users/eoc57742/.mvesuvio/analysis_inputs.py", line 173, in <module> mvesuvio.run() File "C:\Users\eoc57742\AppData\Local\mambaforge\envs\mantid_vesuvio_env\lib\site-packages\mvesuvio\__init__.py", line 53, in run main(run_args) File "C:\Users\eoc57742\AppData\Local\mambaforge\envs\mantid_vesuvio_env\lib\site-packages\mvesuvio\main\__init__.py", line 16, in main __run_analysis() File "C:\Users\eoc57742\AppData\Local\mambaforge\envs\mantid_vesuvio_env\lib\site-packages\mvesuvio\main\__init__.py", line 88, in __run_analysis Runner().run() File "C:\Users\eoc57742\AppData\Local\mambaforge\envs\mantid_vesuvio_env\lib\site-packages\mvesuvio\main\run_routine.py", line 26, in __init__ self.setup() File "C:\Users\eoc57742\AppData\Local\mambaforge\envs\mantid_vesuvio_env\lib\site-packages\mvesuvio\main\run_routine.py", line 33, in setup self.bckwd_ai = ai.BackwardAnalysisInputs

Copy link
Collaborator

@SilkeSchomann SilkeSchomann left a comment

Choose a reason for hiding this comment

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

The ncp profile is smoother now 👍🏻

@GuiMacielPereira GuiMacielPereira merged commit b055d55 into main Dec 6, 2024
1 check passed
@GuiMacielPereira GuiMacielPereira deleted the extend-range-third-derivative branch December 6, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vesuvio-analysis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants