How can I add my own script?
Find out where the scripts are located, to which you want to add your own script. You can do this by double-clicking a script and seeing in the opened editor, where that file is located. This could for example be in focus/scripts/image/align
Copy one existing script to a new script name, e.g., MyTask.script.
Edit the new script by updating # Title, # SORTORDER, # MANUAL, # DISPLAY:, set <variable> = “”, and the remainder of the c-shell script.
Make sure you don't have two scripts in that folder that have the same # SORTORDER, or only one of them will be shown.
Don't forget to adjust the variable scriptname to the new file name, so that ${scriptname}.log and ${scriptname}.results point to the correct log and results files. In the above example, that would result in “set scriptname = MyTask”
This will result in the new script being visible and usable in that section. In the above example, it would be in the “align” section. If you instead want to define a new group of scripts, then you'd have to tell FOCUS, in which of the four modes this group should appear. Modes are “2D crystals” or “single particle” or “tomography”, etc.. This is done in the file “module.ini” in the upper-level directory.
Don't forget to either send your script to the FOCUS developers so that it will be included in future releases of FOCUS, or keep your own backup copy in a safe place, so that your script isn't lost upon the next software update of FOCUS.
How can I add my own parameter?
Parameters are first defined in the file apps/resources/config/2dx_master.cfg . Find that file and edit it (keep a backup of the original file).
You can edit that file here. At the next compilation, a copy of it will be placed into focus/resources/config/2dx_master.cfg .
Alternatively, you can directly edit focus/resources/config/2dx_master.cfg, but this file would be overwritten upon the next compilation of FOCUS from source.
You will see that in that file, PARAMETER SECTIONS are labeled with
#
#=============================================================================
# SECTION: Image File
#=============================================================================
#
#
# LABEL: Specimen Name
# LEGEND: This allows to store the name of the current specimen.
# EXAMPLE: specimen_name = “-”
# TYPE: Text_Edit
# ISWRONG: YES
set specimen_name = “-”
#
(that should be two simple double-quotes, not something some Wiki or Word editors would place there instead.)
There are different parameter TYPEs, see that file for examples.
There are different additional settings for parameters, such as “# LOCKED:” or “# ISWRONG:”, which control if a parameter is initially locked, or if it is initially shaded to remind the user that that parameter still has to be adjusted.
The additional setting “# SYNC_WITH_UPPPER_LEVEL: YES” defines a parameter as GLOBAL, meaning it will show up in the
GUI with a “globe” sign in front of the entry field, and its value will be globally valid for all images to be processed in that project.
Once you added one parameter to this file, you can use it in the scripts for newly initiated
How can I make my own (new) parameter appear in the GUI in different places?
Once you have defined a new parameter, e.g. MyParameter, in the 2dx_master.cfg file, you can used it in your scripts.
In order to have it displayed and being editable in the parameter panel in the
GUI, add a line to the active script saying
# DISPLAY: MyParameter
In order to have its value being filled in when you press the run button in the
GUI to launch a script, add a line to the active script saying
set MyParameter = “”
(that should be two simple double-quotes at the end, not something some Wiki or Word editor would place there instead.)
Have a look at the directory apps/resources/config/ .
The file(s) projectMenu.inf control, which parameters are accessible in the central library panel in the FOCUS
GUI.
For example, the line
*frame_image_dose (Dse/frm[e/px],mouseover=“Mean electron dose per pixel per frame”,nonlockable,sortable,“%.6f”)
defines that the parameter “frame_image_dose” should be accessible and (due to the star in the first column) be visible by default. The nickname for this parameter will be “Dse/frm[e/px]” with a longer text when the mouse is over that nickname. The parameter will be sortable, and will be displayed as floating-point number with 6 post-comma digits. The “nonlockable” tag is a historic remainder of past functionalities and can be ignored.