HolyLab / Imagine

A graphical interface for recording with OCPI microscopes.
1 stars 1 forks source link

Poorly aligned stacks with OCPI2 #27

Closed Cody-G closed 5 years ago

Cody-G commented 7 years ago

I'm still trying to make sure I understand the reasons that back-to-back stacks do not align well on OCPI2. These factors probably don't help:

1). Noisy piezo readout (MON) signal. It's unclear whether noise in this signal is a problem for normal microscope operation, because according to the company our 30V300 uses a different signal for its closed loop controller. It's certainly a problem for our future plans to do real-time triggering based on the MON signal, but that is a different issue.

2). Noisy analog output from the DAQ. We get 2mV RMS noise on the control signal that we're sending to the piezo. This seems too high, but it's not clear whether it's responsible for our misalignment. The company doesn't seem to be helpful unless you pay them. I'll post back here with updates.

3). The camera and piezo are started sequentially every stack. Thus we get some variability in relative start times due to the Windows scheduler. I have a PR on the way that takes care of this by using the camera exposure signal to trigger the piezo motion sequence for each stack.

timholy commented 7 years ago

I think your 3rd choice seems very likely. What's your typical frame time---a few ms, right? So if there's ~1ms of jitter it's a significant factor?

Cody-G commented 7 years ago

That is true, but this shows up even on relatively slow stacks would work fine on OCPI1, even though OCPI1 starts them sequentially. I did more tests over the weekend, and the new triggering method has not fixed the problem. I still think it's a good change, but we have a bigger problem somewhere.

My main new observation over the weekend is that the stack-to-stack misalignment is actually periodic, meaning that the alignment shifts smoothly between good and bad at a reliable frequency during recording. Some important points:

This is pretty puzzling. The dependence of the frequency on the scan rate suggests that it's not coming from some other vibration or noise in the room, but from the motion of the piezo itself. My current best guess is that the motion of the piezo is actually inducing some swaying in the entire microscope relative to the sample (Recall that all of the optics are on a breadboard suspended by a single large support beam). I plan to add another support beam in the hopes of stabilizing the breadboard. But I'm skeptical that this will fix the problem, so if anyone has other ideas I'm happy to try them. I'm especially skeptical because it seems unlikely that this kind of sway would exist only along the axial dimension...

To follow up on my earlier points, I think I can eliminate point number one (noisy MON) because this problem occurs in open loop mode as well. I think I can eliminate point number two (noisy MOD) because I can't imagine how it could cause slow oscillations like the ones I'm seeing, though there may be some obscure electrical explanation that I'm missing....

timholy commented 7 years ago

Random musings:

Cody-G commented 7 years ago

Does the accelerometer provide any insight?

It does seem like this should provide insight. Unfortunately I discovered over the weekend that the accelerometer I bought is not sensitive enough at the low frequencies and acceleration values that are relevant here, and also that it's poorly designed in general. I began the return process and ordered a replacement today that should be much better...the new one should be good enough for seismology ;)

Does this periodic misalignment only happen near the beginning of an acquisition? (What if it's some kind of weird thermal effect? Running it a while might help temperatures equilibrate, and thus reduce the scale of the problem.)

I'm not sure I understand how that would work but sounds worth a look. I didn't look at longer recordings since changing the piezo triggering. I should be able to check it tomorrow.

Do you see roughly the same thing no matter whether you're looking at the command voltage vs the MON signal?

I'm not sure whether this answers your question, but here is what I've done so far: I recorded the MON and MOD signals simultaneously with Imagine while doing a multi-stack acquisition. I used the MOD signal to segment the trace into multiple stacks and align the traces. I then overlaid the MON and MOD signals from multiple stacks. Observations:

Is there any chance that this is somehow coupling to the sample in the dish? I.e., that the objective motion is causing changes in the sample morphology?

In that case I would have expected to see the same thing on OCPI1, but it's possible that the effect is just stronger on OCPI2. Maybe the OCPI2 light sheet "cigarette" is less hydrodynamic? I tried switching to a higher-percent agarose gel thinking that the beads could be moving somehow but it doesn't seem to make a difference. Still it's worth trying on OCPI1 with the same exact sample, I will do that.

Cody-G commented 7 years ago

I've finally figured this out.

timholy commented 7 years ago

Wow, it's always hardest when there are two factors to track down. Really nice work! Are you pretty satisfied with the alignment now?

Cody-G commented 7 years ago

Yes I am. I'll calculate the PSFs formally (and publish a little Julia package to do so) but I think they are close to what we want in X and Y. I'm wondering if the light sheet is a bit thicker than we expected. In order to check that I guess I should compare the expected 1/e2 beam intensity from our Matlab software with the measured intensity in Z? I'm experimenting with using a wider beam for smaller samples (the wider-beamed collimator is on order).

~Cody

On Mon, Apr 3, 2017 at 10:49 AM, Tim Holy notifications@github.com wrote:

Wow, it's always hardest when there are two factors to track down. Really nice work! Are you pretty satisfied with the alignment now?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HolyLab/Imagine/issues/27#issuecomment-291184792, or mute the thread https://github.com/notifications/unsubscribe-auth/AE78hB8Xu9bPhLamOJTRSN9SRDn-p-G2ks5rsRTvgaJpZM4LwQNy .

timholy commented 7 years ago

That sounds like the right approach. One concern with a wider collimator might be reflections from the "carrier" for the optics; be alert for weird side lobes and check the intensity of background as well as the width of a bead.