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

828 save waveform constants with acquisition and generate method to load it #841

Conversation

AdvancedImagingUTSW
Copy link
Collaborator

Annie, this could use a close look. Sriya led the charge on these code changes, and her branch combined two different issues: #828 and #804

For #828, she had a hard time getting the waveform popup to repopulate with new values, once she loaded a new waveform constants file. I dabbled with it, and then resorted to something that may not be ideal; I now destroy the waveform popup window, delete the waveform popup controller, and then launch a new popup and controller. To make it less annoying, The new popup shows up where the old one was.

For #804, we will need to change things to accommodate all of the work you did overhauling the camera timing.

AdvancedImagingUTSW and others added 10 commits January 25, 2024 10:07
Pushing changes so that I can jump on the machine.

Co-Authored-By: Sriya Veerapaneni <78429510+Sriya-235@users.noreply.github.com>
Hey!

So I made some changes to the menu_controller.py to save and load waveform_constants files. This allows us to  save the waveform constants for experiments and load the same constants for future experiments.

This commit also includes changes that @annie-xd-wang made to waveforms.py to align the wave.
Removed hot keys from menu controller.

Now saves the waveform constants with the data.

Only thing remaining is to have the popup GUI automatically populated with the new parameters.
Updated the documentation to show the updated file menu. Also added few lines about the load and save waveform constants option in the documentation.

Replaced the menu_file.png image with a new image of the file menu.
#: str: Feature list file name.
self.feature_list_file_name = "feature_lists.yaml"

#: waveform_popup_controller: Waveform Popup Controller.
# self.parent_controller.waveform_popup_controller = None

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps we should delete these commented lines.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Deleted.

"internal_line_interval": 4208720, # 0x00403850, R/W, sec,
# "INTERNAL LINE INTERVAL"
"internal_line_interval": 4208720, # 0x00403850, R/W, sec, "INTERNAL LINE INTERVAL"
"internal_line_speed": 4208704, # 0x00403840, R/W, m/sec, "INTERNAL LINE SPEED"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Important changes, presumably.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The modifications to camera functions originate from the commits in PR #808.

#: int: Maximum image width
self.max_image_width = 2048
#: int: Maximum image height
self.max_image_height = 2048
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

More important stuff.

self.camera_parameters["x_pixels"] = self.max_image_width
self.camera_parameters["y_pixels"] = self.max_image_height
self.y_pixels = 2048
self.camera_parameters["x_pixels"] = 2048
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hard coding

@@ -43,10 +43,11 @@
logger = logging.getLogger(p)


class HamamatsuOrca(CameraBase):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assume that most of these changes can be ignored. I take responsibility for this, and I'm sorry.

@@ -264,6 +266,9 @@ def create_analog_output_tasks(self, channel_key):
"""
self.n_sample = int(self.sample_rate * self.sweep_times[channel_key])
max_sample = self.n_sample * self.waveform_expand_num
print("max_sample", max_sample)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Delete print statements.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Deleted.

@@ -188,7 +188,7 @@ def adjust(self, exposure_times, sweep_times):
elif self.galvo_waveform == "halfsaw":
new_wave = sawtooth(
sample_rate=self.sample_rate,
sweep_time=self.sweep_time,
sweep_time= self.sweep_time,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Uniform spacing

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed.

@@ -405,13 +405,18 @@ def prepare_acquisition(self):
sensor_mode = self.configuration["experiment"]["CameraParameters"][
"sensor_mode"
]

print('sensor_mode', sensor_mode)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Delete print statement

Copy link
Collaborator

Choose a reason for hiding this comment

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

Deleted.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 26 lines in your changes are missing coverage. Please review.

Project coverage is 54.32%. Comparing base (c1c0d11) to head (b4aeb15).

Files Patch % Lines
src/navigate/model/waveforms.py 7.69% 12 Missing ⚠️
...gate/controller/sub_controllers/menu_controller.py 21.42% 11 Missing ⚠️
...te/model/devices/remote_focus/remote_focus_base.py 71.42% 2 Missing ⚠️
src/navigate/controller/controller.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #841      +/-   ##
===========================================
- Coverage    54.33%   54.32%   -0.02%     
===========================================
  Files          154      154              
  Lines        17444    17478      +34     
===========================================
+ Hits          9479     9495      +16     
- Misses        7965     7983      +18     
Flag Coverage Δ
unittests 54.32% <33.33%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@annie-xd-wang annie-xd-wang left a comment

Choose a reason for hiding this comment

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

We can test bidirectional acquisition on a machine now.

)

if hasattr(self.parent_controller, "waveform_popup_controller"):
self.parent_controller.waveform_popup_controller.populate_experiment_values(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Much nicer.

@AdvancedImagingUTSW
Copy link
Collaborator Author

Will test first thing tomorrow. But everything looks great.

@AdvancedImagingUTSW AdvancedImagingUTSW merged commit 2872042 into develop Mar 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants