option for reading header

This commit is contained in:
Erik Frojdh
2023-06-02 16:52:14 +02:00
parent e43899cca8
commit 46a697cfb7
11 changed files with 198 additions and 16 deletions

14
creader/file_utils.py Normal file
View File

@ -0,0 +1,14 @@
from .ClusterFile import ClusterFile
from .RawFile import RawFile
from pathlib import Path
def open_file(fname):
"""Convenience function to open files"""
fname = Path(fname)
if fname.suffix == '.clust':
return ClusterFile(fname)
elif fname.suffix == '.json':
return RawFile(fname)
else:
raise ValueError('unsupported file type')