New driver.run() syntax
Created by: PhilipVinc
This pr does two things in a non-breaking way:
- sets a new order of arguments for the
run
function of drivers - allows to pass a logger object to
run
. - I also updated Ising1/2d and J1J2 and DissipativeIsing examples to use the non deprecated syntax
The new signature is
def run(self, n_iter, output_prefix=None, obs=None, logger=None, etc...)
essentially switching the order of n_iter
and output_prefix
.
The rationale is that if one wants to use a different logger created by himself one can do
driver.run(300, logger=mylogger)
. Essentially, the first argument is now not the output folder (one might want no output, after all) but the number of iterations.
The reason why it's useful to pass a logger to run is so that one can append different runs, if you create the logger with my logger = nk.logging.JsonLog('path', 'append')
.
In order to make this non breaking, there are a bunch of type checks on inputs. Later this PR should be back ported to v3.0 branch, removing those deprecation warnings.
Note for merging
This PR is rebased on top of #381, so who merges #381 should possibly do a rebase and merge and then this can be merged without issues