marcov64 / Lsd

Lsd repository on GitHUB
33 stars 20 forks source link

Import elements to save from an external file #52

Open fl0rianB opened 2 years ago

fl0rianB commented 2 years ago

This is an enhancement suggestion. Is it possible to add an option to import a list of elements to save from a file in LSD Browser, like for network or sensitivity analysis ? Thanks,

MCP1 commented 2 years ago

Hi fl0rianB! Thanks for the suggestion. Could you elaborate a little more on the idea? It's still not clear to me exactly what you plan to import. The objects? Their attributes? Their elements? All? For any form of import to be build, we have to define a format for the file to be imported, like we have for networks (Pajek format) or sensitivity (LSD own). Ideas? Happy new year!

fl0rianB commented 2 years ago

Hi Marcelo, The basic use case is you have a large model and there is situations where you want to save a lot of elements and others where you want to focus on a small number of elements (to avoid large result files). Currently, I use multiple configuration files to do that, but you have to update them all when you change a parameter (and not forget about it!) and selecting a large number of elements to . My suggestion is to be able to save and load a list list of elements in a simple text file. One way to do that is to use the "exported saved elements" in the File menu, or a simpler file with only the name of the elements (I don't think the type, object and description are necessary). What do you think ? Happy new year!

MCP1 commented 2 years ago

Hi. Now I got it, thanks. It would be a kind of configuration file of a configuration, right? For sure it can be done and it doesn't seem hard to implement. My only doubt is if the best approach, at the general user level, is to add a new main menu option to it (menu File is already unbearably long/full of items). I guess that the average LSD user would most likely never use it, as the concept is not trivial. I'd prefer to tuck this import/export option somewhere else. Do you play well with the command line interface? One easy solution is to adapt one of the utilities we have for LWI to perform what you need, like:

elemcfg -r|-w -f config.lsd -o flags.txt

It would also have options to select which options to use (save, run-time, descriptions, etc.). This would also make it simpler to update many files at a time by creating batch/scripts, which I guess is a relevant use case. What do you think? As a curiosity, in my workflow, in which of course I sometimes have the same problem managing complex configurations like you, I use a different approach. I frequently have many configurations for the same model and I must update them whenever I have to change/add/remove elements (not just the save status). I work it out with a good diff tool (like winmerge in Windows), which allows me to easily merge the changes I want (not all) to the old configurations. It takes some practice to get it working, but then it gets fast to do. Of course, sometimes you end up corrupting the configuration files, but even fixing those is not difficult (always let the tool do backups before merging!). Best.

fl0rianB commented 2 years ago

Hi, "It would be a kind of configuration file of a configuration, right?" Yes. I have no opinion about the graphical user interface.

I don't use the LSD command line interface, can you indicate me where I can find documentation about it please? Thanks for your input, I'll try that! Best,