Created
March 10, 2024 02:09
-
-
Save andyfaff/fce6fc3fadbaf9633aa3d767412fbab5 to your computer and use it in GitHub Desktop.
wott
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function/S wottpy(r0, d0) | |
variable r0, d0 | |
// Paths must be POSIX paths (using /). | |
// Paths containing spaces or other nonstandard characters | |
// must be single-quoted. See Apple Techical Note TN2065 for | |
// more on shell scripting via AppleScript. | |
string r0s, d0s | |
r0s = num2str(r0) | |
d0s = num2str(d0) | |
String cmd = "" | |
cmd += "source ~/.bash_profile\n" | |
cmd += "conda activate dev3\n" | |
cmd += "cd /Users/andrew/Documents/Andy/programming/refnx-testdata/data/reduce\n" | |
cmd += "python wott.py " + r0s + " " + d0s + "\n" | |
String igorCmd | |
sprintf igorCmd, "do shell script \"%s\"", cmd | |
// Print igorCmd // For debugging only | |
ExecuteScriptText/UNQ igorCmd | |
Print S_value // For debugging only | |
return S_value | |
End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy as np | |
from refnx.reduce import PlatypusReduce | |
def wott(r0: int, d0: int): | |
r0 = f"PLP{r0:07d}.nx.hdf" | |
d0 = f"PLP{d0:07d}.nx.hdf" | |
d0 = PlatypusReduce(d0) | |
output = d0.reduce(r0) | |
actual = d0.omega_corrected[0][0] | |
nominal = d0.reflected_beam.cat.cat['omega'][0] | |
return actual, nominal | |
if __name__ == "__main__": | |
r0 = int(sys.argv[1]) | |
d0 = int(sys.argv[2]) | |
print(wott(r0, d0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment