Igor Programming Tool

This documents the Igor Programming Tool (IPT) that was developed by byte physics to provide a collection of tools for WaveMetrics Igor Pro. IPT is a command line application that runs outside of Igor Pro and enables users to improve their programming workflows and write better code.

IPT is especially useful if you are working in a team and want to have a clean codebase or you want to apply best practices while writing Igor source code.

Download and Installation

Alternative versions:

Note

ipt is under heavy development and therefore the program is only usable for 3 months after the release.

Use one of the download links above that fits your platform. If its an installer, run it and enable the option that ipt will be added to your PATH. The other variants require you to place it at a location that is accessible through your PATH environment variable or update the PATH environment variable yourself.

Minimum supported OS versions:

  • Windows: 7.0

  • MacOSX: 10.13

  • Linux: Kernel 2.6

winget

We support the installation on Windows using the command line tool winget. To do this just open a terminal and run:

winget install -e --id byte-physics.ipt

The installer will require administrator privileges automatically if the terminal wasn’t already started as administrator.

Warning

The winget install won’t add ipt to your PATH environment variable itself. This problem will be fixed in a future release. To use ipt in your terminal it is recommended to add the installation path to your PATH environment variable manually.

Note

The winget repository won’t contain installer for small bugfixes. If you want to access the latest fix, you have to use the download link from above.

Feature overview

Formatting

ipt can format input files in a uniform and good looking way. Doing this makes it easier for the reader to understand your code and improves collaboration with other users. And remember also your future self is another user!

Input
 FUnction printSumOfEachMember  (wave/wave wv,string   msg)
     variable i
     VARIABLE size=DimSize(wv, 0)
     For  (i=0;i<size;i+=1)
         Wave inner=wv[i]// get inner wave
 Variable waveSum=sum(inner)// sum of inner wave
     printf "%s: sum([%d])=%f\n",msg,i,waveSum
 endfor
 EndMacro
Nicely formatted output
 Function printSumOfEachMember(WAVE/WAVE wv, string msg)
     variable i
     variable size = DimSize(wv, 0)
     for(i = 0; i < size; i += 1)
             WAVE     inner   = wv[i]      // get inner wave
             variable waveSum = sum(inner) // sum of inner wave
             printf "%s: sum([%d])=%f\n", msg, i, waveSum
     endfor
 End

Formatting is done according to our coding conventions.

Syntax checking

At the same time ipt can also check the code to find common errors which would otherwise not be found in Igor Pro.

Function printText()
    WAVE/C/T wv
    print wv
End
ipt format example.ipf

Linting

ipt has a powerful linting mode which applies additional checks and allows code transformations.

For example changing function arguments in the old IP6-style into the new inline style:

Function test(a)
    variable a

    print a
End
Function test(variable a)

    print a
End

The Supported Linter rules page contains a detailed list.

More

More information can be found in the documentation of the special features and in the documentation of all builtin ipt commands.

Problems

You may encounter some problems when working with ipt for the first time. If your problem isn’t described here you can also check the Known Limitations or write us an email listed at our Support and Contact page.

Weird output

Some terminals or console doesn’t support colored output and if the autodetection of ipt fails, you get some garbage in the output printed. To tell ipt to not use any color, you can add the argument --color no to the call.

Output if the terminal doesn’t support color
[3m[94mfile.ipf[0m:1:1: [33mwarning[0m: #pragma rtFunctionErrors=1 expected but not found (LINT: CodeStyleDefaultPragmas)
[3m[94mfile.ipf[0m:1:1: [33mwarning[0m: #pragma rtGlobals=3 expected but not found (LINT: CodeStyleDefaultPragmas)
[3m[94mfile.ipf[0m:1:1: [33mwarning[0m: #pragma TextEncoding="UTF-8" expected but not found (LINT: CodeStyleDefaultPragmas)
ipt with --color no
file.ipf:1:1: warning: #pragma rtFunctionErrors=1 expected but not found (LINT: CodeStyleDefaultPragmas)
file.ipf:1:1: warning: #pragma rtGlobals=3 expected but not found (LINT: CodeStyleDefaultPragmas)
file.ipf:1:1: warning: #pragma TextEncoding="UTF-8" expected but not found (LINT: CodeStyleDefaultPragmas)

Some characters are not correctly printed

Ipt uses Unicode internally and may print Unicode characters in its output. Some terminals doesn’t support Unicode and will render a replacement character instead.

screenshot of an ipt output with a broken unicode character

Ipt has no setting to turn this off or use different characters instead. In most cases you can fix this yourself if you enable Unicode support in your terminal or operating system.

This StackExchange answer describes how to enable Unicode support on Windows 10 to fix this issue. This setting is already enabled with a default Windows 11 installation.