Post by SNNAP Board Admin on Nov 30, 2004 17:49:40 GMT -5
A sample "fnc" file is attached.
Treatment file extension to include functions
Created by Yidao Cai on June 1, 2000
Last modified on June 17, 2000
Rationale
Current treatment file for current injection only takes a fixed magnitude.
There are cases that more complex form of treatment is needed, e.g. sinewave,
ramp, exponential.
Design
For compability with old style, change the line
2.0 > Magnitude >
to
trt.fnc > Magnitude >
where trt.fnc is the file to specify functions
Section of a treatment file (*.trt)
>----------------------->------------------------------->
CURNT_INJ: > Timing for currnt injection >
>.......................>...............................>
soma > Name of Neuron >
>.......................>...............................>
2.0 > Start injection >
>.......................>...............................>
12.0 > Stop injection >
>.......................>...............................>
2.0 > Magnitude >
>----------------------->------------------------------->
END > >
>----------------------->------------------------------->
In a *.fnc file, we set the basic type
f = g * pow(X1, p1) * pow(X2, p2) * pow(X3, p3) * ...
g: magnitude scaling factor
X(n) are functions
p(n) are powers (integers)
>----------------------->------------------------------->
> > f = g * pow(X1, p1) * pow(X2, p2) * ...
> ................................................................>
3.2 >g< > scaling factor
1 >N< > number of pow(X, p) term
>----------------------->------------------------------->
X(n) may take several forms, and this section will be repeated
N times.
1. sinewave:
X = k + sin(2 * PI *(t/T + alpha))
specify period T in sec, and alpha in fraction of a period.
alpha is the phase lead/delay re. sine phase.
k is the offset applied to the sine wave, which moves the waveform
up and down. The sine waveform has a range of [-1, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
1 > type 1, sinewave
> ................................................................>
> X = k + sin(2 * PI *(t/T + alpha))
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
0 >k< > offset value for the waveform
>----------------------->----------------------------------------->
2. triangular
x = alpha + t/T
x = x - INT(x) # INT(x) is the integer portion of X
if (x >= 0 && x < 0.5) X = (k2 - k1) * x * 2 + k1;
if (x >= 0.5 && x < 1.0) X = k2 - (k2 - k1) * (x-0.5) * 2;
period T in sec,
alpha is the phase lead/delay re. sine phase, in fraction of a period.
k1 and k2 modify the range of X, and should be [-1, 1] or [0, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
2 > type 2, triangular
> ................................................................>
> x = alpha + t/T
> x = x - INT(x) # INT(x) is the integer portion of X
> if (x >= 0 && x < 0.5) X = (k2 - k1) * x * 2 + k1;
> if (x >= 0.5 && x < 1.0) X = k2 - (k2 - k1) * (x-0.5) * 2;
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
-1 >k1< > minimum value of X, -1, or 0
1 >k2< > maximum value of X, 0 or 1
>----------------------->----------------------------------------->
3. linear ramp
It assumes that the ramp starts at time t1 (re. injection start time)
with a starting value of k1, and from time t2 to injection stop time
it stays at value k2.
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
3 > type 3, linear ramp
> ................................................................>
> if (t <= t1) X = k1;
> if (t > t1 && t < t2) X = (k2 - k1) * (t-t1)/(t2-t1) + k1;
> if (x >= t2) X = k2;
> ................................................................>
1 >p< > power factor for X
0.1 >t1< > time ramp starts, in sec
0.2 >t2< > time ramp ends, in sec
-1 >k1< > starting value of X, -1, 0 or 1
1 >k2< > ending value of X, -1, 0 or 1
>----------------------->----------------------------------------->
4. square
specify period T in sec,
alpha is the phase lead/delay re. sine phase, in fraction of a period.
k1 and k2 modify the range of X, and should be [-1, 1] or [0, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
4 > type 4, square wave
> ................................................................>
> x = alpha + t/T
> x = x - INT(x) # INT(x) is the integer portion of X
> if (x >= 0 && x < 0.5) X = k2; # positive half comes first
> if (x >= 0.5 && x < 1.0) X = k1;
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
-1 >k1< > minimum value of X, -1, or 0
1 >k2< > maximum value of X, 0 or 1
>----------------------->----------------------------------------->
5. exponential A
X = k1 + k2 * exp((t-t0)*u(t-t0)/tau)
t0, tau in sec.
>----------------------->----------------------------------------->
> Note: t, t0 are relative to injection starting time
>----------------------->----------------------------------------->
5 > type 5, exponential function
> ................................................................>
> X = k1 + k2 * exp((t-t0)*u(t-t0)/tau)
> i.e.
> if (t < t0) X = k1 + k2;
> else X = k1 + k2 * exp((t-t0)/tau)
> ................................................................>
1 >p< > power factor for X
0.1 >t0< > delay time, in sec
0.3 >tau< > time constant, in sec
1 >k1< > -1 to 1
-1 >k2< > -1 to 1
>----------------------->----------------------------------------->
Cai
snnap.uth.tmc.edu/post/pic/A0/chen8sample.fnc
Treatment file extension to include functions
Created by Yidao Cai on June 1, 2000
Last modified on June 17, 2000
Rationale
Current treatment file for current injection only takes a fixed magnitude.
There are cases that more complex form of treatment is needed, e.g. sinewave,
ramp, exponential.
Design
For compability with old style, change the line
2.0 > Magnitude >
to
trt.fnc > Magnitude >
where trt.fnc is the file to specify functions
Section of a treatment file (*.trt)
>----------------------->------------------------------->
CURNT_INJ: > Timing for currnt injection >
>.......................>...............................>
soma > Name of Neuron >
>.......................>...............................>
2.0 > Start injection >
>.......................>...............................>
12.0 > Stop injection >
>.......................>...............................>
2.0 > Magnitude >
>----------------------->------------------------------->
END > >
>----------------------->------------------------------->
In a *.fnc file, we set the basic type
f = g * pow(X1, p1) * pow(X2, p2) * pow(X3, p3) * ...
g: magnitude scaling factor
X(n) are functions
p(n) are powers (integers)
>----------------------->------------------------------->
> > f = g * pow(X1, p1) * pow(X2, p2) * ...
> ................................................................>
3.2 >g< > scaling factor
1 >N< > number of pow(X, p) term
>----------------------->------------------------------->
X(n) may take several forms, and this section will be repeated
N times.
1. sinewave:
X = k + sin(2 * PI *(t/T + alpha))
specify period T in sec, and alpha in fraction of a period.
alpha is the phase lead/delay re. sine phase.
k is the offset applied to the sine wave, which moves the waveform
up and down. The sine waveform has a range of [-1, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
1 > type 1, sinewave
> ................................................................>
> X = k + sin(2 * PI *(t/T + alpha))
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
0 >k< > offset value for the waveform
>----------------------->----------------------------------------->
2. triangular
x = alpha + t/T
x = x - INT(x) # INT(x) is the integer portion of X
if (x >= 0 && x < 0.5) X = (k2 - k1) * x * 2 + k1;
if (x >= 0.5 && x < 1.0) X = k2 - (k2 - k1) * (x-0.5) * 2;
period T in sec,
alpha is the phase lead/delay re. sine phase, in fraction of a period.
k1 and k2 modify the range of X, and should be [-1, 1] or [0, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
2 > type 2, triangular
> ................................................................>
> x = alpha + t/T
> x = x - INT(x) # INT(x) is the integer portion of X
> if (x >= 0 && x < 0.5) X = (k2 - k1) * x * 2 + k1;
> if (x >= 0.5 && x < 1.0) X = k2 - (k2 - k1) * (x-0.5) * 2;
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
-1 >k1< > minimum value of X, -1, or 0
1 >k2< > maximum value of X, 0 or 1
>----------------------->----------------------------------------->
3. linear ramp
It assumes that the ramp starts at time t1 (re. injection start time)
with a starting value of k1, and from time t2 to injection stop time
it stays at value k2.
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
3 > type 3, linear ramp
> ................................................................>
> if (t <= t1) X = k1;
> if (t > t1 && t < t2) X = (k2 - k1) * (t-t1)/(t2-t1) + k1;
> if (x >= t2) X = k2;
> ................................................................>
1 >p< > power factor for X
0.1 >t1< > time ramp starts, in sec
0.2 >t2< > time ramp ends, in sec
-1 >k1< > starting value of X, -1, 0 or 1
1 >k2< > ending value of X, -1, 0 or 1
>----------------------->----------------------------------------->
4. square
specify period T in sec,
alpha is the phase lead/delay re. sine phase, in fraction of a period.
k1 and k2 modify the range of X, and should be [-1, 1] or [0, 1].
>----------------------->----------------------------------------->
> Note: t is relative to injection starting time
>----------------------->----------------------------------------->
4 > type 4, square wave
> ................................................................>
> x = alpha + t/T
> x = x - INT(x) # INT(x) is the integer portion of X
> if (x >= 0 && x < 0.5) X = k2; # positive half comes first
> if (x >= 0.5 && x < 1.0) X = k1;
> ................................................................>
1 >p< > power factor for X
0.1 >T< > period, in sec
0 >alpha< > phase lead/delay, in fraction of period
-1 >k1< > minimum value of X, -1, or 0
1 >k2< > maximum value of X, 0 or 1
>----------------------->----------------------------------------->
5. exponential A
X = k1 + k2 * exp((t-t0)*u(t-t0)/tau)
t0, tau in sec.
>----------------------->----------------------------------------->
> Note: t, t0 are relative to injection starting time
>----------------------->----------------------------------------->
5 > type 5, exponential function
> ................................................................>
> X = k1 + k2 * exp((t-t0)*u(t-t0)/tau)
> i.e.
> if (t < t0) X = k1 + k2;
> else X = k1 + k2 * exp((t-t0)/tau)
> ................................................................>
1 >p< > power factor for X
0.1 >t0< > delay time, in sec
0.3 >tau< > time constant, in sec
1 >k1< > -1 to 1
-1 >k2< > -1 to 1
>----------------------->----------------------------------------->
Cai
snnap.uth.tmc.edu/post/pic/A0/chen8sample.fnc