-
Notifications
You must be signed in to change notification settings - Fork 0
/
Curvature - Peng ZHANG.ipf
822 lines (702 loc) · 21.5 KB
/
Curvature - Peng ZHANG.ipf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
#pragma rtGlobals=1 // Use modern global access method.
function Deriv(OldM,num,box,choice) //command line of 2nd derivative
wave OldM
variable num,box,choice
string matname,graphname
if(choice==1)
matname=nameofwave(OldM)+"VD"
duplicate/o OldM,$matname
DM(OldM,$matname,num,box,1)
endif
if(choice==2)
matname=nameofwave(OldM)+"HD"
duplicate/o OldM,$matname
DM(OldM,$matname,num,box,2)
endif
end
function curvature(mat,num,box,choice,factor) //curvature. 1 is EDC, 2 is MDC
wave mat
variable num,box,choice,factor
string diff1mat,diff2mat,matcurv,graphcurv
variable avg,avgv,avgh
if(choice==1)
matcurv=nameofwave(mat)+"_CurvV"
diff1mat=nameofwave(mat)+"dy"; diff2mat=nameofwave(mat)+"dy2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num,box,1)
DM(mat,$diff2mat,num,box,1)
avg=abs(wavemin($diff1mat))
duplicate/o mat T_temp
duplicate/o $diff2mat T_diff2mat; duplicate/o $diff1mat T_diff1mat
T_temp=T_diff2mat/(avg*avg*factor+T_diff1mat*T_diff1mat)^1.5
duplicate/o T_temp $matcurv
endif
if(choice==2)
matcurv=nameofwave(mat)+"_CurvH"
diff1mat=nameofwave(mat)+"dx"; diff2mat=nameofwave(mat)+"dx2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num,box,2)
DM(mat,$diff2mat,num,box,2)
avg=abs(wavemin($diff1mat))
duplicate/o mat T_temp
duplicate/o $diff2mat T_diff2mat; duplicate/o $diff1mat T_diff1mat
T_temp=T_diff2mat/(avg*avg*factor+T_diff1mat*T_diff1mat)^1.5
duplicate/o T_temp $matcurv
endif
end
function curvature2(mat,num,box,num2,box2,choice,factor) //2d curvature and 2D second derivative
wave mat
variable num,box,num2,box2,choice,factor
string diff1mat,diff2mat,matcurv,graphcurv
variable avg,avgv,avgh
variable dx,dy,weight
variable/g t_twoDW
dx=dimdelta(mat,0)
dy=dimdelta(mat,1)
weight=(dx/dy)*(dx/dy)
if(choice==3) //curvature 2D
matcurv=nameofwave(mat)+"_Curv2D"
diff1mat=nameofwave(mat)+"dy"; diff2mat=nameofwave(mat)+"dy2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num,box,1)
DM(mat,$diff2mat,num,box,1)
avgv=abs(wavemin($diff1mat))
duplicate/o $diff2mat T_diff2matV; duplicate/o $diff1mat T_diff1matV
diff1mat=nameofwave(mat)+"dx"; diff2mat=nameofwave(mat)+"dx2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num2,box2,2)
DM(mat,$diff2mat,num,box,2)
avgh=abs(wavemin($diff1mat))
duplicate/o $diff2mat T_diff2matH; duplicate/o $diff1mat T_diff1matH
diff2mat=nameofwave(mat)+"dy"+"dx"
duplicate/o mat $diff2mat
DM(mat,$diff2mat,num,box,4)
duplicate/o mat T_temp,T_maxcurv
duplicate/o $diff2mat T_diff2matVH
if(t_twoDW>0)
weight*=t_twodW
endif
if(t_twoDW<0)
weight/=abs(t_twodW)
endif
avg=max(avgv*avgv,weight*avgh*avgh)
T_temp=((factor*avg+weight*t_diff1math*t_diff1math)*t_diff2matv-2*weight*t_diff1math*t_diff1matv*t_diff2matvh+weight*(factor*avg+t_diff1matv*t_diff1matv)*t_diff2math)/(factor*avg+weight*t_diff1math*t_diff1math+t_diff1matv*t_diff1matv)^1.5
duplicate/o T_temp $matcurv
endif
if(choice==4) // second derivative 2D
matcurv=nameofwave(mat)+"_Deriv2D"
diff1mat=nameofwave(mat)+"dy"; diff2mat=nameofwave(mat)+"dy2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num,box,1)
DM(mat,$diff2mat,num,box,1)
duplicate/o $diff2mat T_diff2matV; duplicate/o $diff1mat T_diff1matV
diff1mat=nameofwave(mat)+"dx"; diff2mat=nameofwave(mat)+"dx2"
duplicate/o mat $diff1mat,$diff2mat
DM1(mat,$diff1mat,num,box,2)
DM(mat,$diff2mat,num,box,2)
duplicate/o $diff2mat T_diff2matH; duplicate/o $diff1mat T_diff1matH
diff2mat=nameofwave(mat)+"dy"+"dx"
duplicate/o mat $diff2mat
DM(mat,$diff2mat,num,box,4)
duplicate/o mat T_temp
duplicate/o $diff2mat T_diff2matVH
if(t_twoDW>0)
weight*=t_twodW
endif
if(t_twoDW<0)
weight/=abs(t_twodW)
endif
T_temp=t_diff2matV+t_diff2matH*weight
duplicate/o T_temp $matcurv
endif
end
function DM(OldM,NewM,num,box,choice) //This second derivative is written by Pierre Richard.
wave oldM,newM
variable num,box,choice
Variable i=0,j=0, l, m, k, x0, dx, y0, dy
Variable j1
Variable startofwave,endofwave
l=dimsize(OldM,0)
m=dimsize(OldM,1)
x0=dimoffset(OldM,0)
dx=dimdelta(OldM,0)
y0=dimoffset(OldM,1)
dy=dimdelta(OldM,1)
make/o/n=(l) f0
make/o/n=(m) f1
setscale/p x x0,dx,"", f0
setscale/p x y0,dy,"", f1
NewM[][]=NaN
if(choice==2) //Horizontal derivative for k-space cuts
i=0
do
f0[]=OldM[p][i]
startofwave=0
If(mod(Round(OldM[startofwave][i]),1)!=0)
DO
startofwave+=1
While((mod(Round(OldM[startofwave][i]),1)!=0)&&(startofwave<dimsize(OldM,0)+1))
Endif
endofwave=dimsize(OldM,0)-1
If(mod(Round(OldM[endofwave][i]),1)!=0)
DO
endofwave-=1
While((mod(Round(OldM[endofwave][i]),1)!=0)&&(endofwave>0))
Endif
Duplicate/O/R=[startofwave,endofwave] f0 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
differentiate tempwave
NewM[startofwave,endofwave][i]=tempwave[p-startofwave]
// j=0
// Do
// NewM[startofwave+j][i]=tempwave[j]
// j+=1
// While(j<dimsize(tempwave,0))
i+=1
while(i<dimsize(OldM,1))
Killwaves f0,f1,tempwave
endif
if(choice==1)//Vertical derivative for k-space cuts
i=0
DO
j=0
If(mod(Round(OldM[i][j]),1)!=0)
DO
j+=1
While((mod(Round(OldM[i][j]),1)!=0)&&(j<dimsize(OldM,1)+1))
Endif
If(j!=dimsize(OldM,1))
f1[]=OldM[i][p]
Duplicate/O/R=[j,*] f1 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
differentiate tempwave
f1[j,*]=tempwave[p-j]
// j1=j
// Do
// f1[j1]=tempwave[j1-j]
// j1+=1
// While(j1<dimsize(f1,0))
NewM[i][]=f1[q]
Endif
i+=1
while(i<l)
Killwaves f1,f0
endif
if(choice==4)
Duplicate/O OldM intermediatemat
intermediatemat[][]=NaN
NewM[][]=NaN
i=0 //first derivative (V)
DO
j=0
If(mod(Round(OldM[i][j]),1)!=0)
DO
j+=1
While((mod(Round(OldM[i][j]),1)!=0)&&(j<dimsize(OldM,1)+1))
Endif
If(j!=dimsize(OldM,1))
f1[]=OldM[i][p]
Duplicate/O/R=[j,*] f1 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
j1=j
Do
f1[j1]=tempwave[j1-j]
j1+=1
While(j1<dimsize(f1,0))
intermediatemat[i][]=f1[q]
Endif
i+=1
while(i<l)
i=0 //Second derivative (H)
do
f0[]=intermediatemat[p][i]
startofwave=0
If(mod(Round(intermediatemat[startofwave][i]),1)!=0)
DO
startofwave+=1
While((mod(Round(intermediatemat[startofwave][i]),1)!=0)&&(startofwave<dimsize(intermediatemat,0)+1))
Endif
endofwave=dimsize(intermediatemat,0)-1
If(mod(Round(intermediatemat[endofwave][i]),1)!=0)
DO
endofwave-=1
While((mod(Round(intermediatemat[endofwave][i]),1)!=0)&&(endofwave>0))
Endif
Duplicate/O/R=[startofwave,endofwave] f0 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
j=0
Do
NewM[startofwave+j][i]=tempwave[j]
j+=1
While(j<dimsize(tempwave,0))
i+=1
while(i<dimsize(intermediatemat,1))
Killwaves f0,f1,tempwave
endif
if(choice==5)
Duplicate/O OldM intermediatemat
intermediatemat[][]=NaN
NewM[][]=NaN
i=0 //first derivative (H)
do
f0[]=OldM[p][i]
startofwave=0
If(mod(Round(OldM[startofwave][i]),1)!=0)
DO
startofwave+=1
While((mod(Round(OldM[startofwave][i]),1)!=0)&&(startofwave<dimsize(OldM,0)+1))
Endif
endofwave=dimsize(OldM,0)-1
If(mod(Round(OldM[endofwave][i]),1)!=0)
DO
endofwave-=1
While((mod(Round(OldM[endofwave][i]),1)!=0)&&(endofwave>0))
Endif
Duplicate/O/R=[startofwave,endofwave] f0 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
j=0
Do
intermediatemat[startofwave+j][i]=tempwave[j]
j+=1
While(j<dimsize(tempwave,0))
i+=1
while(i<dimsize(OldM,1))
i=0 //second derivative (V)
DO
j=0
If(mod(Round(intermediatemat[i][j]),1)!=0)
DO
j+=1
While((mod(Round(intermediatemat[i][j]),1)!=0)&&(j<dimsize(intermediatemat,1)+1))
Endif
If(j!=dimsize(intermediatemat,1))
f1[]=intermediatemat[i][p]
Duplicate/O/R=[j,*] f1 tempwave
Smooth/E=3/B=(num) box,tempwave
differentiate tempwave
j1=j
Do
f1[j1]=tempwave[j1-j]
j1+=1
While(j1<dimsize(f1,0))
NewM[i][]=f1[q]
Endif
i+=1
while(i<l)
Killwaves f0,f1,tempwave
endif
End
function DM1(OldM,NewM,num,box,choice) //This derivative is written by Pierre Richard.
wave oldM,newM
variable num,box,choice
Variable i=0,j=0, l, m, k, x0, dx, y0, dy
Variable j1
Variable startofwave,endofwave
l=dimsize(OldM,0)
m=dimsize(OldM,1)
x0=dimoffset(OldM,0)
dx=dimdelta(OldM,0)
y0=dimoffset(OldM,1)
dy=dimdelta(OldM,1)
make/o/n=(l) f0
make/o/n=(m) f1
setscale/p x x0,dx,"", f0
setscale/p x y0,dy,"", f1
NewM[][]=NaN
if(choice==2) //Horizontal derivative for k-space cuts
i=0
do
f0[]=OldM[p][i]
startofwave=0
If(mod(Round(OldM[startofwave][i]),1)!=0)
DO
startofwave+=1
While((mod(Round(OldM[startofwave][i]),1)!=0)&&(startofwave<dimsize(OldM,0)+1))
Endif
endofwave=dimsize(OldM,0)-1
If(mod(Round(OldM[endofwave][i]),1)!=0)
DO
endofwave-=1
While((mod(Round(OldM[endofwave][i]),1)!=0)&&(endofwave>0))
Endif
Duplicate/O/R=[startofwave,endofwave] f0 tempwave
Smooth/b=(num) box,tempwave
differentiate tempwave
// differentiate tempwave
j=0
Do
NewM[startofwave+j][i]=tempwave[j]
j+=1
While(j<dimsize(tempwave,0))
i+=1
while(i<dimsize(OldM,1))
Killwaves f0,f1,tempwave
endif
if(choice==1)//Vertical derivative for k-space cuts
i=0
DO
j=0
If(mod(Round(OldM[i][j]),1)!=0)
DO
j+=1
While((mod(Round(OldM[i][j]),1)!=0)&&(j<dimsize(OldM,1)+1))
Endif
If(j!=dimsize(OldM,1))
f1[]=OldM[i][p]
Duplicate/O/R=[j,*] f1 tempwave
Smooth/b=(num) box,tempwave
// differentiate tempwave
differentiate tempwave
j1=j
Do
f1[j1]=tempwave[j1-j]
j1+=1
While(j1<dimsize(f1,0))
NewM[i][]=f1[q]
Endif
i+=1
while(i<l)
Killwaves f1,f0
endif
End
//***********************************************************************************
function disp(mat) //disp a matrix
wave mat
string graphname,wavenam
wavenam=nameofwave(mat)
graphname=nameofwave(mat)+"_plot"
if(wintype(graphname)==1)
dowindow/f $graphname
else
display/n=$graphname; appendimage mat
Showinfo
ModifyImage $wavenam,ctab= {*,*,Terrain}
endif
end
function idisp(mat)
wave mat
string graphname,wavenam
wavenam=nameofwave(mat)
graphname=nameofwave(mat)+"_plot"
if(wintype(graphname)==1)
dowindow/f $graphname
else
display/n=$graphname; appendimage mat
Showinfo
ModifyImage $wavenam,ctab= {*,0,Terrain,1}
endif
end
//***********************************************************************************
//***********************************************************************************
macro curv_ini() :panel
variable/g T_EDCT=2
variable/g T_EDCW=5
variable/g T_EDCF=.1
variable/g t_EDCFi=.01
variable/g T_MDCT=2
variable/g T_MDCW=5
variable/g T_MDCF=.1
variable/g t_MDCFi=.01
variable/g T_twoDF=.01
variable/g T_twoDFi=.001
variable/g T_twoDW=1
variable/g T_2dUPdate=0
string/g T_curv_data_STR
If(wintype("curv_panel")==0)
curv_data()
execute "Curv_Panel()"
Else
curv_data()
refresh_disp()
dowindow/f curv_panel
endif
end
//***********************************************************************************
function curv_data()
string/g T_curv_data_STR
string temp
prompt temp, "Enter the wave", popup, wavelist("*",";","DIMS:2")
doprompt "Curvature",temp
if(V_flag)
return -1
endif
T_curv_data_STR=temp
EDCCurv()
MDCcurv()
twoDcurv()
end
//***********************************************************************************
function EDCcurv()
variable/g T_EDCT
variable/g T_EDCW
variable/g T_EDCF
string/g T_curv_data_STR
curvature($t_curv_data_str,T_edct,T_edcw,1,T_edcf)
Deriv($t_curv_data_str,T_edct,T_edcw,1)
end
//*************
function MDCcurv()
variable/g T_MDCT
variable/g T_MDCW
variable/g T_MDCF
string/g T_curv_data_STR
curvature($t_curv_data_str,T_mdct,T_mdcw,2,T_mdcf)
Deriv($t_curv_data_str,T_mdct,T_mdcw,2)
end
//*************
function twoDcurv()
variable/g T_EDCT
variable/g T_EDCW
variable/g T_MDCT
variable/g T_MDCW
variable/g T_twoDF
string/g T_curv_data_STR
curvature2($t_curv_data_str,T_edct,T_edcw,T_mdct,T_mdcw,3,T_twoDf)
curvature2($t_curv_data_str,T_edct,T_edcw,T_mdct,T_mdcw,4,1)
end
//***********************************************************************************
Window Curv_Panel() : Panel
PauseUpdate; Silent 1 // building window...
NewPanel /W=(677,277,1261,495)
ModifyPanel cbRGB=(32768,40777,65535)
SetDrawLayer UserBack
DrawRect 120,25,485,203
SetDrawEnv fstyle= 1
DrawText 146,99,"\\F'Times New Roman'\\Z20MDC"
SetDrawEnv fstyle= 1
DrawText 147,142,"\\F'Times New Roman'\\Z20EDC"
SetDrawEnv fstyle= 1
DrawText 183,71,"\\F'Times New Roman'\\Z20St. Times"
SetDrawEnv fstyle= 1
DrawText 272,70,"\\F'Times New Roman'\\Z20St. Width"
SetDrawEnv fstyle= 1
DrawText 381,70,"\\F'Times New Roman'\\Z20Factor"
SetDrawEnv fstyle= 1
DrawText 153,179,"\\F'Times New Roman'\\Z202D"
Button button_EDCDisp,pos={492.00,74.00},size={34.00,38.00},proc=buttonProc_dispEDCcurv,title="C"
Button button_MDCDisp,pos={492.00,117.00},size={34.00,37.00},proc=buttonProc_dispMDCcurv,title="C"
Button button_2DDisp,pos={492.00,159.00},size={34.00,38.00},proc=buttonProc_disp2Dcurv,title="C"
Button button_EDCDisp1,pos={537.00,74.00},size={34.00,38.00},proc=buttonProc_dispEDCDeriv,title="D"
Button button_MDCDisp1,pos={537.00,117.00},size={34.00,37.00},proc=buttonProc_dispMDCDeriv,title="D"
Button button_2DDisp1,pos={537.00,159.00},size={34.00,38.00},proc=buttonProc_disp2DDeriv,title="D"
Button button_EDCDisp2,pos={492.00,28.00},size={75.00,38.00},proc=buttonProc_dispData,title="Disp"
SetVariable setvar_EDCT,pos={196.00,78.00},size={56.00,20.00},proc=setvarEDCt,title=" "
SetVariable setvar_EDCT,limits={1,inf,1},value= T_edct
SetVariable setvar_EDCW,pos={281.00,78.00},size={57.00,20.00},proc=setvarEDCw,title=" "
SetVariable setvar_EDCW,limits={1,inf,2},value= T_edcW
SetVariable setvar_EDCF,pos={366.00,78.00},size={91.00,20.00},proc=setvarEDCF,title=" "
SetVariable setvar_EDCF,limits={0,inf,0.01},value= T_EDCF
SetVariable setvar_MDCT,pos={196.00,120.00},size={56.00,20.00},proc=setvarmDCt,title=" "
SetVariable setvar_MDCT,limits={1,inf,1},value= T_MdcT
SetVariable setvar_MDCW,pos={281.00,120.00},size={57.00,20.00},proc=setvarmDCw,title=" "
SetVariable setvar_MDCW,limits={1,inf,2},value= T_MdcW
SetVariable setvar_MDCF,pos={366.00,120.00},size={91.00,20.00},proc=setvarmDCF,title=" "
SetVariable setvar_MDCF,limits={0,inf,0.01},value= T_MDCF
SetVariable setvar_TwoDF,pos={363.00,159.00},size={91.00,20.00},proc=setvartwoDF,title=" "
SetVariable setvar_TwoDF,limits={0,inf,1e-006},value= T_twoDF
CheckBox check_2d,pos={17.00,174.00},size={87.00,16.00},title="\\Z142D UPDATE"
CheckBox check_2d,font="Times New Roman",fSize=20,variable= T_2dupdate
Button button_2dCurv,pos={24.00,108.00},size={81.00,46.00},proc=buttonProc_2dCurv,title="2D Curv"
Button button_2dCurv,font="Times New Roman",fSize=20,fStyle=1
Button button_data,pos={21.00,37.00},size={84.00,51.00},proc=buttonProc_curv_data,title="DATA"
Button button_data,font="Times New Roman",fSize=20,fStyle=1
SetVariable setvar_twoDW,pos={178.00,153.00},size={180.00,30.00},proc=setvartwodW,title=" MDC Weight"
SetVariable setvar_twoDW,fSize=20,fStyle=0,value= T_twodW
EndMacro
//***********************************************************************************
Function setvarEDCt(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
edccurv()
variable/g t_2dupdate
if(t_2dupdate==1)
twoDcurv()
endif
End
//**********************
Function setvarEDCw(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
edccurv()
variable/g t_2dupdate
if(t_2dupdate==1)
twoDcurv()
endif
End
//**********************
Function setvarEDCF(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
variable/g t_edcf
variable/g T_EDCFI
t_edcf=ceil(t_EDCF/10^(floor(log(t_EDCF)))-1e-9)*10^(floor(log(t_EDCF)))
t_edcfi=10^(floor(log(t_EDCF)))
if(log(t_EDCF)==round(log(t_edcf)))
t_EDCFI/=10
endif
SetVariable setvar_EDCF,limits={0,inf,t_edcfi },value= T_edcF
edccurv()
End
//**********************
Function setvarmDCt(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
mdccurv()
variable/g t_2dupdate
if(t_2dupdate==1)
twoDcurv()
endif
End
//**********************
Function setvarmDCw(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
mdccurv()
variable/g t_2dupdate
if(t_2dupdate==1)
twoDcurv()
endif
End
//**********************
Function setvarmDCF(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
variable/g t_mdcf
variable/g T_mDCFI
t_mdcf=ceil(t_mDCF/10^(floor(log(t_mDCF)))-1e-9)*10^(floor(log(t_mDCF)))
t_mdcfi=10^(floor(log(t_mDCF)))
if(log(t_mDCF)==round(log(t_mdcf)))
t_mDCFI/=10
endif
SetVariable setvar_MDCF,limits={0,inf,t_mdcfi },value= T_MdcF
mdccurv()
End
//**********************
Function setvartwoDF(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
variable/g t_twodf
variable/g T_twodFI
t_twodf=ceil(t_twodF/10^(floor(log(t_twodF)))-1e-10)*10^(floor(log(t_twodF)))
t_twodfi=10^(floor(log(t_twodF)))
if(log(t_twodF)==round(log(t_twodf)))
t_twodFI/=10
endif
SetVariable setvar_TwoDF,limits={0,inf,t_twoDFi },value= T_twoDF
twodcurv()
End
//**********************
Function setvartwoDW(ctrlName,varNum,varStr,varName): SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
twoDcurv()
End
//***********************************************************************************
Function ButtonProc_dispData(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str
disp($data)
end
Function ButtonProc_dispEDCcurv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"_curvv"
idisp($data)
end
Function ButtonProc_dispMDCcurv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"_curvh"
idisp($data)
end
Function ButtonProc_disp2Dcurv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"_curv2d"
idisp($data)
end
Function ButtonProc_dispEDCDeriv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"VD"
idisp($data)
end
Function ButtonProc_dispMDCDeriv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"HD"
idisp($data)
end
Function ButtonProc_disp2DDeriv(ctrlName) : ButtonControl
string ctrlName
string/g t_curv_data_str
string data=t_curv_data_str+"_Deriv2D"
idisp($data)
end
//***********************************************************************************
Function PopMenuProc_curvcolor(ctrlName,popNum,popStr) : PopupMenuControl
String ctrlName
Variable popNum
String popStr
// dowindow/f curv_panel
SetActiveSubwindow curv_panel#G0
ModifyImage ''#0 ctab= {*,0,$popstr,1}
SetActiveSubwindow curv_panel#G1
ModifyImage ''#0 ctab= {*,0,$popstr,1}
SetActiveSubwindow curv_panel#G2
ModifyImage ''#0 ctab= {*,0,$popstr,1}
SetActiveSubwindow curv_panel#G3
ModifyImage ''#0 ctab= {*,*,$popstr,0}
End
//***********************************************************************************
Function ButtonProc_2dCurv(ctrlName) : ButtonControl
string ctrlName
twoDcurv()
end
//***********************************************************************************
Function CheckProc_2dupdate(ctrlName) : CheckBoxControl //problem!!
string ctrlName
variable/g t_2dupdate
if(t_2dupdate==1)
twoDcurv()
endif
End
//***********************************************************************************
//***********************************************************************************
Function ButtonProc_curv_data(ctrlName) : ButtonControl
string ctrlName
curv_data()
refresh_disp()
end
Function refresh_disp()
string/g t_curv_data_str
string edcname=t_curv_data_str+"_curvv"
string mdcname=t_curv_data_str+"_curvh"
string twodname=t_curv_data_str+"_curv2d"
string graphname
End
//***********************************************************************************
//***********************************************************************************
//***********************************************************************************