Migrating to newer versions

Migrating from v0 to v1

Networks are modeled differently in v1, so the contents of the local ./networks/ folder should be scrapped.

To convert a v0 Results file to a v1 Results file, use bcn.v0.migrate_results. Likewise, use bcn.v0.migrate_weights to convert a v0 weights file to a v1 weights file.

v1 comes with a compatbility submodule accessible via

>>> import bcn.v0

Below are the members of this submodule.

bcn.v0.Results

A v0 copy of the bcn.Results class.

bcn.v0.migrate_results(file, new_filename=None)

Migrate a results file that was generated from v0.4.98 or earlier to a v1 results file.

This overwrites the file unless the new_filename parameter is used.

Example usage:

>>> from pathlib import Path
>>> from bcn.v0 import migrate_results
>>> for file in Path("./results/").iterdir():
...    migrate_results(file)
...
Parameters
  • file (Union[Path, str]) – The v0 results file to convert.

  • new_filename (Union[Path, str, None]) – The new filename to use. Default is to use the original filename.

Return type

None

bcn.v0.migrate_weights(file, new_filename=None)

Migrate a weights file that was generated from v0.4.98 or earlier to a v1 weights file.

This overwrites the file unless the new_filename parameter is used.

Example usage:

>>> from pathlib import Path
>>> from bcn.v0 import migrate_weights
>>> for file in Path("./results/").iterdir():
...    migrate_weights(file)
...
Parameters
  • file (Union[Path, str]) – The v0 weights file to convert.

  • new_filename (Union[Path, str, None]) – The new filename to use. Default is to use the original filename.

Return type

None