def showZButtonDescription(buttonCode): """Get a short description about a button code. showZButtonDescription(buttonCode)->description Parameters ---------- buttonCode : (string) a 3-letter button code Returns ------- description : a shot description about the button code function/analysis type. """ if isZButtonCode(str(buttonCode)): _print_mod( _prettifyText(str(buttonCode), " is a ZEMAX button code", color0='magenta', color1='black')) _print_mod( _prettifyText("Description: ", _Buttons.button_code[str(buttonCode)], color0='blue', color1='black')) else: print("{} is NOT a valid ZEMAX button code.".format(str(buttonCode)))
def showZButtonList(): """List all the button codes showZButtonList()->None (the button codes are printed on screen) """ print("Listing all ZEMAX Button codes:") for code, description in sorted(_Buttons.button_code.items()): _print_mod(_prettifyCodeDesc(code,description)) _print_mod(_boldifyText("Total number of buttons = ",str(len(_Buttons.button_code))))
def showZButtonList(): """List all the button codes showZButtonList()->None (the button codes are printed on screen) """ print("Listing all ZEMAX Button codes:") for code, description in sorted(_Buttons.button_code.items()): _print_mod(_prettifyCodeDesc(code, description)) _print_mod( _boldifyText("Total number of buttons = ", str(len(_Buttons.button_code))))
def showZButtonDescription(buttonCode): """Get a short description about a button code. showZButtonDescription(buttonCode)->description Parameters ---------- buttonCode : (string) a 3-letter button code Returns ------- description : a shot description about the button code function/analysis type. """ if isZButtonCode(str(buttonCode)): _print_mod(_prettifyText(str(buttonCode), " is a ZEMAX button code", color0="magenta", color1="black")) _print_mod(_prettifyText("Description: ", _Buttons.button_code[str(buttonCode)], color0="blue", color1="black")) else: print("{} is NOT a valid ZEMAX button code.".format(str(buttonCode)))
def findZButtonCode(keywords): """Find/search Zemax button codes using specific keywords of interest. findZButtonCode("keyword#1 [, keyword#2, keyword#3, ...]")->searchResult Parameters ---------- keywords : a string containing a list of comma separated keywords. Example ------- >>> zb.findZButtonCode("Zernike") [Zst] Zernike Standard Terms [Zvf] Zernike Coefficients vs. Field [Zfr] Zernike Fringe Terms [Zat] Zernike Annular Terms Found 4 Button codes. >>> zb.findZButtonCode("Fan") [Opd] Opd Fan [Ray] Ray Fan [Ptf] Pol. Transmission Fan [Pab] Pupil Aberration Fan Found 4 Button codes. """ words2find = [words.strip() for words in keywords.split(",")] previousFoundKeys = [] for button, description in _Buttons.button_code.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(button, description)) previousFoundKeys.append(button) break # break the inner for loop if previousFoundKeys: _print_mod( _boldifyText("Found ", str(len(previousFoundKeys)), " Button codes", 'blue', 'red', 'blue'))
def findZButtonCode(keywords): """Find/search Zemax button codes using specific keywords of interest. findZButtonCode("keyword#1 [, keyword#2, keyword#3, ...]")->searchResult Parameters ---------- keywords : a string containing a list of comma separated keywords. Example ------- >>> zb.findZButtonCode("Zernike") [Zst] Zernike Standard Terms [Zvf] Zernike Coefficients vs. Field [Zfr] Zernike Fringe Terms [Zat] Zernike Annular Terms Found 4 Button codes. >>> zb.findZButtonCode("Fan") [Opd] Opd Fan [Ray] Ray Fan [Ptf] Pol. Transmission Fan [Pab] Pupil Aberration Fan Found 4 Button codes. """ words2find = [words.strip() for words in keywords.split(",")] previousFoundKeys = [] for button, description in _Buttons.button_code.items(): for kWord in words2find: if __find(kWord,description): _print_mod(_prettifyCodeDesc(button,description)) previousFoundKeys.append(button) break # break the inner for loop if previousFoundKeys: _print_mod(_boldifyText("Found ", str(len(previousFoundKeys)), " Button codes",'blue','red','blue'))
def findZOperand(keywords): """Find/search Zemax operands using specific keywords of interest. findZOperand("keyword#1 [, keyword#2, keyword#3, ...]")->searchResult Parameters ---------- keywords : a string containing a list of comma separated keywords Example ------- >>> zo.findZOperand("decenter") [TEDY] Tolerance on element y-decenter in lens units [TEDX] Tolerance on element x-decenter in lens units [TUDX] Tolerance on user defined x-decenter in lens units [TUDY] Tolerance on user defined y-decenter in lens units [TSDY] Tolerance on Standard surface y-decenter in lens units [TSDX] Tolerance on Standard surface x-decenter in lens units Found 6 Tolerance operands. [APDY] Surface aperture Y-decenter. [APDX] Surface aperture X-decenter. Found 2 Macro operands. >>> zo.findZOperand('trace') [NSRA] Non-sequential (NS) single ray trace. [NSTR] Non-sequential (NS) trace. See also NSST. [NSST] Non-sequential (NS) single ray trace. See also NSTR. Found 3 Optimization operands. """ words2find = [words.strip() for words in keywords.split(",")] previousFoundKeys = [] for operand, description in _Operands.opt_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod(_boldifyText("Found ", str(len(previousFoundKeys)), " Optimization operands",'blue','red','blue')) previousFoundKeys = [] for operand, description in _Operands.tol_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod(_boldifyText("Found ", str(len(previousFoundKeys)), " Tolerance operands",'blue','red','blue')) previousFoundKeys = [] for operand, description in _Operands.mco_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod(_boldifyText("Found ", str(len(previousFoundKeys)), " Macro operands",'blue','red','blue'))
def showZOperandDescription(operand): """Get a short description about an operand. showZOperandDescription(operand)->description args: operand : a valid ZEMAX operand ret: description : a short description of the operand and the type of operand. """ if isZOperand(str(operand),1): _print_mod(_prettifyText(str(operand), " is a Optimization operand", color0='magenta',color1='black')) _print_mod(_prettifyText("Description: ", _Operands.opt_operands[str(operand)], color0='blue',color1='black')) elif isZOperand(str(operand),2): _print_mod(_prettifyText(str(operand), " is a Tolerancing operand", color0='magenta',color1='black')) _print_mod(_prettifyText("Description: ", _Operands.tol_operands[str(operand)], color0='blue',color1='black')) elif isZOperand(str(operand),3): _print_mod(_prettifyText(str(operand), " is a Multi-configuration operand", color0='magenta',color1='black')) _print_mod(_prettifyText("Description: ", _Operands.mco_operands[str(operand)], color0='blue',color1='black')) else: print("{} is a NOT a valid ZEMAX operand.".format(str(operand)))
def showZOperandList(operandType = 0): """Lists the operands for the specified type with a shot description of each operand. showZOperandList([operandType])->None (the operands are printed on screen) Parameters ---------- operandType : 0 = All operands (use with caution, slow) 1 = Optimization operands 2 = Tolerancing operands (Default) 3 = Multi-configuration operands Returns ------- None (the operands are printed on screen) """ if operandType == 0: print("Listing all operands:") for operand, description in sorted(_Operands.opt_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand,description)) for elem in sorted(_Operands.tol_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand,description)) for elem in sorted(_Operands.mco_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand,description)) totOperands = (len(_Operands.opt_operands) + len(_Operands.tol_operands) + len(_Operands.mco_operands)) #print("\nTotal number of operands = {:d}".format(totOperands)) _print_mod(_boldifyText("Total number of operandss = ",str(totOperands))) else: if operandType == 1: print("Listing Optimization operands:") toList = sorted(_Operands.opt_operands.items()) elif operandType == 2: print("Listing Tolerancing operands:") toList = sorted(_Operands.tol_operands.items()) elif operandType == 3: print("Listing Multi-configuration operands:") toList = sorted(_Operands.mco_operands.items()) for operand, description in toList: _print_mod(_prettifyCodeDesc(operand,description)) _print_mod(_boldifyText("Total number of operands = ",str(len(toList))))
def findZOperand(keywords): """Find/search Zemax operands using specific keywords of interest. findZOperand("keyword#1 [, keyword#2, keyword#3, ...]")->searchResult Parameters ---------- keywords : a string containing a list of comma separated keywords Example ------- >>> zo.findZOperand("decenter") [TEDY] Tolerance on element y-decenter in lens units [TEDX] Tolerance on element x-decenter in lens units [TUDX] Tolerance on user defined x-decenter in lens units [TUDY] Tolerance on user defined y-decenter in lens units [TSDY] Tolerance on Standard surface y-decenter in lens units [TSDX] Tolerance on Standard surface x-decenter in lens units Found 6 Tolerance operands. [APDY] Surface aperture Y-decenter. [APDX] Surface aperture X-decenter. Found 2 Macro operands. >>> zo.findZOperand('trace') [NSRA] Non-sequential single ray trace. [NSTR] Non-sequential trace. See also NSST. [NSST] Non-sequential single ray trace. See also NSTR. Found 3 Optimization operands. """ words2find = [words.strip() for words in keywords.split(",")] previousFoundKeys = [] for operand, description in _Operands.opt_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod( _boldifyText("Found ", str(len(previousFoundKeys)), " Optimization operands", 'blue', 'red', 'blue')) previousFoundKeys = [] for operand, description in _Operands.tol_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod( _boldifyText("Found ", str(len(previousFoundKeys)), " Tolerance operands", 'blue', 'red', 'blue')) previousFoundKeys = [] for operand, description in _Operands.mco_operands.items(): for kWord in words2find: if __find(kWord, description): _print_mod(_prettifyCodeDesc(operand, description)) previousFoundKeys.append(operand) break # break the inner for loop if previousFoundKeys: _print_mod( _boldifyText("Found ", str(len(previousFoundKeys)), " Macro operands", 'blue', 'red', 'blue'))
def showZOperandDescription(operand): """Get a short description about an operand. showZOperandDescription(operand)->description args: operand : a valid ZEMAX operand ret: description : a short description of the operand and the type of operand. """ if isZOperand(str(operand), 1): _print_mod( _prettifyText(str(operand), " is a Optimization operand", color0='magenta', color1='black')) _print_mod( _prettifyText("Description: ", _Operands.opt_operands[str(operand)], color0='blue', color1='black')) elif isZOperand(str(operand), 2): _print_mod( _prettifyText(str(operand), " is a Tolerancing operand", color0='magenta', color1='black')) _print_mod( _prettifyText("Description: ", _Operands.tol_operands[str(operand)], color0='blue', color1='black')) elif isZOperand(str(operand), 3): _print_mod( _prettifyText(str(operand), " is a Multi-configuration operand", color0='magenta', color1='black')) _print_mod( _prettifyText("Description: ", _Operands.mco_operands[str(operand)], color0='blue', color1='black')) else: print("{} is a NOT a valid ZEMAX operand.".format(str(operand)))
def showZOperandList(operandType=0): """Lists the operands for the specified type with a shot description of each operand. showZOperandList([operandType])->None (the operands are printed on screen) Parameters ---------- operandType : 0 = All operands (use with caution, slow) 1 = Optimization operands 2 = Tolerancing operands (Default) 3 = Multi-configuration operands Returns ------- None (the operands are printed on screen) """ if operandType == 0: print("Listing all operands:") for operand, description in sorted(_Operands.opt_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand, description)) for elem in sorted(_Operands.tol_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand, description)) for elem in sorted(_Operands.mco_operands.items()): #print("[",operand,"]",description) _print_mod(_prettifyCodeDesc(operand, description)) totOperands = (len(_Operands.opt_operands) + len(_Operands.tol_operands) + len(_Operands.mco_operands)) #print("\nTotal number of operands = {:d}".format(totOperands)) _print_mod( _boldifyText("Total number of operandss = ", str(totOperands))) else: if operandType == 1: print("Listing Optimization operands:") toList = sorted(_Operands.opt_operands.items()) elif operandType == 2: print("Listing Tolerancing operands:") toList = sorted(_Operands.tol_operands.items()) elif operandType == 3: print("Listing Multi-configuration operands:") toList = sorted(_Operands.mco_operands.items()) for operand, description in toList: _print_mod(_prettifyCodeDesc(operand, description)) _print_mod( _boldifyText("Total number of operands = ", str(len(toList))))