Dataset files type detection

for this example you need the following files:

DatasetFilesTypeDetection.py

import os

from LOGS import LOGS

# Connect to LOGS
logs = LOGS()

# In this example we assume that there is a directory "datasets" containing data files next to the script itself
directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "datasets")

# You can specify a directory or a list of directories and files for the matching. All subdirectories will be browsed
# automatically. The result will be a list of possible recognized matches with the respective dataset format.
matches = logs.datasetMatching(directory)
# The result object is an iterator of matches, a collection of files belonging to a specific LOGS datset format
for i, match in enumerate(matches):
    print(
        "Possible match %d: dataset %a of format %a with %d file(s):"
        % (i + 1, match.name, match.formatId, len(match.files))
    )
    # Each match is a file iterator representing the files that belong to this LOGS dataset format match
    for file in match:
        print("  ", file.fullPath)
    print()