# 2008-01-30 Fiske scan analysis

I've written an analysis routine to see how the results of a particular Fiske "scan" hold up. Such a scan means: set a particular FFO current and an FFO countrol line current, then stepwise increment that last one while measuring the FFO voltage. A scan results, meaning a bunch of voltages. In such a scan, certain areas would never contain values -- search this blog for Fiske steps for more information.

I wanted to visually check the analysis of the routine. A scan can have a lot of outcomes. Say we want to find value 0.863. We'd then do a scan where we're aiming for a resulting voltage between 0.858 and 0.868. Some possible situations that could come out:

``` 1)    ---*-*-*-*-*-*-*-*-*--   Very nice step found
2)    -*-*---------*-*-*-*-*   Found two steps, at the right is biggest
3)    -*-*-*-*-*--------*-*-   Found two steps, at the left is biggest
4)    **-*---------------*-*   Found two steps but they're both too small
5)    ----------------------   No (or not enough) points found at all
6)    --*-*-*-*-*-----------   One step found, but it's not nicely balanced```

I've retrieved some test values and the scan results (without the FFO plot behind it) look as follows. The X axis displays the FFO voltage in mV. Note that the Y axis is a simple counter in this case, and is meaningless. It's also in reverse: the lower the value on the Y axis, the more recent the results on the X axis. The black line is the value that we're aiming at.

The first couple of lines (starting at the top) show the results of the setup phase of the Fiske macro. These can be ignored; they're not used for analysis.

Let's zoom in on the first lines (i.e. where the Y axis shows '42').

We're looking for a line that's nicely centered around value 0.863 mV.

We can say the following things about the first bunch of lines below the setup lines:

• They all contain enough points, enough so we can analyze them
• They're all right in the middle between two "rows of points"
Since we need a row where we have a bunch of points that's centered around our value of 0.863, so from 42 to 28, these rows are all useless.

Now what does the analysis routine say?

``` Line 46 gives result: Last scan contained only 7 points
Line 45 gives result: Last scan contained only 4 points
Line 44 gives result: Last scan contained only 4 points
Line 43 gives result: Last scan contained only 4 points
Line 42 gives result: Last scan contained only 4 points
Line 41 gives result: Last result had a skewed result set
Line 40 gives result: Last result had a skewed result set
Line 39 gives result: Last result had a skewed result set
Line 38 gives result: Last result had a skewed result set
Line 37 gives result: Last result had a skewed result set
Line 36 gives result: Last result had a skewed result set
Line 35 gives result: Last result had a skewed result set
Line 34 gives result: Good result found
Line 33 gives result: Good result found
Line 32 gives result: Last scan contained only 6 points
Line 31 gives result: Last scan contained only 4 points
Line 30 gives result: Last scan contained only 6 points
Line 29 gives result: Last result had a skewed result set
Line 28 gives result: Last result had a skewed result set```

Obviously the procedure thinks that lines 34 and 33 have a pretty good result, which is not the case.

After writing an analysis routine, the following output is shown:

``` Line 37 gives result: Last result had a skewed result set
Line 36 gives result: Last result had a skewed result set
Line 35 gives result: Last result had a skewed result set
Line 34 gives result: Last result had a skewed result set
Line 33 gives result: Last result had a skewed result set
Line 32 gives result: Last scan contained only 6 points
Line 31 gives result: Last scan contained only 4 points
Line 30 gives result: Last scan contained only 6 points
Line 29 gives result: Last result had a skewed result set
Line 28 gives result: Last result had a skewed result set
Line 27 gives result: Last result had a skewed result set
Line 26 gives result: Last result had a skewed result set
Line 25 gives result: Last result had a skewed result set
Line 24 gives result: Last result had a skewed result set
Line 23 gives result: Good result found
Line 22 gives result: Good result found
Line 21 gives result: Last result had a skewed result set
Line 20 gives result: Last result had a skewed result set
Line 19 gives result: Last result had a skewed result set
Line 18 gives result: Last result had a skewed result set```

Still not OK. What's wrong here is that first the subroutine for a skewed result set is run. Then after that's successful, the detection needs to be added to see whether a set covers the target X value.