Ulm-IQO / qudi

(Legacy project) A modular laboratory experiment management suite, predecessor to qudi-core.
GNU General Public License v3.0
166 stars 141 forks source link

YZ depth scan - X voltage jumps to Vmin #513

Open michaelb1886 opened 5 years ago

michaelb1886 commented 5 years ago

What is affected by this bug?

v0.10 depth scanning confocal_logic

When does this occur?

Scanning in XZ yields the expected behaviour (the Y voltage is kept fixed and XZ is rastered) However, changing to YZ in the confocal settings dialog and perform a depth scan the X voltage is not held constant. It jumps to Vmin in the return path section! This is not great for the nano-positioners. The below plots are the measured voltages going to my nanopositioner. I also noticed a dark strip at the left edge of the YZ scan image - this is because the nanopositioner is jumpy wildly to the edge of the scan range and less photons are measured.

image

Where on the platform does it happen?

Defining the return line in confocal_logic.py in the _scan_line method at line 800. The definition of return line for the x axis image[self._scan_counter, 0, 1] * np.ones(self._return_YL.shape) was not at the self._current_x position. For some reason it was a the minimum X limit.

How do we replicate the issue?

Scan depth in YZ.

Expected behavior (i.e. solution)

Changed from line 800 in confocal_logic.py to

                if n_ch <= 3:
                    return_line = np.vstack([
                            self._current_x * np.ones(self._return_YL.shape),
                            self._return_YL,
                            image[self._scan_counter, 0, 2] * np.ones(self._return_YL.shape)
                        ][0:n_ch])
                else:
                    return_line = np.vstack([
                            self._current_x * np.ones(self._return_YL.shape),
                            self._return_YL,
                            image[self._scan_counter, 0, 2] * np.ones(self._return_YL.shape),
                            np.ones(self._return_YL.shape) * self._current_a
                        ])

With this change the scanning behaviour is now as expected for a YZ scan. image

Other Comments

I understand that the confocal scanning is going through a rewrite phase at the moment, but this is a pretty nasty bug as it isn't physically great for the nanopositioners.

diamond2nv commented 5 years ago

maybe this fix is more original-way:

            # make a line to go to the starting position of the next scan line
            if self.depth_img_is_xz or not self._zscan:
                if n_ch <= 3:
                    return_line = np.vstack([
                        self._return_XL,
                        image[self._scan_counter, 0, 1] * np.ones(self._return_XL.shape),
                        image[self._scan_counter, 0, 2] * np.ones(self._return_XL.shape)
                    ][0:n_ch])
                else:
                    return_line = np.vstack([
                            self._return_XL,
                            image[self._scan_counter, 0, 1] * np.ones(self._return_XL.shape),
                            image[self._scan_counter, 0, 2] * np.ones(self._return_XL.shape),
                            np.ones(self._return_XL.shape) * self._current_a
                        ])
            else:
                if n_ch <= 3:
                    return_line = np.vstack([
                            image[self._scan_counter, 0, 0] * np.ones(self._return_YL.shape),
                            self._return_YL,
                            image[self._scan_counter, 0, 2] * np.ones(self._return_YL.shape)
                        ][0:n_ch])
                else:
                    return_line = np.vstack([
                            image[self._scan_counter, 0, 0] * np.ones(self._return_YL.shape),
                            self._return_YL,
                            image[self._scan_counter, 0, 2] * np.ones(self._return_YL.shape),
                            np.ones(self._return_YL.shape) * self._current_a
                        ])