Igor Pro

From PharmWiki
Revision as of 11:08, 31 January 2022 by Admin (talk | contribs) (→‎Numpy)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • Arthur G. Roberts and Gershon Mensah are contributors to this page. We want to develop a system with integration with Python and other software programs to make it easier for the laboratory. I, Arthur G. Roberts, have with Igor Pro, since Version 4.0. With Version 9.0, I want to build it in a systemic way. We want software customized for each student. Eventually, we would like to have the customization work in several different languages.

Beginning Steps

  1. Install Igor Pro 9
  2. Install the latest version of Spyder, which is a Python IDE.


  • Software with menus designed specifically for each student.
  • Software that will allow access to everything as well.
  • Fitting functions that show the shape and the parameters of the functions.
  • One category of functions that we want are obviously Menus.
  • Better organized than previous version.


  1. Install Anaconda3 globally, so Igor can access it.
  2. Create an environment called Igor
  3. Install Spyder

First Steps

  • Make a prefs file and design menus.
  1. If you are using Igor Pro 9.0 and Windows, you will need to change the permissions of the folders User Procedures and Igor Procedures, so that you can use them. Our recommendation is to set writable permissions for the accounts that will use the software.
  2. There are several procedures in the Igor Procedures directory. I moved those to a directory called Original. I did this to simplify the menus for students.
  3. Open Igor Pro 9
  4. If you are using Windows 10, change the permissions of the User Procedures and Igor Procedures files
  5. Windows ⇒ Procedure Windows ⇒ Procedure Window
    1. The following should come up: Igor001.png
  6. File ⇒ Save Procedure Copy...
  7. Save it as "Startup.ipf" in the Igor Procedures folder

Igor Pro Function

Function Name Comments Procedure Location References
Anaconda3() Test Anaconda 3 installation on Windows 10 Igor Procedures/Startup.ipf PyScripts.ipf

Igor Pro vs Python

Igor Python
sprintf OuputText, "(%s)", InputText OutputText="("+InputText+")"

Igor Instructions

What is the "?"?

? :
? : is the conditional operator, which is a shorthand form of an if-else-endif statement. It is of the form: 
<expression> ? <TRUE> : <FALSE>  
When expression is nonzero, it evaluates the TRUE part, otherwise it evaluates the FALSE part. The ":" character in the conditional operator must always be separated with spaces from the two adjacent operands. 
The operands must be numeric; for strings, you must use the SelectString function.
See Operators for a list of all operators in order of precedence.
Replace zero values with blanks:
Wave w = wave0
w = w[p]==0 ? NaN : w[p]
See Also
SelectNumber, SelectString, If-Else-Endif Statements

Igor versus Python


Make/O/N=100 preWave=sin(p)
Wave w=preWave
w = w[p]==0 ? Nan : w(p)

Python Version

import numpy as np
p = np.arange(0,100)
preWave = np.sine(p)
# https://www.w3schools.com/python/numpy/numpy_array_search.asp
# for increment in np.where(w == 0):
for p in w:
     if w[p]==0:

# Possible Function
# Parse Question
# w = ExpressionStr ? TrueStr : FalseStr
# w = Question(w,ExpressionStr,TrueStr,FalseStr)

def Question(w,ExressionStr,TrueStr,FalseStr):
	for p in w:
        if exec(ExpressionStr):
    return w

p = np.arange(0,100)
preWave = np.sine(p)
w = preWave
w = Question(w,"w[p]==0","none","w[p]")