Loaders And Field Helpers
Use load_table,
load_cartesian_fields, and
convert_to_powerflux to open or transform
individual JCMsuite result files. If you already have a
SolveResult or
PostprocessRecord, use its loading methods
instead.
Table And Field Loaders
Result loader namespace for jcmsuite.
- jcmsuite.loaders.convert_to_powerflux(fourier_results)[source]
Convert Fourier transform results into power-flux density.
- Parameters:
fourier_results (Mapping[str, object]) – Fourier-transform postprocess result.
- Returns:
Power-flux density result.
- Return type:
dict[str, object]
- Raises:
InvalidConfigurationError – If the Fourier-transform result does not contain the required title, header, wave-vector, or field data.
- jcmsuite.loaders.load_cartesian_fields(file_name, *, format='squeeze')[source]
Load field values on a Cartesian grid.
- Parameters:
file_name (str | Path) – Path to a Cartesian fieldbag .jcm file.
format ({"squeeze", "full"}, optional) – Shape of the returned coordinate arrays and field values. “squeeze” removes dimensions of length 1. “full” keeps all dimensions. The method supports text and binary fieldbag files.
- Returns:
Coordinates, field values, available derivatives, and file information.
- Return type:
- Raises:
InvalidConfigurationError – If file_name is not a file or format is not supported.
RuntimeError – If the fieldbag file is damaged or uses an unsupported storage format.
- jcmsuite.loaders.load_table(file_name, *, format='named')[source]
Load table data from a .jcm file.
- Parameters:
file_name (str | Path) – Path to the table file.
format ({"named"}, optional) – Output format. The only supported value is “named”.
- Returns:
One table, or an ordered collection if the file contains multiple tables.
- Return type:
- Raises:
InvalidConfigurationError – If file_name is not a file or format is not “named”.
Cartesian Field Format
- jcmsuite.loaders.CartesianFieldFormat = Literal["squeeze", "full"]
Selects the shape policy for Cartesian field coordinates and values. The “squeeze” value removes dimensions of length one; “full” preserves all dimensions.
Table Result Types
- class jcmsuite.results.TablePayload[source]
Result data stored as one table.
- to_df(orient=None)[source]
Return table data in the requested DataFrame orientation.
- Parameters:
orient ({"wide", "long"} | None, optional) – Table layout. If omitted, use the natural wide form.
- Returns:
Table data in the selected layout.
- Return type:
pandas.DataFrame
- Raises:
ValueError – If orient is not None, “wide”, or “long”.
- abstractmethod to_dict()
Return the result data as a dictionary.
- Returns:
Result data as a dictionary that keeps the original field names.
- Return type:
Mapping[object, object]
- to_mapping()
Return result data using the deprecated mapping export name.
Deprecated since version 7.2: Use
to_dict()instead.- Returns:
Result data as a dictionary that keeps the original field names.
- Return type:
Mapping[object, object]
- abstractmethod to_xarray()
Return the result data as an xarray DataTree.
- Returns:
Result data in an xarray tree. See the user documentation for xarray export details.
- Return type:
xarray.DataTree
- class jcmsuite.results.postprocess_payloads.TableDerivativeCollection[source]
Select solver derivatives from one canonical table payload.
- keys()[source]
Return the solver parameter names available for derivative selection.
On a postprocess record’s derivative collection, the names select first derivatives. After selecting a first derivative, the names select its available second derivatives. These are solver parameter names, not Torch project keys.
- Returns:
Available parameter names in table traversal order. The tuple is empty if no further derivative is available, including after a second derivative has been selected.
- Return type:
tuple[str, …]
- class jcmsuite.results.TableCollectionPayload[source]
Result data stored as multiple tables with different shapes.
- to_df(orient=None)[source]
Return the table collection in its supported long form.
- Parameters:
orient ({None, "long"}, optional) – Select the table layout. The collection supports only long form.
- Returns:
Table rows in long form.
- Return type:
pandas.DataFrame
- Raises:
UnsupportedExportError – If orient is “wide”.
ValueError – If orient is not None or “long”.
- abstractmethod to_dict()
Return the result data as a dictionary.
- Returns:
Result data as a dictionary that keeps the original field names.
- Return type:
Mapping[object, object]
- to_mapping()
Return result data using the deprecated mapping export name.
Deprecated since version 7.2: Use
to_dict()instead.- Returns:
Result data as a dictionary that keeps the original field names.
- Return type:
Mapping[object, object]
- abstractmethod to_xarray()
Return the result data as an xarray DataTree.
- Returns:
Result data in an xarray tree. See the user documentation for xarray export details.
- Return type:
xarray.DataTree
- class jcmsuite.results.postprocess_payloads.TableCollectionDerivativeCollection[source]
Select derivative directions without changing table member identity.
- keys()[source]
Return solver parameter names available in at least one table.
On a postprocess record’s derivative collection, the names select first derivatives. After selecting a first derivative, the names select its available second derivatives. A name need not be available in every table; selecting it includes only the tables that provide it.
- Returns:
Unique parameter names in first-encounter order across the tables. The tuple is empty if no further derivative is available, including after a second derivative has been selected.
- Return type:
tuple[str, …]
When load_table returns multiple tables, the returned collection
supports list-style access. Use tables[index] to select one table,
len(tables) to get the number of tables, or iterate over tables in source
file order.
Result Discovery
Public results namespace for jcmsuite.
- class jcmsuite.results.DiscoveredArtifacts(file, costs, eigenvalues, postprocesses)[source]
Store result files and data found for one project.
- file
Solution fieldbag file, if available.
- Type:
Path | None
- costs
Computational-cost data, if available.
- Type:
ComputationalCosts | None
- eigenvalues
Eigenvalue data, if available.
- Type:
Eigenvalues | None
- postprocesses
Available postprocess results in project file order.
- Type:
- jcmsuite.results.discover_artifacts_from_project(project_file)[source]
Find and load result data for one project file.
- Parameters:
project_file (Path) – Path to the rendered project file.
- Returns:
Solution fieldbag file and the available computational-cost, eigenvalue, and postprocess data.
- Return type:
- jcmsuite.results.discover_artifacts_from_result_dir(result_dir)[source]
Find and load result data from a project result directory.
- Parameters:
result_dir (Path) – Path to the
*_resultsdirectory.- Returns:
Solution fieldbag file and the available computational-cost, eigenvalue, and postprocess data.
- Return type: