Follow up question

32 views
Skip to first unread message

Ken Jiiii

unread,
Mar 4, 2016, 5:39:49 AM3/4/16
to pgFocus

Hi everybody,

I have a follow up question on the usage of pgFocus. It seems to work stable but I was wondering whether I see the proper value in the real time tab. I have an mpv setting of 20 and when I move my stage let's say 10microns up and back down I do not see those values in the graphe (cf. image 01).
As I said it doesn't seem to make a difference whether pgFocus works or not but do you see the right values or am I misinterpreting something?

Thanks for your help!

Karl Bellve

unread,
Mar 4, 2016, 9:21:13 AM3/4/16
to Ken Jiiii, pgFocus

Hi Ken,

Offset just shows the center of the centroid on the linear array. Unlike the other graphs, I don't convert it nm. I leave it to pixel # on the Linear Light Array. 

Your figure 1 shows very tight focus control, with a focus offset range from ~45.85 to ~46.00 pixel. This means the centroid was located 85% of the way to pixel 46, from pixel 45 on the Linear Light Array. The fact that we can take a low resolution sensor and make it is high resolution is fantastic. :D 

The Output nm is showing the amount of voltage used to return back to focus, but it is converted to "nm" based on the calibration. 

pgFocus will only move 50% of the distance at any given time.

So, if you move out of focus 10nm, pgFocus will try and apply a 5 nm correction and then check again. 

If it is still out of focus, pgFocus will make another 50% step at whatever that may be, The reason I do this is this limits overshoots. In fact, anything over 85% step will cause ringing in focus control. 

In Figure 1, I am seeing a 12nm correction which should be the minimum correction step by the DAC due to it being 14 bit working over a ±5V range and a 20µm/volt piezo. 

However, I am seeing a 6nm correction step in Figure 2, which means pgFocus still thinks it is a 10µm/volt piezo, and I screwed up somewhere in the firmware, device adapter, or plugin. :D

It would be interesting to see what the pgFocus Device Adapter is showing (via µManager's property browser). Is it 10 or 20? If it is 10, and you change it to 20, does it help?

I see that Device Adapter code is aware of the Micron/Volt.

From pgFocusStabilization::OnOutputnM

float result = DAC_VOLTAGE(hub->GetDAC())  * hub->GetMicronPerVolt() * NMPERMICON;

The code elsewhere looks good.

Cheers 

Karl Bellvé
Biomedical Imaging Group
Molecular Medicine
University of Massachusetts Medical School


--
You received this message because you are subscribed to the Google Groups "pgFocus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgfocus+u...@googlegroups.com.
To post to this group, send email to pgf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pgfocus/27da2e25-79ec-411f-8ba8-27dc5aeb3d93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kyle Douglass

unread,
Mar 8, 2016, 12:58:56 AM3/8/16
to pgFocus
Thanks for this question and answer! It makes things clearer for me.

Karl, about the "step" parameter you mentioned in your last post: is this the 50% of the offset distance that you mentioned in this post? Or is "step" a different parameter?

Cheers,
Kyle

Karl Bellve

unread,
Mar 8, 2016, 2:20:25 PM3/8/16
to Kyle Douglass, pgFocus
On Tue, Mar 8, 2016 at 12:58 AM Kyle Douglass <kyle.m....@gmail.com> wrote:
Thanks for this question and answer! It makes things clearer for me.

Karl, about the "step" parameter you mentioned in your last post: is this the 50% of the offset distance that you mentioned in this post? Or is "step" a different parameter?


Same parameter.

Ken Jiiii

unread,
Mar 9, 2016, 4:49:00 AM3/9/16
to pgFocus, kyle.m....@gmail.com


Hi Karl,

Thanks for your answert. So I tried to do some checks which might help you understand what's happening here... ;-)

1) set MPV 20 in Arduino,
2) Start uManager, MPV in uManager plugin states 10MPV (01.png locked with this settings)
3) Set MPV to 20 in uManager plugin (02.png)

And something else, when I set MPV to 20 in Arduino, start uManager check MPV in the plugin (10), close uManager and check it again, Arduino says still 20.
But when I swtich in the plugin from 10 to 20 and set it back to 10, also the Arduino says 10 afterwards.

I assume I have to set a startup value for the MPV setting for my pgFocus, right?



Anyhow, the pgFocus standalone software does perform the right calibration with the MPV setting 20 when I set it in Arduino. At least I hope so. ;-)




Karl Bellve

unread,
Mar 10, 2016, 10:53:26 AM3/10/16
to Ken Jiiii, pgFocus, kyle.m....@gmail.com


Hi Ken,

I couldn't really read the axis on  images since they are low resolution.

The Arduino can set and read the MPV.

The µManager plugin and Device Adapter is much more complicated.

I do have a function called SetMicronPerVolt(). It can either set it inside the pgFocusHub, and/or in the hardware as well (pgFocus Firmware). This is working and it is why you can set the MPV from within µManager.

The issue is GetMicronPerVolt()function is not quering the firmware, which is why it Micron Per Volt defaults to 10.

Which might be ok, because the pgFocus monitoring thread should see MPV: as pgFocus starts up, and it gets set there initially, but I am guessing it isn't or it it is being missed.

So, I know where the issue is, I just need time to fix it.

In the meantime, you should be fine setting micron/volt inside µManager's plugin and if it says 20 there, then all the calculations should be correct.


Cheers 


Karl Bellvé
Biomedical Imaging Group
Molecular Medicine
University of Massachusetts Medical School

--
You received this message because you are subscribed to the Google Groups "pgFocus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgfocus+u...@googlegroups.com.
To post to this group, send email to pgf...@googlegroups.com.

Ken Jiiii

unread,
Mar 11, 2016, 6:13:24 AM3/11/16
to pgFocus, jiiii...@gmail.com, kyle.m....@gmail.com


Oh I am sorry. Here I go again, I hope they are shown correctly now.

As of the bugfixing, no worries. As long as I know that the focus stabilization works and I have just to set the value I am good to go. And apparently it seems to work.
I was just wondering about the calibration but I assume the pgFocus standalone software does see the mpv setting and perfors the calibration based on that.

Have a nice weekend!!

Ken Jiiii

unread,
Mar 30, 2016, 3:01:42 AM3/30/16
to pgFocus, jiiii...@gmail.com, kyle.m....@gmail.com
Hello Karl,

I have another question regarding the plots. The SD deviation is always shown but somehow I find the behaivour strange. Although the Offset is already back to normal within a second the SD takes about 5 seconds to be back to normal again. How is is calculated and is this what I expect to see? Please cf. Plot 1 of the previous post where you can see that the SD takes >5 s to go back down again.

Thanks and kind regards

Kyle Douglass

unread,
Mar 30, 2016, 4:22:59 AM3/30/16
to pgf...@googlegroups.com

On Wed, Mar 30, 2016 at 9:01 AM, Ken Jiiii <jiiii...@gmail.com> wrote:
Hello Karl,

I have another question regarding the plots. The SD deviation is always shown but somehow I find the behaivour strange. Although the Offset is already back to normal within a second the SD takes about 5 seconds to be back to normal again. How is is calculated and is this what I expect to see? Please cf. Plot 1 of the previous post where you can see that the SD takes >5 s to go back down again.


Hi Ken,
Karl can correct me if I am wrong and provide more details, but on a simple level, there's no obvious way to compute a standard deviation for a time series that doesn't have some amount of "memory."

The standard deviation is computed using a moving window over the offset time series. It takes the last N number of data points where N is some integer and computes their standard deviation. The delay in the SD curve roughly corresponds to how long it takes for the moving window to move beyond any significant spikes in the offset curve.

Cheers,
Kyle

Karl Bellve

unread,
Mar 30, 2016, 10:13:50 AM3/30/16
to Kyle Douglass, pgf...@googlegroups.com

Kyle is correct.

pgFocus uses the last 30 data points to compute the SD.  

focusPointsMax is set to 30 in the pgFocus standalone application, sampled at most every 200ms interval..
qoffsetMax_ is also set to 30 in µManager's pgFocus Device Adapter, sampled at most every ~250ms interval.

It isn't the last 30 points. It depends on sampling time by the pgFocus application, or  µManager's pgFocus Device Adapter since both applications pull the information from the hardware, rather than the hardware pushes it. During testing, I found that the hardware was pushing the focus position (with other information) every ~30 ms was way too much. Now, the applications pulls the information when they need it, and the hardware prints it in response. So, not every focus position. 

I am open to other ways of doing it.

Ken Jiiii

unread,
Mar 31, 2016, 2:33:42 AM3/31/16
to pgFocus, kyle.m....@gmail.com
Hello Kyle, Hello Karl,

Okay now I understand how the SD is calculated in that case and the signal makes sense to me - that was the biggest problem!

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages