Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving groups of plotting parameters general_settings and process_settings #308

Open
mafrahm opened this issue Oct 12, 2023 · 2 comments
Labels
plotting Plotting related things priority-low Low priority stuff

Comments

@mafrahm
Copy link
Contributor

mafrahm commented Oct 12, 2023

At the moment the resolving of groups for plotting parameters general_settings [1] and process_settings [2] only works, when giving a single group, e.g. --process-settings my_group resolves the group, but --process-settings my_group:other_process,some_setting=True does not resolve the group, but interprets my_group as another process.

It would be nice, if we could make the resolve_config_default_and_groups function [3] also usable for the SettingsParameter and MultiSettingsParameter.

[1]

# when general_settings are a key to a general_settings_groups, use them instead
groups = config_inst.x("general_settings_groups", {})
if settings and list(settings.keys())[0] in groups.keys():
settings = groups[list(settings.keys())[0]]
if isinstance(settings, tuple):
settings = cls.general_settings.parse(settings)
params["general_settings"] = settings

[2]
# when process_settings are a key to a process_settings_groups, use them instead
groups = config_inst.x("process_settings_groups", {})
if settings and cls.process_settings.serialize(settings) in groups.keys():
settings = groups[cls.process_settings.serialize(settings)]
if isinstance(settings, tuple):
settings = cls.process_settings.parse(settings)
params["process_settings"] = settings

[3]
def resolve_config_default_and_groups(

@mafrahm mafrahm added priority-low Low priority stuff plotting Plotting related things labels Oct 12, 2023
@riga
Copy link
Member

riga commented Oct 13, 2023

I think we could follow to paths here:

  1. If there is a single value that could be interpreted as a group, check if it's a group and load its contents if it is indeed a group. But as you already mentioned, this could lead to ambiguities in parameters where a single value, say x, is interpreted as x=True.
  2. We use a "reference-like" syntax to mark a value explicitly as a group. I'm thinking of something similar as the config referencing in law or yaml, i.e. "my_value: &other_value". This would look like --process-settings "&my_group:other_process,some_setting=True".

Thinking about the implications of both paths, I'd definitely vote for 2 as it's far more explicit. However, it does require values to be quoted on the command line, but I think that's a fair trade-off.

Including @dsavoiu here as well.

@mafrahm
Copy link
Contributor Author

mafrahm commented Nov 28, 2023

I feel like there could be three things to resolve:

  1. resolving full groups of settings, where each group is a dict of processes and their corresponding settings (e.g. --process-settings proc1,some_setting=True:some_setting_group:another_setting_group). This should be the only case where we only pass a single value before adding the next :, since passing a process without settings is useless
  2. resolving groups of processes (e.g. --process-settings top,some_setting=True should be resolved to --process-settings st,some_setting=True:tt,some_setting=True)
  3. resolving settings separately from processes (e.g. --process-settings proc1,some_setting_group). This is probably the most difficult thing to resolve, since this will be parsed as {"proc1": {"some_setting_group": True}}. But I think it is not really necessary to consider this type of resolving because we usually want to use different settings per process anyway. So I'd propose to try to find a solution for only resolving the cases mentioned in 1. and 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plotting Plotting related things priority-low Low priority stuff
Projects
Status: Todo
Development

No branches or pull requests

2 participants