2013年3月10日日曜日

Realistic programing on Igor Pro 1 Introduction

As far as I know, Igor Pro is one of the best analysis software for scientific and engineering researches.

You can analyze your data with very efficient and intuitive way by using only mouth and click.

However, if you could use programing on the Igor Pro, you can reach to much high level analysis while the programing on the Igor Pro is a bit tricky.

 

Here, I would like to write just a simple way how to make program on the Igor Pro.

The detail of the programing is referred to the manual of the Igor Pro.

 

First approach to write a programming on the Igor Pro is to make a "function".

"function" is a program having functionality and written in procedure, that can be made by 

   Windows -> New -> Procedure… 

MakeProcedure

 

The name of the procedure window is determined as

 DetermineProcedureName

 

As a result, you can see the window to write program on the Igor Pro.

ProcedureWindow

 

 

When you are new for the programing, you do not have to care about the initial notation of 

"#pragma rtGlobals=3// Use modern global access method and strict wave access."

 

The font for the procedure can be changed by 

   Procedure -> Text Size -> 

ChangeProcedureFont

 

The setting for the procedure can be saved by

   Procedure -> Capture Procedure Prefs...

CaptureProcedurePrefs

 

Now, you are ready to write a program.

 

The easiest function would be a function to do nothing, which is given by

   Function doNothing()

   End

DoNothing

 

 

The "Function" indicates this program is a function.

The following string of "doNothing" is the name of function.

You need put "()" after the name of the procedure.

Detail in the inside of "()" would be given somewhere else.

All function must be ended with "End".

 

You can call this function by writing the name of this function of "doNothing" in the command line as

DoNothingOnCommandLine

 

This gives  

DoNothingDone

Note that this function gives nothing since we wrote nothing in the function.

 

The second example is the typical program for the all programing language of saying "Hello world".

This is given by

   Function sayHelloWorld()

      print "Hello world"

   end

SayHelloWorld

 

This function gives

DoNothingHelloWorldOnCommandLine

 

The "print" command give the following string of "Hello world" in the command line as shown above.

 

I strongly recommend you to include only one functionality in one "function".

Much complicated functions, which has two or more functions, should be realized by combining "function"s.

The third example calls three command of "command 1", "command 2", and "command 3" as 

CallCommandsOf123

 

When I call "callAllCommandsOf123", this gives

ResultsCommands123

 

The great point of the programming on the Igor Pro is that you do not have to remember the command.

For example, the command to plot the data of dataY vs. dataX is achieved by the button of "To Clip" in New graph window of

GetCommand4Graph

This gives "Display dataY vs dataX" so we know the command to get a new graph is "Display".

The function to plot a new graph is

NewGraphFunction

 

When you want to perform Fourier transform of dataX, the command is achieved by the button of "To Clip" in the Fourier Transforms window of

FFTwindow

This gives "FFT/OUT=1/DEST=dataX_FFT dataX".

Thus, the function for the FFT is 

FFTCommand

When the configuration for the analysis must be changed, like you calculate the magnitude for the Fourier transform and the result is plotted in a new graph, you can get the command by the button of "To Clip" in the window of

FFTCommand2

This gives command of "FFT/OUT=3/DEST=dataX_FFT dataX".

 

0 件のコメント:

コメントを投稿