-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add fixed tones support #440
base: master
Are you sure you want to change the base?
Conversation
Hi Tristan, this looks like a good start! A few comments:
One more thing is that recently I've found type hinting and static type checking to be very helpful for code readability and catching bugs early. For instance, it would be a lot clearer if the |
Thanks for the rapid feedback! That all makes sense and I'll make those changes |
sodetlib/operations/uxm_setup.py
Outdated
@@ -363,6 +363,35 @@ def setup_tune(S, cfg, bands, show_plots=False, update_cfg=True): | |||
return True, summary | |||
|
|||
|
|||
def setup_fixed_tones(S, cfg, freq, tone_power=10, update_cfg=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably also need an automated procedure to find the frequencies to use based on gaps where resonances don't exist from the tunefiles or find_freq results.
sodetlib/stream.py
Outdated
# ensure fixed tones are on | ||
for band in S.bands: | ||
if "fixed_tones" in cfg.dev.bands[band]: | ||
uxm_setup.turn_on_fixed_tones(S, cfg, band) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this will work since you need to run tracking_setup after turning on fixed tones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just figure out how to enable fixed tones without tracking setup... I imagine there's just a register or two that needs to be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had looked through tracking_setup
and it wasn't clear to me what would be missing, but in any case I will have to go through all of these steps with testing and I should find out then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a turn_on_fixed_tones
call to relock_tracking_setup
so that if it disables these channels they should be restored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need an additional enable_fixed_tones
cfg entry which allows us to disable fixed tones without removing the fixed-tone dictionary.
I just pushed a new draft addressing some of the suggestions so far:
After realising that you need the subband frequency offsets, I moved all the steps into the |
Sorry should've mentioned this, there is already an algorithm in pysmurf that we tend to use when doing this manually: |
We may want to make something custom though that is based on an existing tunefile and doesn't need to rescan. |
Oh man, I hadn't seen that! I'll take a look and see how it could fit in. |
I tried to address the suggestions so far and did some testing on the SLAC UFM today. I think functionally things are working now, and next I will polish up the code and commit history and add docstrings. |
c6ca77d
to
5cce286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes tristan! I have a few more simple requests and then I'm happy to merge (assuming its been tested)!
sodetlib/stream.py
Outdated
# ensure fixed tones are on | ||
for band in S.bands: | ||
if "fixed_tones" in cfg.dev.bands[band]: | ||
uxm_setup.turn_on_fixed_tones(S, cfg, band) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need an additional enable_fixed_tones
cfg entry which allows us to disable fixed tones without removing the fixed-tone dictionary.
Thanks for the suggestions -- I'll make those changes. I've tested the individual functions, but not in a full OCS context with agents running. But I did want to try to get something like that working. |
5cce286
to
29a7040
Compare
This is a draft with a proposed implementation for supporting fixed tones. If this looks good, I can proceed to testing on the SLAC system and then polish things up / add docstrings.
Right now it relies on a new function in
pysmurf
(slaclab/pysmurf#796) because I thought that would be a more complete implementation, but if it's preferable to keep these changes withinsodetlib
I can move it into this PR.