1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Igor_画像表示

Posted at

Igorを使って二次元画をProcedureで表示する練習用コードです。
このような状態で二次元プロット画像を一枚、中心軸に沿った断面積プロットを右と下に表示するProcedureを作成します。
Graph1.jpg

使用するFunctionは作成用と表示用の二つですが個人的にグラフの表示設定の共通部分には一つ別でProcedureを使うのが好きなので合計三つになっています。

二次元画像作成
Function MakeWave(angle)

Variable angle					//角度の設定
Variable WL,Wid,phi,theta		//波長、ビーム幅、位相、角度の指定(角度はdeg→radの修正)
	WL = 1e-6
	Wid = 2e-6
	phi = 0
	theta = angle/360*(2*pi)

Variable Cell_x,Cell_y		//Cell数の決定
	Cell_x = 1000
	Cell_y = 1000
Variable Min_x,Max_x,Min_y,Max_y	//x軸y軸それぞれの最大値と最小値を指定
	Max_x	= 10e-6
	Max_y	= 10e-6
	Min_x = -Max_x
	Min_y = -Max_y
Variable Step_x,Step_y		//cell数と最大最小値からwaveのstep間隔を決定
	Step_x = (Max_x-Min_x)/Cell_x
	Step_y = (Max_y-Min_y)/Cell_y

Make/o/d/n = (Cell_x,Cell_y) tesWave	//二次元Waveの作成
	Wave test = testWave
	setscale/p x, Min_x,step_x,test		//Waveのセル間隔を指定
	setscale/p y, Min_y,step_y,test

	test = sin(2*pi*(cos(theta)*y+x*sin(theta))*WL^(-1)-phi)*exp(-((y*sin(theta)-x*cos(theta))/Wid)^2)	//sin関数とGaus関数で分布を決定
end
グラフ表示設定(共通部分)
Function set()
ModifyGraph tick=2,mirror=2,btLen=3,font="Arial"
end
グラフ表示設定(三枚同時表示)
Function Disp()

String Filename = "testWave"
Variable Rside,d_image,d_graph,r_image,r_graph
	Rside = 450
	d_image = 220
	d_graph = 350
	r_image = 300
	r_graph = 450
Variable range = 1
Variable i,j
Wave DWave = $(FileName)

Display/k=1/W = (0,0,RSide,d_graph)
Display/W = (0,0,R_image,d_image)/host=#;AppendImage DWave
ModifyImage $(FileName) ctab = {-range,range, Rainbow,0}
set()
Label left "Position [μm]"
Label bottom "Position [μm]"
ModifyGraph prescaleExp=6
ModifyGraph zero=1

Display/W = (0,d_image,R_image,d_graph)/host=##;Appendtograph DWave[][500]
set()
ModifyGraph prescaleExp(bottom)=6, prescaleExp(left)=0
ModifyGraph rgb=(0,0,0)
Label left "Intensity [a.u.]"
Label bottom "Position [μm]"

Display/W = (r_image,0,Rside,d_image)/host=##;Appendtograph DWave[500][]
Modifygraph swapXY = 1
ModifyGraph prescaleExp(left)=6, prescaleExp(bottom)=0
ModifyGraph rgb=(0,0,0)
set()
Label left "Position [μm]"
Label bottom "Intensity [a.u.]"

end
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?