Backends§
Please navigate to a specific section for more information about the implementation of each simulation file type.
If you're looking for the backend-specific methods that you can call on a data object, see Data object methods → Backend-specific methods.
Interface class§
Info
This section should only be relevant if you're planning to add support for a new backend or for debugging purposes.
The Backend class serves as an interface between ozzy's main file-reading functions and the modules for each implemented backend.
Backend
§
Interface class for reading simulation data. Upon initialization, the Backend instance imports a specific submodule for a given data format and defines its data-parsing methods accordingly.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the backend (e.g. |
parse |
function
|
Function for parsing data from files. |
mixin |
class
|
Mixin class that makes methods available to the data object depending on the file backend/data origin ( |
parse_data
§
parse_data(files, *args, **kwargs)
Read data from files and attach metadata according to the selected Backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
list[str]
|
File paths to read data from. |
required |
|
Positional arguments to be passed to the |
()
|
|
|
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Parsed data. Includes the following Dataset attributes: |
Examples:
Parse a single file
from ozzy.backend_interface import Backend
backend = Backend('lcode')
ds = backend.parse_data(['path/to/file.swp'])
Parse multiple files
from ozzy.backend_interface import Backend
backend = Backend('osiris')
ds = backend.parse_data(['path/to/file1.h5', 'path/to/file2.h5'])
plan_reads
§
plan_reads(
path,
dirs_runs,
quants=None,
records=None,
mode=ReadMode.SERIES,
**kwargs
)
Plan backend reads for the supplied run directories.
For openPMD data, jobs are grouped by diagnostic and, in "compare" mode, by record. For the other backends, one job is produced for every discovered run-quantity combination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Base path associated with the run directories. The directories in
|
required |
|
dict[str, str]
|
Mapping from run names to resolved run-directory paths. |
required |
|
str, list[str], or None
|
Quantity or diagnostic search pattern, or a list of patterns. |
None
|
|
str, list[str], or None
|
openPMD records to associate with each diagnostic. This parameter is used
only by the |
None
|
|
ReadMode
|
Read-grouping mode. Available values are |
SERIES
|
|
Additional keyword arguments accepted by the planning interface. |
{}
|
Returns:
| Type | Description |
|---|---|
list[ReadJob]
|
Planned read jobs. |
ReadJob
dataclass
§
Describe a group of files to be passed to a backend reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Name of the run containing the files. |
required |
|
str
|
Label assigned to the discovered quantity, diagnostic, or diagnostic-record pair. |
required |
|
tuple[str, ...]
|
File paths belonging to the job. |
required |
|
Mapping[str, Any]
|
Additional keyword arguments for the backend reader. The default is an empty mapping. |
dict()
|
Attributes:
| Name | Type | Description |
|---|---|---|
run |
str
|
Name of the run containing the files. |
label |
str
|
Label assigned to the job. |
files |
tuple[str, ...]
|
File paths belonging to the job. |
reader_kwargs |
Mapping[str, Any]
|
Additional keyword arguments for the backend reader. |
ReadMode
§
Bases: str, Enum
flowchart TD
ozzy.backend_interface.ReadMode[ReadMode]
click ozzy.backend_interface.ReadMode href "" "ozzy.backend_interface.ReadMode"
Specify how discovered files are grouped into read jobs.
Attributes:
| Name | Type | Description |
|---|---|---|
SERIES |
str
|
Group an openPMD diagnostic and all requested records into one job.
Its value is |
COMPARE |
str
|
Create a separate openPMD job for every diagnostic-record pair.
Its value is |