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

Add wrapper algorithm to calculate polarization efficiencies #38996

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

MialLewis
Copy link
Contributor

@MialLewis MialLewis commented Feb 28, 2025

Description of work

This PR adds the ReflectometryISISCalculatePolEff algorithm.

This algorithm is a wrapper around ReflectometryISISCreateTransmission, PolarizationEfficienciesWildes and JoinISISPolarizationEfficiencies.

The files needed to test this PR are in the system test data:

  • Non mag runs POLREF32130, POLREF32132
  • Mag runs POLREF32131, POLREF32133
  • Flood workspace: POLREF_Flood_TOF_single_bin.nx5

Please test with a variety of different inputs, example inputs can be seem on the system test.

Status: Open.
#38470

Further detail of work

To test:


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@MialLewis MialLewis added ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS Reflectometry Issues and pull requests related to reflectometry labels Feb 28, 2025
@MialLewis MialLewis force-pushed the add_wrapper_alg_to_calculate_pol_eff branch from 28ecf6e to 9b41539 Compare February 28, 2025 14:48
@MialLewis MialLewis marked this pull request as ready for review March 3, 2025 14:08
@adriazalvarez adriazalvarez self-assigned this Mar 4, 2025
@sf1919 sf1919 added this to the Release 6.13 milestone Mar 6, 2025
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

The algorithm is working fine, it's well structured and neat, and all test are passing.
Testing is well covered with unit and system tests.

I have some minor comments (mostly nitpicked) about documentation and couple other places.

The only issue I have seen is that the temporary workspaces from CreateTransmission algorithm are not deleted, i'm not sure if this is intentional? But if the algorithm is called repeated times, it can create a big chunk of repeated loaded runs that are hidden workspaces (this temporaries are deleted if the CreateTransmission algorithm is called individually)
image

If a ``FloodWorkspace`` is provided then a flood correction is performed as part of :ref:`algm-ReflectometryISISCreateTransmission` for both magnetic and non-magnetic input runs.

If workspace indices are provided to the either of the ``BackgroundProcessingInstructions`` or ``MagBackgroundProcessingInstructions`` properties then a background subtraction is performed as part of :ref:`algm-ReflectometryISISCreateTransmission` for the relevant input runs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add two short sentences indicating where the missing properties are used: IOMonitorIndex, MonitorIntegrationWavelengthMin, MonitorIntegrationWavelengthMax are used to create transmission workspaces.
Filppers, InputPolariserEfficiency, InputAnalyserEfficiency , IncludeDiagnosticsOutput passed to PolarizationEfficienciesWildes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I've decided to do here is that if a property is novel to this algorithm then I've added a short description here. Otherwise I just link to the existing documentation for the child algorithms.

eff_args.update(self._populate_args_dict(_ALGS["EFF_ALG"]))
return eff_args

def _set_output_properties(self, join_ws, eff_output):
Copy link
Contributor

Choose a reason for hiding this comment

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

When I call the algorithm from the python editor, the name of the workspace in the ADS is not the same as the one in the editor but the default value:
image

If I call the algorithm from the editor, but setting IncludeDiagnogsticOutput=True, then the name of the output ws on the ads will be pol_eff.
Maybe this is not something related to this pr but the python interface, do you know why this happens?

Copy link
Contributor Author

@MialLewis MialLewis Mar 10, 2025

Choose a reason for hiding this comment

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

Thanks for spotting this. The python interface (simpleapi) passes the lvalue (pol_eff in this case) into the algorithm as an argument. This lvalue gets assigned as the output name of the first output workspace property.

When IncludeDiagnogsticOutput=True is set, the first workspace property changes to the diagnostic workspace Rho, as opposed to the final OutputWorkspace of this algorithm as one would expect.

To stop this I've had to reorder the algorithm properties so that OutputWorkspace is always the first output workspace property.

@MialLewis MialLewis requested a review from adriazalvarez March 10, 2025 13:42
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. The output workspace name is working well.
I still see the temporary workspaces after running the algorithm. It seems they are not the output workspaces of the create transmission algorithm, but the input ones with the monitors.

@MialLewis
Copy link
Contributor Author

MialLewis commented Mar 11, 2025

Thanks for the changes. The output workspace name is working well. I still see the temporary workspaces after running the algorithm. It seems they are not the output workspaces of the create transmission algorithm, but the input ones with the monitors.

I thought I checked that the clean up worked, but I must have accidently turned off show hidden workspaces!

I think this is more a problem with ISISReflectometryCreateTransmission, so I'll open up a seperate issue.

EDIT: See issue here: #39041

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS Reflectometry Issues and pull requests related to reflectometry
Projects
Development

Successfully merging this pull request may close these issues.

3 participants