typestar

Wave assignment in Igor Pro

One line does what a loop would: the assignment runs over every point.

Function BuildSignals()
    Make/O/N=500/D raw, baseline, corrected
    SetScale/P x, 0, 0.002, "s", raw, baseline, corrected

    raw = sin(2 * pi * 5 * x) + gnoise(0.1)
    baseline = 0.3 * x
    corrected = raw - baseline
    corrected = abs(corrected) < 0.05 ? 0 : corrected
End

How it works

  1. p is the point index, x the scaled position, q the second dimension.
  2. The right side may name other waves; they line up point by point.
  3. A conditional assignment uses ?:, so filtering needs no loop either.

Keywords and builtins used here

The run, in numbers

Lines
9
Characters to type
258
Tokens
70
Three-star pace
80 tpm

At the three-star pace of 80 tokens a minute, this run takes about 52 seconds.

Type this snippet

Step 1 of 4 in Wave assignment, step 1 of 16 in Waves & analysis.

Next →