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 Output SpinState to SampleLog in PolarizationCorrectionFredrikze Algorithm #38447

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yusufjimoh
Copy link
Contributor

@yusufjimoh yusufjimoh commented Nov 26, 2024

Description of work

  • Added functions to include spin state information in the PolarizationCorrectionFredrikZe algorithm.
  • Modified mapOutputWorkspaceToSpinState to append output spin states to the sample log when requested.
  • Updated unit tests to verify that the order of output workspaces aligns with the specified output spin states and that spin state information is correctly recorded in the sample log.
  • Updated documentation to reflect the new functionality and clarify its usage

Fixes #38265

To test:

Test for PA

  1. Run the following script. It will output a group of workspaces called "out". Check that the sample log of each child workspace does not contain an entry with the name spin_state_ORSO.
run1 = Load("POLREF00004699.nxs")
run2 = run1 * 1.2
run = GroupWorkspaces([run1, run2])
ws1 = CreateWorkspace([0.01, 17.0, 34.0], [50000, 50000])
eff = JoinISISPolarizationEfficiencies(Pp=ws1,   Rho=ws1, Ap=ws1, Alpha=ws1)
run = ConvertUnits(run, "Wavelength")
eff = ConvertUnits(eff, "Wavelength")
eff = RebinToWorkspace(eff, run.getItem(0), True)

out = PolarizationCorrectionFredrikze(run, eff, "PA", InputSpinStates="pp, pa, ap, aa", OutputSpinStates="pp, pa, ap, aa")
  1. Without clearing any of your workspaces, run the following:
with_log = PolarizationCorrectionFredrikze(run, eff, "PA", InputSpinStates="pp, pa, ap, aa", OutputSpinStates="pp, pa, ap, aa", AddSpinStateToLog=True)

Check that the sample log of each child workspace in the "with_log" group does contain an entry with the name spin_state_ORSO. The log values should be as follows:

  • with_log_1 workspace has value pp
  • with_log_2 workspace has value pm
  • with_log_3 workspace has value mp
  • with_log_4 workspace has value mm
  1. Test the functionality on the GUI using the same input workspaces and spinstates
  • when AddSpinStateToLog checkbox is not enabled: Check that the sample log of each child workspace does not contain an entry with the name spin_state_ORSO.

  • when addSpinStateToLog checkbox is enabled: Check that the sample log of each child workspace in the "with_log" group does contain an entry with the name spin_state_ORSO. The log values should be as follows:

  • with_log_1 workspace has value pp

  • with_log_2 workspace has value pm

  • with_log_3 workspace has value mp

  • with_log_4 workspace has value mm

Test for PNR

  1. clear your workspaces and run the following script. It will output a group of workspaces called "out". Check that the sample log of each child workspace does not contain an entry with the name spin_state_ORSO.
run = Load("POLREF00004699.nxs")
ws1 = CreateWorkspace([0.01, 17.0, 34.0], [50000, 50000])
eff = JoinISISPolarizationEfficiencies(Pp=ws1,   Rho=ws1, Ap=ws1, Alpha=ws1)
run = ConvertUnits(run, "Wavelength")
eff = ConvertUnits(eff, "Wavelength")
eff = RebinToWorkspace(eff, run.getItem(0), True)

out = PolarizationCorrectionFredrikze(run, eff, "PNR", InputSpinStates="p, a", OutputSpinStates="p, a")
  1. Without clearing any of your workspaces, run the following:
with_log = out = PolarizationCorrectionFredrikze(run, eff, "PNR", InputSpinStates="p, a", OutputSpinStates="p, a", AddSpinStateToLog=True)

Check that the sample log of each child workspace in the "with_log" group does contain an entry with the name spin_state_ORSO. The log values should be as follows:

  • with_log_1 workspace has value po
  • with_log_2 workspace has value mo
  1. Test the functionality on the GUI using the same input workspaces and spinstates
  • when AddSpinStateToLog checkbox is not enabled: Check that the sample log of each child workspace does not contain an entry with the name spin_state_ORSO.

  • when addSpinStateToLog checkbox is enabled: Check that the sample log of each child workspace in the "with_log" group does contain an entry with the name spin_state_ORSO. The log values should be as follows:

  • with_log_1 workspace has value po

  • with_log_2 workspace has value mo

@yusufjimoh yusufjimoh added Reflectometry Issues and pull requests related to reflectometry ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS labels Nov 26, 2024
@yusufjimoh yusufjimoh added this to the Release 6.12 milestone Nov 26, 2024
@yusufjimoh yusufjimoh force-pushed the 38265-add-output-spin-state-to-sample-log-in-polarizationcorrectionfredrikze branch from 43e7234 to ac010a2 Compare November 26, 2024 13:47
@adriazalvarez adriazalvarez self-assigned this Nov 27, 2024
… Algorithm

- added function to add spinstate to polarizationcorrection fredrikze algorithm
- modified mapoutputworkspacetospinstate to add outspinstate to samplelog if requested
- updated unit tests to check that the order of output workspaces matches the order of specified output spinstates in the samplelog
- updated documentation
@yusufjimoh yusufjimoh force-pushed the 38265-add-output-spin-state-to-sample-log-in-polarizationcorrectionfredrikze branch from ac010a2 to be89651 Compare November 28, 2024 09:40
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
None yet
Development

Successfully merging this pull request may close these issues.

Add output spin state to sample log in PolarizationCorrectionFredrikze
2 participants