automatic glob of propagations
This commit is contained in:
@@ -15,6 +15,7 @@ from scgenerator.io import (
|
||||
MemoryIOHandler,
|
||||
PropagationIOHandler,
|
||||
ZipFileIOHandler,
|
||||
logical_sort_key,
|
||||
unique_name,
|
||||
)
|
||||
from scgenerator.logger import get_logger
|
||||
@@ -359,7 +360,9 @@ def propagation(
|
||||
|
||||
|
||||
def propagation_series(
|
||||
files: Sequence[os.PathLike], index: int | slice | None = None, progress_bar: bool = False
|
||||
files: Sequence[os.PathLike] | os.PathLike,
|
||||
index: int | slice | None = None,
|
||||
progress_bar: bool = False,
|
||||
) -> tuple[Spectrum, PropagationCollection]:
|
||||
"""
|
||||
loads an existing sequence of propagation
|
||||
@@ -379,6 +382,8 @@ def propagation_series(
|
||||
PropagationCollection
|
||||
convenient object to work with multiple propagations **built on the same grid**
|
||||
"""
|
||||
if isinstance(files, str) or not isinstance(files, Sequence):
|
||||
files = sorted(Path(files).glob("*.zip"), key=logical_sort_key)
|
||||
if len(files) == 0:
|
||||
raise ValueError("You must provide at least one file to build a propagation series")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user