palaeoware / trevosim

TREvoSim - The [Tr]ee [Evo]lutionary [Sim]ulator program
GNU General Public License v3.0
5 stars 3 forks source link

Command line functionality #31

Open ms609 opened 6 months ago

ms609 commented 6 months ago

The "Batch mode" dialog seems to allow for multiple replicates with identical run settings, but I can't see a way to programmatically run multiple iterations with different settings: for instance, to run a hundred simulations in which each has a different rate parameter – which is what I would (perhaps wrongly?) understand from the term "batch mode".

Does such a functionality exist? Perhaps what I'm really looking for is just a way to launch TREvoSim from the command line with parameters specified manually (or by a script); or to launch an instance of TREvoSim that runs automatically from a given settings save file.

RussellGarwood commented 5 months ago

Thanks for these thoughts. My intention for the batch mode was to run replicates with the same settings - this is the same in REvoSim, so is consistent terminology across our packages.

At the moment, no functionality such as that you request exists. Long term I plan to faciltate this with a headless vanilla C++ version (see comment in #3 ), however, I won't be able to achieve that for this release. I may be able to achieve a command line version that loads a settings file then runs once for this release, time constraints allowing. If I do I will post here, and if not I will leave this issue open until one is in place.

ms609 commented 5 months ago

That makes sense, thanks – it certainly isn't necessary in the context of the review, but it will be a useful addition when it comes.

RussellGarwood commented 4 months ago

@ms609 I've taken advantage of a fairly quiet moment in the Museum fur Naturkunde to implement something along these lines, and test it on Linux - see above push. If you launch the software from the command line with the switch -o or --open, pointing towards a settings file, it should load that file, and then run the simulation to completion before quitting the software.

There are a few things that could trip it up with Windows, but I am not able to test directly right now. Any feedback from you or @alanspencer would be appreciated when/if either of you gets the chance.

I will add this to the documentation once it is clear whether it is working OK on all systems!

ms609 commented 3 months ago

Looks good. Is there already a way to access 'batch mode' from the command line?

In theory, the parser should be fine with paths however you write them - i.e. / or \ as separators. It would be good to know for sure if this is the case

It seems that only / is accepted. Using a Git Bash terminal, ./trevosim.exe -o ../deploy/settings.xml succeeds, whereas ./trevosim.exe -o ..\deploy\settings.xml displays the TRevoSim splash screen which then disappears with no output folder being created.

It'd be great to know if the messages make it through to console when you do a run

I set up a run that gives a warning-unresolvable clades using the GUI. When I run from these settings via the command line, I do not see any warning message in TRevoSim or at the command line.

It'd be good to know if it provides an error message on exit on windows

No error message is visible; the program closes silently.

RussellGarwood commented 3 months ago

@ms609 With commit 5542f18d742e6c8ba243fd023edd0e3763b15977 courtesy of some rooting around and a workaround by @alanspencer, console output should now work on Windows. Ultimately the only way to fix this elegantly is to code the simulation as standalone, but that was something that was already on my radar for a number of reasons! In the meantime, we think this should work well enough

Thanks for clarifying separator issue. I think I should be able to fix this easily enough, and will update in this issue when I have done.

It will also be easy enough to add a batch number of repeats to the command line - this makes a lot of sense if you want to do replicates! Again, I will update here as soon as I have implemented that