Open cboulay opened 5 months ago
agreed, and also manipulating AxisArrays is a bit of a pain in general. I don't like .ax
and .axes
etc.. I need to put some time into an axisarray refactor including a basic coords impl. soon
Just for fun (?), I made all the ezmsg-sigproc unit tests use frozendict when creating new AxisArray messages: https://github.com/ezmsg-org/ezmsg-sigproc/pull/20
All the tests still pass! So if we do decide to add frozendict
as a dependency to ezmsg, at least we know it should integrate seamlessly.
If we don't want to include a 3rd-party dependency, then we can try MappingProxyType
instead.
Here are differences between MappingProxyType
and frozendict
according to the maintainer of frozendict
.
As mentioned in ezmsg-org/ezmsg-sigproc#7 , I sometimes bungle the AxisArray creation / copying / manipulation and end up mutating an object that is referenced elsewhere. At least some of my mistakes could have been prevented if AxisArray's
.axes
field was a frozendict. I understand the hesitation to bring in a 3rd party dependency so I won't push on this at all, but if notfrozendict
then it would be nice if there was another way to prevent mutating.axes
.