Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for python Path as io.Series argument #1723

Open
titoiride opened this issue Feb 27, 2025 · 1 comment
Open

Add support for python Path as io.Series argument #1723

titoiride opened this issue Feb 27, 2025 · 1 comment

Comments

@titoiride
Copy link
Contributor

titoiride commented Feb 27, 2025

As a very simple addition, it would be nice to be able to pass the path to an openPMD series as a python Path object rather than just a pure string.
As a convenient handle for paths, I believe it may be sometimes used in scripting.

Don't be afraid to add code examples!
Python:

import openpmd_api as io
from pathlib import Path

basefolder = Path("base_folder")
diagpath = basefolder.joinpath("path/to/diags")

series = io.Series(diagpath, io.Access.read_only)
# ...

Thanks!

@franzpoeschel
Copy link
Contributor

@ax3l Do you know of an easy way to add Python-defined overloads to a C++-defined binding? Probably better at that point to define only internal binding in C++ and then do the actual thing in Python?
Also, if we do this, then we should take the chance to allow Python objects as a JSON config such that users don't need to call json.dumps() themselves as in here:

series = io.Series("simData.sst", io.Access_Type.read_linear,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants