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

Algorithm required to calculate the efficiency of the ISIS SANS spin flipper #36144

Closed
3 of 8 tasks
rbauststfc opened this issue Sep 20, 2023 · 1 comment · Fixed by #37258
Closed
3 of 8 tasks

Algorithm required to calculate the efficiency of the ISIS SANS spin flipper #36144

rbauststfc opened this issue Sep 20, 2023 · 1 comment · Fixed by #37258
Assignees
Labels
ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS SANS Issues and pull requests related to SANS
Milestone

Comments

@rbauststfc
Copy link
Contributor

rbauststfc commented Sep 20, 2023

An algorithm is required to calculate the efficiency of the two spin flippers. This is required for the Polarised SANS reduction at ISIS. Calculating the efficiency of just one of the spin flippers is required for the epic MVP, as SANS are currently only using a single flipper in their setup. They would like the flexibility to support two in the future, though, so the full scope implementation will calculate the efficiency of two flippers.

The algorithm will be used in advance as part of commissioning, rather than calculating the flipper efficiency during the normal polarised SANS reduction workflow. A calibration measurement will be taken and the algorithm will be used to calculate the flipper efficiency and save the result as a Nexus file. This is not expected to vary between experiments, so the file can ultimately be read into the reduction workflow from the user file.

Math

Ixx represents the configuration of the flipper.

Polarisation:

$$ \Huge P_F = \frac{(\frac{I_{00} - I_{10}}{I_{00} + I_{10}})}{(\frac{I_{11} - I_{01}}{I_{11} + I_{01}})} $$

Efficiency:

$$ \huge \epsilon_{F} = \frac {T_{00} - T_{01} + T_{11} - T_{10}} {2(T_{00} - T_{01})} $$

This applies if there is only one flipper, according to Wildes 2006.

Workflow

  • Input:
    • One GroupWorkspace containing 4 periods, assignments of these 4 periods.
    • Optional output filename/path
  • Perform the above equation.
  • Output:
    • Output the resulting workspace to the ADS
    • If the filename is given, output to the directory in ManageUserDirectories
    • If a full path if given, output there.

Requirements for this still need to be gathered.

@rbauststfc rbauststfc added SANS Issues and pull requests related to SANS ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS labels Sep 20, 2023
@dehoni
Copy link

dehoni commented Nov 7, 2023

There is only one algorithm to determine the efficiency of a flipper on the incoming instrument site. We will take care that we expose a variable that shows if the instrument is in a flipper on/off state via a block in IBEX. The efficiency is calculated by simple linear combination and ratios of worksheets.
Below is a code example to calculate the Flipper efficiency PF and the combined polarizer and analyzer efficiency PA. PA will be used further in #36139.

The function takes 4 (monitor) worksheets normalised to incidence flux, nfs1/2 and sf1/2 are the for spin-resolved measurements.

def calculate_beam_polarisation(strname):
strname=str(rnum)+"trans"
output1=Plus(strname+"
"+nsf1,strname+""+nsf2)
output2=Plus(strname+"
"+sf1,strname+""+sf2)
output5=Minus(strname+"
"+nsf2,strname+""+sf1)
output6=Minus(strname+"
"+nsf1,strname+""+sf2)
output7=Plus(strname+"
"+nsf2,strname+""+sf1)
output8=Plus(strname+"
"+nsf1,strname+""+sf2)
PA=Divide(LHSWorkspace=output5, RHSWorkspace=output7, OutputWorkspace='PA
'+strname)
PF=Divide(LHSWorkspace=output6/output8,RHSWorkspace=PA, OutputWorkspace='PF_'+strname)

@rbauststfc rbauststfc added this to the Release 6.10 milestone Feb 19, 2024
@cailafinn cailafinn self-assigned this Mar 4, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 17, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 17, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 17, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 17, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 23, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 23, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 24, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 25, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 26, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue Apr 26, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 1, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
Windows' compiler doesn't seem to want to automatically
do the conversion from std::filesystem::path to string
the way that mac and linux do. So just do it explicitly.

RE mantidproject#36144
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
Windows' compiler doesn't seem to want to automatically
do the conversion from std::filesystem::path to string
the way that mac and linux do. So just do it explicitly.

RE mantidproject#36144
cailafinn added a commit to cailafinn/mantid that referenced this issue May 2, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 3, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
cailafinn added a commit to cailafinn/mantid that referenced this issue May 7, 2024
@rbauststfc rbauststfc changed the title Algorithm required to calculate the efficiency of the ISIS SANS two spin flippers Algorithm required to calculate the efficiency of the ISIS SANS spin flipper May 8, 2024
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 SANS Issues and pull requests related to SANS
Projects
Status: Done
Status: Scientist Review
Development

Successfully merging a pull request may close this issue.

3 participants