State features: fill and data dimensions support.#250
Conversation
|
Note for reviewer: The By design |
romanc
left a comment
There was a problem hiding this comment.
Can we move the unrelated changes to global_config.py out into a separate PR?
Regarding the ddims swap on the sizer: I think it's quite elegant since (from the front) nobody sees that we are doing behind the scenes. Have you considered making data_dimensions completely optional, e.g.
@classmethod
def empty(
cls,
quantity_factory: QuantityFactory,
*,
data_dimensions: dict[str, int] | None = None,
) -> Self:
"""Allocate all quantities. Do not expect 0 on values, values are random.
Args:
quantity_factory: Quantities are allocated with this factory.
data_dimensions: If provided, overrides the data dimensions of
`quantity_factory`. Dict of name/size pairs or `None` (default).
"""
if data_dimensions is None:
return cls._init(quantity_factory.empty)
with State._FactorySwapDimensionsDefinitions(quantity_factory, data_dimensions):
return cls._init(quantity_factory.empty)In that case, I'd suggest to force data_dimensions as a keyword argument. We could also think about renaming the argument to something like tmp_ddims, ddims_override, ...
fmalatino
left a comment
There was a problem hiding this comment.
Approve pending requested changes by other reviewers.
This reverts commit f1c2024.
I am eager to keep |
`state.full` method + utest update
Continuing the feature set for
Stateas we met them.fillmethod that will fill all fields with a particular valueSizerswapSide task:
global_configthat isn't used anymore.