Sample Python script

The following is a basic template for creating a Python script in CATALYST Professional Focus, where:

<algorithm_name>: name of the algorithm

<argn>: variable, where "n" is the parameter number

You can copy the template script, paste it in the Python Scripting window, and then modify it to suit.

Sample script

from pci.<algorithm_name> import <algorithm_name>
from pci.exceptions import PCIException

<arg1> = “input.pix”
<arg2> = [1,2,3]
…
<argn> = “output.pix”

try:
	<algorithm_name>(<arg1>, <arg2>, …, <argn>)
except PCIException as e:
	print(e)
except Exception as e:
	print(e)	

While not mandatory, when writing a Python script in Focus it is recommended that you retain the following code in your script:

import locale
locale.setlocale(locale.LC_ALL, "")
locale.setlocale(locale.LC_NUMERIC, "C")

By retaining the preceding code, you ensure that Python is configured according to the PCI C/C++ code.

Alterantively, you can use the following method to import algorithms.

from pci import algo
…
algo.<algorithm_name>(<arg1>, <arg2>, …, <argn>)

The preceding method requires only one import, which can be useful when running many PCI algorithms.

PCI also distributes a help() function, which you can use to retrieve algorithm signatures and detailed descriptions.

The following code produces output to the terminal:

from pci.pyrint import pyrint
help(pyrint)

Output:

    pyrint(...)
        Fast pyramid-based interpolation

        Parameters:
         fili     str        - Input PCIDSK file name
         dbic     List[int]  - Input raster channel(s)
         filo     str        - Output-file name
         dboc     List[int]  - Encoded raster channel
         smoothit List[int]  - Number of smoothing iterations
         backval  List[float] - Background (fail) value
         nodatval List[float] - NoData value
         crossnod str        - Interpolate across NoData
         ftype    str        - Output file type
         foptions str        - Output file options

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.