Пример #1
0
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))))
Пример #2
0
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))))
Пример #3
0
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))))
Пример #4
0
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))))
Пример #5
0
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'))
Пример #6
0
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'))
Пример #7
0
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'))
Пример #8
0
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'))