Hi everyone,
I stumbled across an odd behaviour in the ZOS-API regarding CENY with GetOperandValue. I’m using Python 3.8.15, and Pythonnet 3.0.1.
If you run the following code in an interactive extension with the Double Gauss 28 degree field sample file:
1import time23t = time.time()4print('Sampling 0: ' + str(TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.CENY, 0, 1, 2, 0, 0, 0, 0, 0)))5print('Time lapsed: ' + str(time.time()-t))67t = time.time()8print('Sampling 5: ' + str(TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.CENY, 0, 1, 2, 5, 0, 0, 0, 0)))9print('Time lapsed: ' + str(time.time()-t))The console output reads (code run multiple times):
1Sampling 0: 17.4506898763771232Time lapsed: 0.0019748210906982423Sampling 0: 17.4506783246657064Time lapsed: 0.00397658348083496156Sampling 0: 17.4506898763771237Time lapsed: 0.00199151039123535168Sampling 5: 17.4506783246657069Time lapsed: 0.00298118591308593751011Sampling 0: 17.45068987637712312Time lapsed: 0.00197863578796386713Sampling 5: 17.45067832466570614Time lapsed: 0.0030303001403808594The only difference is the sampling of CENY. In the first case, I used 0, and in the second case, I used 5. In the user-interface, if one types 0 in the Samp column, it defaults to 5 (so both cases are identical in the user-interface). As you can see, with 0 the centroid position is slightly different, but more importantly the calculation speed is almost doubled, which is quite valuable for me. In practice, running this snippet multiple times doesn’t always show double the speed, but the calculation time is always smaller for a sampling of 0.
Have you noticed the same? Where does the difference in centroid value come from?
Take care,
David