MazinLab / MKIDGen3

GNU General Public License v3.0
8 stars 3 forks source link

Feedline Config Incompatible with Hashed Form of Itself #16

Closed JennySmith888 closed 9 months ago

JennySmith888 commented 9 months ago

feedline_config_manager_test.py is failing with assert fc3.compatible_with(fc3.hashed_form) AssertionError

JennySmith888 commented 9 months ago

hash(self) == hash(other) in compatible_with returns False

JennySmith888 commented 9 months ago

_FLConfigMixin _hash_data(self) function returns attribute error for hashed configs because they do not have exposed config attributes

Unhashed config:

image

Hashed config:

image
JennySmith888 commented 9 months ago
self
Out[9]: <mkidgen3.server.feedline_config.FeedlineConfig at 0x1573c60e0>
self.hashed_form
Out[10]: <mkidgen3.server.feedline_config.FeedlineConfig at 0x15756c880>
self.hashed_form.bitstream
Out[11]: <mkidgen3.server.feedline_config.BitstreamConfig at 0x15755db40>
self.hashed_form.bitstream._hash_data
Traceback (most recent call last):
  File "/Users/jpsmith/.conda/envs/mkidgen3/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-12-90670344042c>", line 1, in <module>
    self.hashed_form.bitstream._hash_data
  File "/Users/jpsmith/Gen3/MKIDGen3/mkidgen3/server/feedline_config.py", line 121, in _hash_data
    return tuple(sorted(hash_data, key=lambda x: x[0]))
  File "/Users/jpsmith/Gen3/MKIDGen3/mkidgen3/server/feedline_config.py", line 120, in <genexpr>
    hash_data = ((k, _hasher(getattr(self, k), pass_none=True)) for k in self._settings)
AttributeError: 'BitstreamConfig' object has no attribute 'bitstream'
baileyji commented 9 months ago
fc2.waveform.compatible_with(fc2.hashed_form.waveform)
Out[16]: True
fc2.ddc.compatible_with(fc2.hashed_form.ddc)
Out[17]: True
fc2.bitstream.compatible_with(fc2.hashed_form.bitstream)
Out[18]: False

suggests the issue is in bitstream itself as a potential regression. looking further

This is likely related to

hash(fc2.ddc)==hash(fc2.hashed_form.ddc)
Out[24]: True
hash(fc2.bitstream)==hash(fc2.hashed_form.bitstream)
Out[25]: False

hash(fc2.bitstream)==hash(fc2.bitstream.hashed_form)
Out[26]: True
hash(fc2.bitstream)==hash(fc2.hashed_form.bitstream)
Out[27]: False
baileyji commented 9 months ago

This was broken by commit d7686c966ebe4403090f1dbfc5022320f98aebc8 due to a copy paste error.

self.bitstream = BitstreamConfig(**rfdc) if isinstance(bitstream, dict) else bitstream
self.rfdc_clk = RFDCClockingConfig(**rfdc) if isinstance(rfdc_clk, dict) else rfdc_clk
self.rfdc = RFDCConfig(**rfdc) if isinstance(rfdc, dict) else rfdc