Open alexander-held opened 3 years ago
How would you suggest making it read-only? The only way I see this being possible is if we hand copies in return e.g.
@property
def channels(self):
return [*self.channels]
That is the option I thought of as well. Alternatively you could also of course keep the current approach where users just need to ensure they do not modify the model config, but that is likely not a common occurrence.
Question
I noticed that it is possible to modify
config.channels
of an existingModel
. That leads to some functionality taking into account the change, and other functionality breaking. It seems unreasonable to expect that a modified model still works, and it is simple enough to build a new model when needed. Given that users may accidentally modify the model, what do you think about making the relevant properties read-only?Below is an example to demonstrate the behavior with a generic two-channel workspace:
Running this results in
with a longer traceback I am skipping here. The data extraction respects the fact that a channel was removed, but the fit fails.
Users may come across something like this if they want a subset of the channels and accidentally write the result back into
model.config
. I have not tested the modification of other aspects ofmodel.config
.Relevant Issues and Pull Requests
none I am aware of