compatibility
Description¶
This module contains the functions used to ensure the compatibility of file formats saved with previous versions of openhdemg with the most recent versions of the library.
convert_json_output(old='', new='', old_version='0.1.0-beta.2', new_version='0.1.0-beta.3', append_name='converted', compresslevel=4, gui=True, ignore_safety_checks=False)
¶
Convert .json files saved from previous openhdemg versions to the desired format (target openhdemg version).
PARAMETER | DESCRIPTION |
---|---|
old
|
A path pointing to a .json file, or to a folder containing multiple
.json files, saved from the openhdemg version specified in
TYPE:
|
new
|
A path pointing to the folder where the converted .json file/files will be saved. The path can be a simple string, the use of Path() is not necessary.
TYPE:
|
old_version
|
The openhdemg version used to save the
TYPE:
|
new_version
|
The target openhdemg version for which you want to convert the files. Only "0.1.0-beta.3" is currently supported.
TYPE:
|
append_name
|
String to append to the name of the converted file. Use append_name="" to don't append any name.
TYPE:
|
compresslevel
|
An int from 0 to 9, where 0 is no compression and nine maximum compression. Compressed files will take less space, but will require more computation. The relationship between compression level and time required for the compression is not linear. For optimised performance, we suggest values between 2 and 6, with 4 providing the best balance.
TYPE:
|
gui
|
If true, the user will be able to select one or multiple .json files
to convert and the output folder with a convenient graphical interface.
If true,
TYPE:
|
ignore_safety_checks
|
Safety checks are performed to avoid overwriting the original file. If
TYPE:
|
Examples:
Convert the file/s with a practical GUI.
>>> from openhdemg.compatibility import convert_json_output
>>> convert_json_output(gui=True, append_name="converted")
Convert all the files in a folder without GUI. Save them in the same location with a different name.
>>> from openhdemg.compatibility import convert_json_output
>>> old = "C:/Users/.../test conversions/"
>>> new = "C:/Users/.../test conversions/"
>>> convert_json_output(
... old=old,
... new=new,
... append_name="converted",
... gui=False,
... )
Convert a file in a folder without GUI and overwrite it.