Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tickets/DM-46864: Take AOS Sequence #230

Merged
merged 3 commits into from
Oct 19, 2024
Merged

Tickets/DM-46864: Take AOS Sequence #230

merged 3 commits into from
Oct 19, 2024

Conversation

gmegh
Copy link
Contributor

@gmegh gmegh commented Oct 15, 2024

No description provided.

@gmegh gmegh requested a review from tribeiro October 15, 2024 17:24
Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

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

Consider creating an enumeration to hold the valid values for the mode.

Then you can compare enum values instead of strings, which will make it more readable and easy to update.

you could have something like:

class Mode(enum.IntEnum):
    TRIPLET = enum.auto()
    INTRA = enum.auto()
    EXTRA = enum.auto()

Then in the configuration you could do something like this.

schema_yaml = f"""
...
              mode:
                description: >-
                    Mode of operation. Options are 'triplet' (default), 'intra' or 'extra'.
                type: str
                default: 'triplet'
                enum: {[mode for mode in Mode]}

Then, you will have to covert the value to a mode enum:

self.mode = getattr(Mode, config.mode)

and then compare mode to the enum values instead of strings, e.g:

if self.mode == Mode.TRIPLET or self.mode == Mode.INTRA:
    ...

@gmegh gmegh requested a review from tribeiro October 17, 2024 15:37
# plus estimation on reading out the images (10s)
number_of_images = 3 if self.mode == "triplet" else 2
Copy link
Member

Choose a reason for hiding this comment

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

Should be

number_of_images = 3 if self.mode == Mode.TRIPLET else 2

await self.mtcs.offset_camera_hexapod(x=0, y=0, z=self.dz, u=0, v=0)

self.log.info("Taking intra-focal image")
async def take_out_of_focus_sequence(self) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe take_aos_sequence?


# Move the hexapod back to in focus position
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=self.dz, u=0, v=0)
async def take_cwfs_image(self, reason_suffix: str) -> int:
Copy link
Member

Choose a reason for hiding this comment

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

I don't see the value of having this method here. Why not just call self.camera.take_cwfs directly? note that, because this is a method, you need to add self.supplemented_group_id as a class attribute. I suggest you get rid of this method (and also remove self.supplemented_group_id in favor of a local variable. If you really want to have a method to encapsulate this operation (it does make the inline call leaner), pass supplemented_group_id alongside reason_suffix instead of relying on a class attribute.

self.log.info(f"Starting triplet {i+1} of {self.n_triplets}")
await self.checkpoint(f"triplet {i+1} of {self.n_triplets}")
for i in range(self.n_sequences):
self.log.info(f"Starting out-of-focus sequence {i+1} of {self.n_sequences}")
Copy link
Member

Choose a reason for hiding this comment

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

Please, replace "out-of-focus" with "aos".

@gmegh gmegh force-pushed the tickets/DM-46864 branch 2 times, most recently from 46379dc to 24e3d43 Compare October 18, 2024 22:00
@gmegh gmegh merged commit 934934b into develop Oct 19, 2024
2 checks passed
@gmegh gmegh deleted the tickets/DM-46864 branch October 19, 2024 20:19
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.

2 participants