-
Notifications
You must be signed in to change notification settings - Fork 26
Interface for modifying workspace content #563
Description
cabinetry currently does not provide a workspace modification interface. Modifications are sometimes needed and examples in #443 so far edit the specification dict directly.
A higher-level interface that avoids some of the boilerplate would be useful. This includes looping over channels / samples / modifiers and applying suitable modifications. The interface could accept names for channels / samples / modifiers, or lists / wildcard matching / regex. In cases where the modifier expects a new histogram, that could be provided to the interface. It may also be desirable to allow providing a custom function that changes a modifier. Additionally, a read-only version of such an interface could also be useful for e.g. #523. In case the interface can return more than one modifier / array, it would have to have more structure, possibly resulting in a partial workspace dict.
Nominal sample data lives outside the modifier list, but a function changing a modifier may still want to have access to that too (e.g. to increase the size of the variation by a factor).
Different modifiers (including possibly custom ones) have different formats, so this would have to be handled. Functional lenses may be a good way to address this (https://python-lenses.readthedocs.io/en/latest/tutorial/optics.html, thanks @cspollard!).