netket.logging.StateLog

class netket.logging.StateLog(output_prefix, mode='write', save_every=1, tar=False)[source]

Bases: object

A logger which serializes the variables of the variational state during a run.

The data is saved either to a directory or tar archive in a sequence of files named [0.mpack, 1.mpack, …] where the filename is incremented every time the logger is called. The tar file inside is not flushed to disk (closed) until this object is deleted or python is shut down.

__init__(output_prefix, mode='write', save_every=1, tar=False)[source]

Initialize the StateLogger.

Parameters
  • output_prefix (str) – the name of the output file before the extension (if tar=True) or of the output folder.

  • save_every (int) – every how many iterations the variables should be saved. (default 1)

  • mode (str) –

    Specify the behaviour in case the file already exists at this output_prefix. Options are - [w]rite: (default) overwrites file/delete the folder if

    it already exists;

    • [a]ppend: appends to the file/folder if it exists, overwise creates a new file;

    • [x] or fail: fails if file/folder already exists;

  • tar (bool) – if True creates a tar archive instead of a folder.

Methods
__call__(step, item, variational_state)[source]

Call self as a function.

close()[source]
flush(variational_state)[source]