Problem with the code
Giannis
in the follow procedure there is an error during the execution of the macro
In particular in the line: duplicate /O $freqdomain $destw//creates new wave
which is the 14th line in the procedure. Something is wrong with the duplicate operation.
It is highlighted the "freqdomain".
Does anybody could help me to resolve this problem?
Thank you very much in advanced
Regards,
Giannis
#include <ftmagphase>
Macro AbsorptionMax(name,noise,thickness,index)
string name
variable /d noise
variable /d thickness
variable /d index
prompt name "the reference wave name is ?"
prompt noise "the noise floor level in freq domain = ?"
prompt thickness "the sample thickness in [m] is = ?"
prompt index "the THz index of refraction of the sample is ~ ?"
string freqdomain=name+"_dmag"//creates new wave name
string destw=name+"_absmax"
duplicate /O $freqdomain $destw//creates new wave
//calculates maximum measurable absorption coefficient as described in
//Jepsen, P. U.; Fischer, B. M. Optical Letters, 30 (1) 29-31 (2005)
$destw=2*ln(($freqdomain/noise)*4*index/(1+index)^2)/(thickness*100)
SetScale d 0,0,"", $destw
display $destw
Label left "\\Z14\\F'symbol'a\\F'arial'\\Bmax \\M\\Z12 [cm \\S-1\\M\\Z12]";DelayUpdate
Label bottom "\\u#2\\Z12 Frequency [THz]"
SetAxis bottom 0,1e+13
SetAxis left 0,*
ModifyGraph rgb($destw)=(0,0,0)
Endmacro
Macro AbsorptionMax(name,noise,thickness,index)
string name
variable /d noise
variable /d thickness
variable /d index
prompt name "the reference wave name is ?"
prompt noise "the noise floor level in freq domain = ?"
prompt thickness "the sample thickness in [m] is = ?"
prompt index "the THz index of refraction of the sample is ~ ?"
string freqdomain=name+"_dmag"//creates new wave name
string destw=name+"_absmax"
duplicate /O $freqdomain $destw//creates new wave
//calculates maximum measurable absorption coefficient as described in
//Jepsen, P. U.; Fischer, B. M. Optical Letters, 30 (1) 29-31 (2005)
$destw=2*ln(($freqdomain/noise)*4*index/(1+index)^2)/(thickness*100)
SetScale d 0,0,"", $destw
display $destw
Label left "\\Z14\\F'symbol'a\\F'arial'\\Bmax \\M\\Z12 [cm \\S-1\\M\\Z12]";DelayUpdate
Label bottom "\\u#2\\Z12 Frequency [THz]"
SetAxis bottom 0,1e+13
SetAxis left 0,*
ModifyGraph rgb($destw)=(0,0,0)
Endmacro
It looks like your macro accepts in the name parameter the name of an existing wave as a string, and then promptly takes that name and adds "_dmag" to it, and expects that to name an existing wave that can be duplicated as name+"_absmax".
I suspect that the wave name+"_dmag" does not actually exist. It would need to for the Duplicate command to succeed.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
January 8, 2013 at 11:38 pm - Permalink
tank you very much for the response but I do not know what to do in order to resolve the problem.
I am not familiar with programing. Is there any more specific advice?
Thank you very much on advanced
Giannis
January 9, 2013 at 11:11 am - Permalink
So, the prerequisites to run the macro are not fulfilled in your case, probably due to the programmer having a certain course of action in mind with some other preparation/macro coming before executing this one. A quick and dirty fix would be to delete '+"_dmag"' from the line
string freqdomain=name+"_dmag"
, which would then just use the entered name of the wave. I don't know if that would break the purpose of that particular macro, because I would imagine it was written like that for a reason. Maybe you have to use some other command (from a macro set, I guess?) before.January 10, 2013 at 05:50 am - Permalink
thank you very much for your advises. I really appreciate it.
I will implement the suggested changes and I will let you know.
Regards,
Gannis
January 13, 2013 at 10:02 am - Permalink