Skip to content

Conversation

@adamkglaser
Copy link
Collaborator

@Poofjunior when you have a chance please take a look at this PR. On the new ExA-SPIM system, the Tiger hardware axis that is being triggered for ring buffer moves is the Z axis (on a ZF card) (it is X axis on an XY card for the original system). For some reason, the original reset_ring_buffer command executes but does not actually reset the ring buffer. The solution is to allow an optional axis input arg, i.e. axis=Z for the new system. If no axis is given, the function behaves as previously.

@adamkglaser
Copy link
Collaborator Author

@Poofjunior please take a look at this when you have a chance? I changed the functionality of the ring buffer based on the tigerbox for the new exaspim system. I also added set/get functions for the backlash parameter.

.. code-block:: python
box.get_backlash_compensation('x') # returns: {'X': 0.1}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this comment is out of date and should probs be get_axis_backlash

self._set_cmd_args_and_kwds(Cmds.ARRAY, card_address=card_address, wait=wait)

def reset_ring_buffer(self, wait: bool = True):
def reset_ring_buffer(self, axis: str = None, wait: bool = True):
Copy link
Collaborator

@Poofjunior Poofjunior Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reset_ring_buffer and _clear_ring_buffer, let's reference this page from ASI's docs in our docstring. Otherwise, the commands seem really random. For the syntax, have a look at move_relative or move_absolute method docstrings.

else:
self._clear_ring_buffer(wait=wait)
self._rb_axes = []

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consolidate these two functions into just one since they're only used here, and reset_ring_buffer appears to be a wrapper for _clear_ring_buffer without really adding anything.

@Poofjunior
Copy link
Collaborator

It looks like this code got run through a formatter (black?), making the actual changes very difficult to read. I did run through the whole file, but I'll limit my review to the changes you're referring to.

Ok, after reading the docs, I see why we need the change. It looks like RBMODE command is "card-addressed" (i.e: specific to a particular card), and that has to be specified first.

I added some in-line comments, but here's the summary:

  • You're functionality changes look great! I'm suggesting some cleanup below:
  • let's remove _clear_ring_buffer since it's wrapped by reset_ring_buffer, and they appear to be doing the same thing.
  • Let's add a reference to this page of ASI's docs in our method's docstring
  • Let's add a warning in the docstring that mentions that this command is card-specific and axes on a shared card will also be affected. We can use the .. WARNING:: admonition syntax in the docstring so that the website renders it nicely.

@adamkglaser
Copy link
Collaborator Author

@Poofjunior I cleaned things up. Should be more readable now. Let me know if you have additional feedback. Thanks!

self._rb_axes = []
def reset_ring_buffer(self, axis: str = None, wait: bool = True):
"""Clear the ring buffer contents.
See `RING BUFFER MODULE <https://asiimaging.com/docs/ring_buffer>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs an underscore at the end of it. (Gah! Restructured Text syntax is wonky.)
Like this:

`RING BUFFER MODULE <https://asiimaging.com/docs/ring_buffer>`_

@Poofjunior
Copy link
Collaborator

Yayy--thanks so much! I'd say let's tweak that last change and then ship it!

Copy link
Collaborator

@Poofjunior Poofjunior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one syntax change at this point in the docstring. Looks good otherwise! I'll pre-approve so you can merge after.

@adamkglaser
Copy link
Collaborator Author

Thanks @Poofjunior. I will let you do the honors and merge! :)

@Poofjunior Poofjunior merged commit ad9eb3f into main Jan 11, 2025
@Poofjunior Poofjunior deleted the update-reset-ring-buffer branch January 11, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants