Where is the detail explanation of MODIFYSETTINGS key word "Tfg"?
Hi, I’m trying to develop a ZPL macro that can get the Through Focus Geometic MTF which modifysettings key word is “Tfg”. But I’m not able to find detail explanation of “Tfg” in UserManual.PDF. In case of “Tfm”, I know the Modifysettings of “Tfm” is supported.
I was able to run the ZPL code like below.
MODIFYSETTINGS tfmcfg$, TFM_SAMP, calc_tfm_samp
But the ZPL code include “Tfg” like below has errored.
MODIFYSETTINGS tfgcfg$, TFG_SAMP, calc_tfg_samp
ERROR in MODIFYSETTINGS: Incorrect version number in settings file.
Please let me know whether “Tfg” code is supported or not?
Keiya Yoshida
Page 1 / 1
Hi @Keiya.Yoshida,
If you didn’t find the settings list in the Help File for MODIFYSETTINGS, then it is likely that they haven’t been implement (thus not supported).
For your information, the Through Focus Geometric MTF is fully implemented in the ZOS-API though. Meaning you can adjust the settings directly in the ZOS-API and the analysis will return a data series.
There’s a thorough ZOS-API example to Retrive Data from FFT MTF (example 04) in the Programming..ZOS-API Help..ZOS-API Syntax Help, and here’s a minimal example to edit the settings of the Through Focus Geometric MTF in Python:
# Open new Geometric Through Focus MTF analysis geo_mtf = TheSystem.Analyses.New_GeometricThroughFocusMtf()
# Edit settings (list of available settings in the Syntax Help File) geo_mtf_settings.Field.SetFieldNumber(1) geo_mtf_settings.UsePolarization = True
# Apply settings and run analysis geo_mtf.ApplyAndWaitForCompletion()
# Close analysis geo_mtf.Close()
Down the line, there’s also a Python module called ZOSPy, which supplements the ZOS-API that you might want to check out in the future if you like the ZOS-API (it helps with running the ZOS-API in a more “Pythonic” way).
Hope this helps, and take care,
David
Hi, David
Thank you for your reply!
It means that I have no choise but to use ZOS-API instead of using ZPL macro.
And it will be a great help of showing me your sample code.
I will use it as a reference.
Keiya Yoshida
Hi @Keiya.Yoshida,
There might still be a way to use ZPL, but it could be cumbersome depending what you want to do. I’ll give you the recipe and an example just in case:
Open a Geometric Through Focus MTF manually
Adjust the settings to what you need
Save the settings file by pressing the Save button (this creates a file that has the same name as your lens file, but with *.CFG as the extension, and puts it in the same folder)
Rename this file to something like “<lens_name>_CONFIG00.CFG”
Change the settings as needed
Save the settings file
Rename this file to something like “<lens_name>_CONFIG01.CFG”
Repeat as many times as needed (this is the cumbersome bit)
In your macro, use COPYFILE to copy the different configuration files into the default one before calling the Geometric Throught Focus MTF (more detail in my code below)
And this is an example code. I have made a submacro to remove NN characters on the right of a string (to remove the extension of a file for example). This is the submacro:
# Retrieve input string input$ = $CALLSTR(1)
# Retrieve input number of # characters to be removed nn = CALD(1)
# Input string length length = SLEN(input$)
# Return input string # without its <nn> right-most # characters CALLSETSTR 1, $LEFTSTRING(input$, length-nn)
And then this is my example, which uses the submacro above:
# This script assumes you have < 101 # configuration files with a name defined # as <prefix><XX>.CFG where <XX> is a # two digit integer starting at 00.
# Loop over the configuration files FOR ii, 0, config_num-1, 1 # Retrieve new config file new_config$ = lens_path$ + "\" + prefix$ + $STR(ii) + ".CFG"
# Print current configuration file to be applied PRINT "> " + $STR(ii) + ". " + new_config$
# Copy new config file COPYFILE new_config$, config$
# Run Through Focus Geometric MTF OPENANALYSISWINDOW "tfg" NEXT
For this code to work, you need to have a folder like so:
Where LENS.ZOS is your lens file, and LENS_CONFIGXX.CFG are the configuration files that you saved previously as documented above.
The ZPL code will take every configuration file named LENS_CONFIGXX.CFG and copy it in this folder as LENS.CFG sequentially. After each copy, the code creates a Geometric Through Focus MTF which uses LENS.CFG for its settings. The output looks like so:
And you should also have your Geometric Through Focus MTF open with the corresponding settings. I’m attaching the macros and all my files so you can reproduce the results yourself.
Last thing I should mention about the ZOS-API. Be wary of this peculiarity if you are using Python:
Good luck and take care,
David
One more remark, you could actually use:
# Run Through Focus Geometric MTF OPENANALYSISWINDOW "tfg", new_config$
Instead of COPYFILE. I’ll write a short post about this method and I’ll link to it here once done.
Take care,
David
Here’s the new thread:
Hi, David
Thank you for your kinder advice!! I may have been able to unuderstand. If I want to code that macro by ZPL, you mean that I must use command “OPENANALYSISWINDOW” thought I can’t code it by using command “GETTEXTFILE”. Actually, the ZPL code you attached is a little bit too long and cumbersome! If I have enoght time to revise my ZPL code, I just want to try it.But at firtst, I will try it by using ZOS-API. Thank you.
Keiya Yoshida
Good luck @Keiya.Yoshida, I think you have the right approach. I just wanted to suggest the ZPL approach in case you absolutely didn’t want to use the ZOS-API.