Replies: 5 comments 10 replies
-
Can the plotting CLI be a typer CLI? 🥺 It looks so beautiful: |
Beta Was this translation helpful? Give feedback.
-
I just would like to mention that I find the CLI idea quite nice. This is essentially the same idea as Regarding your points 1-3, I kind of agree with them all. Being able to specify plot-type but, at the same time, having some file-formats that the code is able to assign to a particular plot-type, is quite useful. The key specification in input files looks also nice, and having a bunch of pre-configurations somewhere is also a very good idea. I am not sure about having the CLI connected to the cloud and reading stuff from there... Because that would require an internet connection.. Maybe it is not that much of an issue, but I would wait to see the usage of points 1-3 before implementing such a cloud-thing. |
Beta Was this translation helpful? Give feedback.
-
I have thought some more about this today. And to comment on your points: 2), 3) and 4). I think the ideal thing would be something like: Currently sisl provides a path for holding configuration files: export SISL_CONFIGDIR = ~/.config/sisl/ so that would be the place to put stuff. I would also suggest that we have 2 levels of configurations. Quite often I find the need to change settings locally, and being able to allow more would be natural. So I guess an environment variable like So something like: export SISL_CONFIGDIR=$(pwd)/my_configs:$(pwd)/subset which would prefer settings in
As for the format of the configuration file, I would assume either toml/yaml files. @ialcon comments here would be valuable (whether or not both should be allowed for instance) Here an example: import yaml, toml
import sys
d = {
"plots": {
"red_bands": [
{"bands_style": {"color": "red", "width": 5}},
{"legend": "hello"},
],
"blue_bands": {"bands_style": {"color": "blue", "width": 5}},
},
"parallel": {"num_procs": 4},
}
from pprint import pprint
print("pprint:")
pprint(d)
print("\nyaml:")
yaml.dump(d, sys.stdout)
print("\ntoml:")
toml.dump(d, sys.stdout) and the output: pprint:
{'parallel': {'num_procs': 4},
'plots': {'blue_bands': {'bands_style': {'color': 'blue', 'width': 5}},
'red_bands': [{'bands_style': {'color': 'red', 'width': 5}},
{'legend': 'hello'}]}}
yaml:
parallel:
num_procs: 4
plots:
blue_bands:
bands_style:
color: blue
width: 5
red_bands:
- bands_style:
color: red
width: 5
- legend: hello
toml:
[plots]
[[plots.red_bands]]
[plots.red_bands.bands_style]
color = "red"
width = 5
[[plots.red_bands]]
legend = "hello"
[parallel]
num_procs = 4
[plots.blue_bands.bands_style]
color = "blue"
width = 5 A dictionary |
Beta Was this translation helpful? Give feedback.
-
Thanks for the comments, I was so focused on #801 that I didn't see this 😅 I agree with everything except for automatically looking for a file in the directory. If the user doesn't realize that the file is there, it can create lots of confusion :) I see how that could help with nested folders though, but I don't know if it is worth it to risk the potential confusion. Regarding yaml vs toml I think yaml feels more natural to write manually. Anyway probably its best to first try to do it without config files and then add the configs as an extra layer :) |
Beta Was this translation helpful? Give feedback.
-
Everything that I got from @zerothi's appears to make full sense to me. I apologize that I do not have much to add to the yaml vs toml discussion. I still do not fully get the picture of how the configuration files would be edited by the users, if either directly edited (say using As @pfebrer mentioned, probably it is better to go step by step, and implement the basic |
Beta Was this translation helpful? Give feedback.
-
Hi all!
For long I have been thinking that what's missing for
sisl.viz
is a CLI for plotting. I would like to create it so thatsisl.viz
becomes more useful to people in a daily basis.I have been thinking about the design, and there are some things that I'm not sure how to do.
1. Interface
Let's say that the CLI's entry point is
splot
. What should be the first argument, the file that you want to plot:where we could use the default plot if no plot class is specified, or the plotting method:
I think the latter makes the interface easier to design, but the first might be more convenient for users. Maybe if you pass a file (
file
) as a first argument it could be equivalent to:and then we could have both options coexist?
2. Config files
Some inputs are just a pain to pass through the CLI so I would like to add an extra
--config
or-c
that accepts a yaml file with the inputs. E.g.:bands_inputs.yaml:
3. Using preconfigurations
To make it more convenient, one could have a register of configurations, like:
somewhere/sisl_configs.yaml
And you could use them by name like:
Perhaps you could even use multiple of the configurations (which would merge).
I think this would be very good for convenience of users. What do you think?
What I'm not sure is:
sisl_configs
be stored?4. Custom complex workflows
This might be for a second iteration of the CLI.
In the repo maybe we could also have complex plotting workflows that fit specific cases. E.g. you could have a workflow that plots both bands and PDOS and shows them together as subplots, with everything correctly aligned. If that workflow is called
bands_pdos
, you could use it like:But maybe this shouldn't even be something that goes in
splot
and this is more a thing for sisl's toolbox 🤔5. Support for multiple subplots directly in the CLI
I.e. merging plots, subplots, animations... I have no idea how this could work. Maybe this is also for a second iteration.
I would love your comments (specially about points 1 to 3) so that I can start building it! :)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions