Merit Function Editor (MFE) Functions#
The functions within this category are related Zemax merits. These can be used for a large variate of things, not the least of which is configuring Zemax optimization functions (Solver Functions).
- skZemax.skZemax_subfunctions._MFE_functions.MFE_AddNewOperand(self) ZOSAPI_Editors_MFE_IMFERow[source]#
Adds a new Operand and returns it.
- Returns:
The new MFE operand object
- Return type:
ZOSAPI_Editors_MFE_IMFERow
- skZemax.skZemax_subfunctions._MFE_functions.MFE_GetNumberOfOperands(self) int[source]#
Gets number of Merit function operators
- Returns:
The number of merit function operators
- Return type:
int
- skZemax.skZemax_subfunctions._MFE_functions.MFE_GetOperand(self, operandNum: int) ZOSAPI_Editors_MFE_IMFERow[source]#
Gets an MFE Operand.
- Parameters:
operandNum (int) – The index of the operand.
- Returns:
The operand object.
- Return type:
ZOSAPI_Editors_MFE_IMFERow
- skZemax.skZemax_subfunctions._MFE_functions.MFE_GetOperandValues(self, operand_type: str, param_array: ndarray) ndarray[source]#
This function supports getting direct access to retrieving/queuing operand values.
This is a pretty low level function and can access a lot of properties with much use outside of only a “solver/optimize” context.
There are many (…many…) different operand types which require different inputs to the parameters. Because of the exceeding many options, along with their short and ambiguous names within Zemax and the ZOS-API, there is little point to making any useful skZemax tool to aid a user in the lookup of these operands.
Therefore, this is one of the functions which trusts the user to look up Zemax document on the operands and work out how to call this function. Section 5.2.1.3. Optimization Operand in the main Zemax help pdf is the best resource. A further helpful example can be found in Examples/example07.py where it is used to get the global rotation matrix of a surface element.
- Parameters:
operand_type (str) – A string indicating the operand (see Zemax help pdf: Section 5.2.1.3. Optimization Operand).
param_array (np.ndarray) – Expected as a 2d array which is Nx8 in size, where N is the number of parameter configurations to use in queuing/retrieval of the operand value.
- Returns:
an array of size N, where each index of the returned array is the answer to the Nth que of the param_array.
- Return type:
np.ndarray
- skZemax.skZemax_subfunctions._MFE_functions.MFE_InsertNewOperand(self, newOperand: int | ZOSAPI_Editors_MFE_IMFERow) None[source]#
Inserts a new Operand and returns it.
- Parameters:
newOperand (Union[int, ZOSAPI_Editors_MFE_IMFERow]) – The location to insert the new operand (can be an index or MFE object).
- Returns:
The newly inserted MFE object.
- Return type:
_type_
- skZemax.skZemax_subfunctions._MFE_functions.MFE_SetOperand(self, in_Operand: int | ZOSAPI_Editors_MFE_IMFERow, operand_type: str, target: int | str | float | None = None, weight: int | str | float | None = None, param1: int | str | float | None = None, param2: int | str | float | None = None, param3: int | str | float | None = None, param4: int | str | float | None = None, param5: int | str | float | None = None, param6: int | str | float | None = None, param7: int | str | float | None = None, param8: int | str | float | None = None, comment: int | str | float | None = None, value: int | str | float | None = None, contrib: int | str | float | None = None) None[source]#
Configures a MFE operand. As
MFE_GetOperandValues()discusses, a user is referred to the Zemax help pdf: Section 5.2.1.3. Optimization Operand.For all the param# inputs, if an int is given this function will attempt to explicitly set the property as an int, otherwise expects a string and will trust Zemax API knows how to handle the input (as well as the user for giving good input vs operand type).
This function just maps the operand fields to the correct cells
- Parameters:
in_Operand (Union[int, ZOSAPI_Editors_MFE_IMFERow]) – The MFE operand (can be index or object)
operand_type (str) – a string identifying the optimization (see Section 5.2.1.3)
target (Union[int,str,float], optional) – operand target input, defaults to None
weight (Union[int,str,float], optional) – operand weight input, defaults to None
param1 (Union[int,str,float], optional) – operand param1 input, defaults to None
param2 (Union[int,str,float], optional) – operand param2 input, defaults to None
param3 (Union[int,str,float], optional) – operand param3 input, defaults to None
param4 (Union[int,str,float], optional) – operand param4 input, defaults to None
param5 (Union[int,str,float], optional) – operand param5 input, defaults to None
param6 (Union[int,str,float], optional) – operand param6 input, defaults to None
param7 (Union[int,str,float], optional) – operand param7 input, defaults to None
param8 (Union[int,str,float], optional) – operand param8 input, defaults to None
comment (Union[int,str,float], optional) – operand description, defaults to None
value (Union[int,str,float], optional) – operand value input, defaults to None
contrib (Union[int,str,float], optional) – operand contrib input, defaults to None