The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Use Script to Search for Baseline Anchor Points in
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

StijnR

France
1 Posts

Posted - 12/05/2023 :  07:23:25 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear all,

I am trying to run the script provided on the website: https://www.originlab.com/doc/Tutorials/Use-Script-Anchors

When I follow the procedure on my own dataset, I get the message that no peaks are found but no additional information is given. Does anyone know why it doesn't work? I added the script and the data below:

Dataset dspos;
pkfind iy:=(dsx, dsy) dir:=p npts:=5 value:=200 ocenter:=dspos; // Find major peak positions
int npk=dspos.GetSize(); // Get major peak numbers
// Create datasets to store anchor points
int nn = dsx.GetSize(); // Get source X size
dataset apt_x, apt_y;// Create datasets to store anchor points
apt_x.SetSize(npk+1); // Set anchor points number
apt_y.SetSize(npk+1);
apt_x[1] = dsx[1]; // Set 1st data point as 1st anchor point
apt_y[1] = dsy[1];
apt_x[npk+1] = dsx[nn]; // Set last data point as last anchor point
apt_y[npk+1] = dsy[nn];
for (ii=1; ii<=npk; ii++)
{
int istart = dspos[ii]; // Get row index of ii-th peak
int iend = dspos[ii+1]; // Get row index of the next peak
range rtemp = [??]!dsy[$(istart):$(iend)]; // Declare the range and point to the loose dataset
limit rtemp; // Get stats of the subrange
int ind = limit.imin; // Get min Y row index
apt_y[ii+1]=limit.ymin; // Get min Y between two peaks as anchor point
apt_x[ii+1]=dsx[ind];
};

My data:

0.0355
0.03368
0.03186
0.03004
0.02823
0.02642
0.02462
0.02284
0.02106
0.01929
0.01754
0.0158
0.01408
0.01238
0.01069
0.00903
0.00738
0.00576
0.00415
0.00258
0.00102
-5.01439E-4
-0.002
-0.00347
-0.00492
-0.00633
-0.00771
-0.00906
-0.01038
-0.01167
-0.01293
-0.01415
-0.01533
-0.01649
-0.0176
-0.01869
-0.01973
-0.02074
-0.02172
-0.02266
-0.02356
-0.02442
-0.02525
-0.02604
-0.0268
-0.02752
-0.0282
-0.02884
-0.02945
-0.03003
-0.03057
-0.03108
-0.03155
-0.03198
-0.03239
-0.03276
-0.0331
-0.03341
-0.03368
-0.03393
-0.03414
-0.03433
-0.03449
-0.03462
-0.03473
-0.03481
-0.03486
-0.03489
-0.0349
-0.03489
-0.03485
-0.03479
-0.03472
-0.03462
-0.03451
-0.03438
-0.03423
-0.03407
-0.0339
-0.03371
-0.03351
-0.0333
-0.03307
-0.03284
-0.0326
-0.03235
-0.03209
-0.03183
-0.03156
-0.03129
-0.03101
-0.03073
-0.03045
-0.03016
-0.02987
-0.02959
-0.0293
-0.02901
-0.02872
-0.02844
-0.02816
-0.02788
-0.0276
-0.02732
-0.02705
-0.02679
-0.02652
-0.02627
-0.02601
-0.02576
-0.02552
-0.02528
-0.02505
-0.02482
-0.0246
-0.02438
-0.02417
-0.02396
-0.02376
-0.02357
-0.02338
-0.02319
-0.02301
-0.02284
-0.02267
-0.0225
-0.02234
-0.02218
-0.02203
-0.02187
-0.02172
-0.02158
-0.02143
-0.02129
-0.02115
-0.02101
-0.02087
-0.02073
-0.02059
-0.02045
-0.02031
-0.02017
-0.02003
-0.01988
-0.01973
-0.01958
-0.01942
-0.01927
-0.0191
-0.01893
-0.01876
-0.01858
-0.0184
-0.0182
-0.018
-0.0178
-0.01759
-0.01736
-0.01714
-0.0169
-0.01665
-0.01639
-0.01613
-0.01585
-0.01557
-0.01527
-0.01497
-0.01465
-0.01432
-0.01399
-0.01364
-0.01327
-0.0129
-0.01252
-0.01212
-0.01172
-0.0113
-0.01087
-0.01042
-0.00997
-0.00951
-0.00903
-0.00854
-0.00804
-0.00753
-0.00701
-0.00648
-0.00593
-0.00538
-0.00481
-0.00424
-0.00366
-0.00306
-0.00246
-0.00185
-0.00123
-6.02299E-4
3.29208E-5
6.75392E-4
0.00132
0.00198
0.00264
0.00331
0.00398
0.00466
0.00534
0.00602
0.00671
0.0074
0.00809
0.00878
0.00947
0.01016
0.01086
0.01155
0.01223
0.01292
0.0136
0.01428
0.01495
0.01562
0.01629
0.01694
0.01759
0.01823
0.01886
0.01948
0.0201
0.0207
0.02129
0.02186
0.02243
0.02298
0.02352
0.02404
0.02454
0.02503
0.02551
0.02596
0.0264
0.02682
0.02722
0.0276
0.02796
0.02829
0.02861
0.0289
0.02918
0.02942
0.02965
0.02985
0.03002
0.03018
0.0303
0.0304
0.03048
0.03053
0.03055
0.03054
0.03051
0.03045
0.03037
0.03025
0.03011
0.02995
0.02975
0.02953
0.02928
0.029
0.02869
0.02836
0.028
0.02761
0.0272
0.02676
0.0263
0.02581
0.02529
0.02475
0.02418
0.02359
0.02298
0.02234
0.02168
0.021
0.0203
0.01958
0.01884
0.01808
0.0173
0.0165
0.01568
0.01485
0.01401
0.01315
0.01227
0.01139
0.01049
0.00958
0.00866
0.00773
0.00679
0.00585
0.0049
0.00394
0.00298
0.00202
0.00105
8.63622E-5
-8.80495E-4
-0.00185
-0.00281
-0.00377
-0.00473
-0.00568
-0.00663
-0.00757
-0.00851
-0.00943
-0.01035
-0.01126
-0.01215
-0.01304
-0.01391
-0.01477
-0.01561
-0.01644
-0.01726
-0.01806
-0.01884
-0.0196
-0.02035
-0.02108
-0.02178
-0.02247
-0.02314
-0.02379
-0.02442
-0.02503
-0.02561
-0.02618
-0.02672
-0.02724
-0.02774
-0.02822
-0.02867
-0.0291
-0.02951
-0.0299
-0.03027
-0.03061
-0.03093
-0.03123
-0.03151
-0.03177
-0.03201
-0.03222
-0.03242
-0.03259
-0.03275
-0.03289
-0.03301
-0.03311
-0.03319
-0.03326
-0.03331
-0.03334
-0.03336
-0.03336
-0.03335
-0.03333
-0.03329
-0.03324
-0.03318
-0.0331
-0.03302
-0.03293
-0.03282
-0.03271
-0.03259
-0.03246
-0.03233
-0.03219
-0.03204
-0.03189
-0.03174
-0.03158
-0.03141
-0.03125
-0.03108
-0.03091
-0.03073
-0.03056
-0.03038
-0.03021
-0.03003
-0.02986
-0.02968
-0.02951
-0.02933
-0.02916
-0.02899
-0.02882
-0.02865
-0.02848
-0.02831
-0.02815
-0.02799
-0.02782
-0.02766
-0.0275
-0.02735
-0.02719
-0.02703
-0.02688
-0.02672
-0.02656
-0.02641
-0.02625
-0.02609
-0.02593
-0.02577
-0.02561
-0.02544
-0.02527
-0.0251
-0.02492
-0.02474
-0.02455
-0.02436
-0.02417
-0.02396
-0.02375
-0.02353
-0.02331
-0.02307
-0.02283
-0.02258
-0.02232
-0.02204
-0.02176
-0.02147
-0.02116
-0.02085
-0.02052
-0.02018
-0.01982
-0.01946
-0.01908
-0.01868
-0.01827
-0.01785
-0.01742
-0.01696
-0.0165
-0.01602
-0.01553
-0.01502
-0.0145
-0.01396
-0.01341
-0.01284
-0.01226
-0.01167
-0.01107
-0.01045
-0.00982
-0.00917
-0.00852
-0.00785
-0.00717
-0.00648
-0.00578
-0.00508
-0.00436
-0.00364
-0.00291
-0.00217
-0.00142
-6.73847E-4
7.95669E-5
8.36458E-4
0.0016
0.00236
0.00312
0.00388
0.00464
0.0054
0.00616
0.00691
0.00766
0.0084
0.00914
0.00987
0.01059
0.0113
0.012
0.01269
0.01336
0.01403
0.01467
0.01531
0.01593
0.01653
0.01711
0.01767
0.01822
0.01874
0.01925
0.01973
0.02019
0.02062
0.02104
0.02143
0.02179
0.02213
0.02244
0.02273
0.02298
0.02322
0.02342
0.0236
0.02375
0.02387
0.02396
0.02402
0.02405
0.02406
0.02404
0.02399
0.0239
0.0238
0.02366
0.02349
0.0233
0.02308
0.02283
0.02256
0.02226
0.02193
0.02158
0.0212
0.0208
0.02038
0.01993
0.01946
0.01897
0.01845
0.01792
0.01737
0.0168
0.01621
0.0156
0.01498
0.01434
0.01368
0.01302
0.01234
0.01164
0.01094
0.01023
0.0095
0.00877
0.00803
0.00729
0.00654
0.00578
0.00502
0.00426
0.00349
0.00273
0.00196
0.00119
4.28648E-4
-3.34966E-4
-0.0011
-0.00185
-0.00261
-0.00336
-0.0041
-0.00484
-0.00557
-0.00629
-0.007
-0.00771
-0.00841
-0.00909
-0.00977
-0.01044
-0.0111
-0.01174
-0.01237
-0.013
-0.0136
-0.0142
-0.01478
-0.01535
-0.01591
-0.01646
-0.01699
-0.0175
-0.018
-0.01849
-0.01897
-0.01943
-0.01988
-0.02031
-0.02073
-0.02113
-0.02152
-0.0219
-0.02226
-0.02261
-0.02295
-0.02327
-0.02358
-0.02387
-0.02416
-0.02442
-0.02468
-0.02492
-0.02516
-0.02537
-0.02558
-0.02577
-0.02596
-0.02613
-0.02628
-0.02643
-0.02657
-0.02669
-0.0268
-0.0269
-0.02699
-0.02707
-0.02714
-0.0272
-0.02724
-0.02728
-0.0273
-0.02732
-0.02732
-0.02731
-0.02729
-0.02726
-0.02722
-0.02717
-0.0271
-0.02703
-0.02694
-0.02684
-0.02673
-0.02661
-0.02647
-0.02633
-0.02617
-0.026
-0.02581
-0.02561
-0.0254
-0.02518
-0.02494
-0.02469
-0.02442
-0.02414
-0.02385
-0.02354
-0.02322
-0.02288
-0.02252
-0.02215
-0.02177
-0.02137
-0.02095
-0.02052
-0.02007
-0.0196
-0.01912
-0.01862
-0.01811
-0.01757
-0.01703
-0.01646
-0.01588
-0.01528
-0.01467
-0.01403
-0.01339
-0.01272
-0.01204
-0.01135
-0.01064
-0.00991
-0.00917
-0.00842
-0.00765
-0.00686
-0.00607
-0.00526
-0.00444
-0.0036
-0.00276
-0.0019
-0.00103
-1.56921E-4
7.28097E-4
0.00162
0.00252
0.00343
0.00434
0.00526
0.00618
0.00711
0.00804
0.00897
0.0099
0.01084
0.01177
0.0127
0.01362
0.01454
0.01546
0.01637
0.01728
0.01817
0.01906
0.01994
0.02081
0.02166
0.0225
0.02333
0.02414
0.02494
0.02572
0.02648
0.02722
0.02795
0.02865
0.02933
0.02999
0.03062
0.03123
0.03182
0.03238
0.03291
0.03342
0.03389
0.03434
0.03476
0.03515
0.03551
0.03584
0.03614
0.03641
0.03664
0.03684
0.03701
0.03715
0.03725
0.03732
0.03735
0.03736
0.03733
0.03726
0.03716
0.03703
0.03687
0.03667
0.03644
0.03618
0.03589
0.03556
0.0352
0.03482
0.0344
0.03395
0.03347
0.03297
0.03244
0.03188
0.03129
0.03068
0.03004
0.02938
0.02869
0.02798
0.02725
0.02651
0.02574
0.02495
0.02414
0.02332
0.02248
0.02163
0.02076
0.01988
0.01899
0.01809
0.01718
0.01626
0.01533
0.01439
0.01345
0.01251
0.01156
0.01061
0.00966
0.00871
0.00776
0.00681
0.00586
0.00492
0.00398
0.00304
0.00212
0.00119
2.80807E-4
-6.2426E-4
-0.00152
-0.00241
-0.00328
-0.00414
-0.005
-0.00583
-0.00666
-0.00747
-0.00827
-0.00905
-0.00982
-0.01057
-0.0113
-0.01202
-0.01272
-0.01341
-0.01407
-0.01472
-0.01535
-0.01596
-0.01656
-0.01713
-0.01768
-0.01822
-0.01874
-0.01924
-0.01971
-0.02017
-0.02061
-0.02104
-0.02144
-0.02182
-0.02218
-0.02253
-0.02285
-0.02316
-0.02345
-0.02372
-0.02397
-0.0242
-0.02442
-0.02462
-0.0248
-0.02496
-0.0251
-0.02523
-0.02534
-0.02544
-0.02551
-0.02557
-0.02562
-0.02565
-0.02566
-0.02566
-0.02564
-0.02561
-0.02556
-0.02549
-0.02542
-0.02532
-0.02521
-0.02509
-0.02495
-0.0248
-0.02464
-0.02446
-0.02427
-0.02406
-0.02384
-0.0236
-0.02336
-0.02309
-0.02282
-0.02253
-0.02223
-0.02191
-0.02158
-0.02124
-0.02088
-0.02051
-0.02013
-0.01973
-0.01932
-0.0189
-0.01846
-0.01801
-0.01755
-0.01707
-0.01658
-0.01608
-0.01556
-0.01503
-0.01449
-0.01394
-0.01337
-0.01279
-0.01219
-0.01159
-0.01097
-0.01034
-0.0097
-0.00905
-0.00838
-0.0077
-0.00702
-0.00632
-0.00561
-0.00489
-0.00416
-0.00342
-0.00268
-0.00192
-0.00116
-3.83017E-4
3.9664E-4
0.00118
0.00198
0.00277
0.00358
0.00439
0.0052
0.00602
0.00684
0.00766
0.00848
0.0093
0.01013
0.01095
0.01177
0.01259
0.01341
0.01422
0.01503
0.01583
0.01663
0.01742
0.0182
0.01897
0.01974
0.02049
0.02123
0.02196
0.02268
0.02338
0.02407
0.02475
0.02541
0.02605
0.02667
0.02727
0.02786
0.02842
0.02896
0.02949
0.02999
0.03046
0.03092
0.03134
0.03175
0.03213
0.03248
0.03281
0.03311
0.03338
0.03362
0.03384
0.03402
0.03418
0.03431
0.03441
0.03448
0.03452
0.03453
0.03451
0.03446
0.03438
0.03427
0.03413
0.03397
0.03377
0.03354
0.03328
0.033
0.03268
0.03234
0.03197
0.03157
0.03115
0.0307
0.03022
0.02972
0.02919
0.02864
0.02807
0.02748
0.02686
0.02622
0.02556
0.02489
0.02419
0.02348
0.02275
0.022
0.02124
0.02047
0.01968
0.01888
0.01807
0.01725
0.01642
0.01558
0.01474
0.01389
0.01303
0.01217
0.01131
0.01044
0.00958
0.00871
0.00785
0.00699
0.00613
0.00527
0.00442
0.00358
0.00274
0.00191
0.00109
2.75561E-4
-5.26977E-4
-0.00132
-0.0021
-0.00287
-0.00362
-0.00436
-0.00509
-0.0058
-0.00649
-0.00717
-0.00784
-0.00848
-0.00911
-0.00972
-0.01031
-0.01088
-0.01143
-0.01196
-0.01247
-0.01296
-0.01343
-0.01388
-0.01431
-0.01471
-0.0151
-0.01546
-0.01581
-0.01613
-0.01643
-0.0167
-0.01696
-0.01719
-0.01741
-0.0176
-0.01777
-0.01792
-0.01805
-0.01816
-0.01824
-0.01831
-0.01836
-0.01839
-0.01839
-0.01838
-0.01835
-0.01831
-0.01824
-0.01815
-0.01805
-0.01793
-0.0178
-0.01764
-0.01747
-0.01729
-0.01709
-0.01687
-0.01664
-0.0164
-0.01614
-0.01587
-0.01558
-0.01529
-0.01498
-0.01466
-0.01432
-0.01398
-0.01362
-0.01325
-0.01288
-0.01249
-0.0121
-0.01169
-0.01128
-0.01085
-0.01042
-0.00998
-0.00954
-0.00909
-0.00863
-0.00816
-0.00768
-0.00721
-0.00672
-0.00623
-0.00573
-0.00523
-0.00473
-0.00421
-0.0037
-0.00318
-0.00266
-0.00213
-0.0016
-0.00107
-5.34316E-4
3.89777E-6
5.44534E-4
0.00109
0.00163
0.00218
0.00273
0.00328
0.00383
0.00438
0.00493
0.00548
0.00603
0.00659
0.00714
0.00769
0.00824
0.00879
0.00934
0.00989
0.01043
0.01098
0.01152
0.01206
0.01259
0.01313
0.01366
0.01418
0.0147
0.01522
0.01574
0.01624
0.01675
0.01725
0.01774
0.01823
0.01871
0.01918
0.01965
0.02011
0.02057
0.02101
0.02145
0.02188
0.0223
0.02272
0.02312
0.02351
0.0239
0.02427
0.02464
0.02499
0.02534
0.02567
0.02599
0.0263
0.0266
0.02689
0.02716
0.02743
0.02768
0.02791
0.02814
0.02835
0.02855
0.02873
0.0289
0.02906
0.02921
0.02934
0.02945
0.02955
0.02964
0.02972
0.02978
0.02982
0.02986
0.02987
0.02988
0.02987
0.02984
0.0298
0.02975
0.02968
0.0296
0.02951
0.0294
0.02928
0.02914
0.029
0.02884
0.02866
0.02848
0.02828
0.02807
0.02784
0.02761
0.02736
0.0271
0.02683
0.02655
0.02626
0.02596
0.02565
0.02533
0.025
0.02466
0.02432
0.02396
0.0236
0.02323
0.02285
0.02246
0.02207
0.02167
0.02126
0.02085
0.02043
0.02001
0.01959
0.01915
0.01872
0.01828
0.01784
0.01739
0.01695
0.0165
0.01604
0.01559
0.01514
0.01468
0.01422
0.01377
0.01331
0.01285
0.0124
0.01194
0.01149
0.01104
0.01059
0.01014
0.0097
0.00926
0.00882
0.00838
0.00795
0.00753
0.0071
0.00669
0.00627
0.00587
0.00546
0.00507
0.00468
0.00429
0.00392
0.00355
0.00318
0.00283
0.00248
0.00214
0.00181
0.00148
0.00117
8.6371E-4
5.66527E-4
2.78598E-4
1.40258E-7
-2.68635E-4
-5.2752E-4
-7.76313E-4
-0.00101
-0.00124
-0.00146
-0.00167
-0.00186
-0.00205
-0.00222
-0.00238
-0.00253
-0.00267
-0.00279
-0.00291
-0.00301
-0.0031
-0.00318
-0.00324
-0.00329
-0.00333
-0.00336
-0.00337
-0.00337
-0.00336
-0.00333
-0.00329
-0.00324
-0.00317
-0.0031
-0.003
-0.0029
-0.00278
-0.00265
-0.00251
-0.00235
-0.00218
-0.002
-0.00181
-0.0016
-0.00138
-0.00115
-9.08381E-4
-6.53566E-4
-3.87115E-4
-1.09222E-4
1.79901E-4
4.80035E-4
7.90945E-4
0.00111
0.00144
0.00179
0.00214
0.0025
0.00287
0.00325
0.00363
0.00403
0.00443
0.00484
0.00526
0.00569
0.00612
0.00655
0.007
0.00744
0.0079
0.00835
0.00881
0.00928
0.00974
0.01021
0.01068
0.01116
0.01163
0.01211
0.01259
0.01306
0.01354
0.01401
0.01449
0.01496
0.01543
0.0159
0.01636
0.01682
0.01728
0.01773
0.01818
0.01863
0.01906
0.0195
0.01992
0.02035
0.02076
0.02117
0.02157
0.02196
0.02234
0.02272
0.02309
0.02345
0.0238
0.02414
0.02447
0.0248
0.02511
0.02541
0.02571
0.02599
0.02626
0.02652
0.02678
0.02702
0.02725
0.02747
0.02768
0.02788
0.02806
0.02824
0.02841
0.02856
0.0287
0.02884
0.02896
0.02907
0.02917
0.02926
0.02934
0.02941
0.02947


Stijn

ChaoC

USA
174 Posts

Posted - 12/05/2023 :  11:20:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I would recommend taking a look at the peak finding part of the script, pkfind: https://www.originlab.com/doc/X-Function/ref/pkFind

This will help you understand the options for peak finding and use suitable options for your dataset.
If you remove the value:=200, it should help you get started.

Best,
Chao
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000