Skip to content

Auto determination of center frequencies.#584

Merged
RemingtonRohel merged 4 commits into
developfrom
autotune
Jul 23, 2026
Merged

Auto determination of center frequencies.#584
RemingtonRohel merged 4 commits into
developfrom
autotune

Conversation

@RemingtonRohel

Copy link
Copy Markdown
Contributor
  • Fixes bug when using multiple frequencies for one slice, i.e. freq_order defined for the slice without rxctrfreq or txctrfreq
  • No more rxctrfreq, txctrfreq in experiment slices
  • Uses all frequencies in an AveragingPeriod to determine center frequencies
  • Moved center frequency determination code into its own file in utils/frequencies.py (out of utils/interface_classes/averaging_periods.py)
  • Added experiment tests for auto-tuning
  • Added unit tests for new frequencies.py file

* Fixes bug when using multiple frequencies for one slice, i.e.
  `freq_order` defined for the slice without `rxctrfreq` or `txctrfreq`
* No more rxctrfreq, txctrfreq in experiment slices
* Uses all frequencies in an AveragingPeriod to determine center
  frequencies
* Moved center frequency determination code into its own file in
  utils/frequencies.py (out of
utils/interface_classes/averaging_periods.py)
* Added experiment tests for auto-tuning
* Added unit tests for new frequencies.py file

@KieranKuch KieranKuch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code looks good and is sufficiently understandable. Logic seems clear. The test suite seems to hit all the bases from what I can tell (I have a couple more tests to suggest at the end actually). I approve with some minor documentation added.

I would add a few extra comments here and there for maximal clarity. First, in frequencies.py, under determine_tuning_freqs, the algorithm processes freqs in list order and doesn't backtrack when forming groups. I understand this is intentional to preserve the frequency/range order. But someone seeing this for the first time may be confused and not understand the why something like [10001, 13500, 11750] would not just trivially group 10001 and 11750 together and may try to correct the "error" without fully understanding the behaviour first. So a brief comment explaining the rationale there could be good. Something outlining units in the docstring could also be helpful? A source on where the reference for the 50kHz no-go zone (and the no-go zone for the edges) comes from could be helpful as well, just for the sake of hardware documentation.

Maybe in averaging_periods.py under _determine_tuning_freqs a brief note can be added to the docstring explaining why SEQUENCE or CONCURRENT need the same tuning frequencies while freq_order slice wouldn't. It is not immediately obvious.

Lastly, a test could be added to determine_tuning_freqs where it has a mixed list of plain frequencies and Band ranges together. Currently they are only tested separately. What about a single element freqs test as well?

@RemingtonRohel RemingtonRohel linked an issue Jul 20, 2026 that may be closed by this pull request

@tjk584 tjk584 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good stuff

Comment thread src/utils/frequencies.py
usable due to distortions around the tuning frequency and from the intrinsic N200 anti-aliasing filter. As such,
determination of tuning frequencies is somewhat complex as there are effectively 5 regions to consider:

|xxxxxx------------xxxxx------------xxxxxx|

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice explanation

@RemingtonRohel

Copy link
Copy Markdown
Contributor Author

Not passing actions, but I'll make a new PR for that to keep the history clean.

@RemingtonRohel
RemingtonRohel merged commit 5368ccd into develop Jul 23, 2026
0 of 3 checks passed
@RemingtonRohel
RemingtonRohel deleted the autotune branch July 23, 2026 21:44
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.

Auto center frequency in slices with freq_order

3 participants