Skip to main content

Comparison of data fields in files

Project description

FieldCompare

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Test Pipelines.

Coverage Report.

API Documentation.

fieldcompare is a python package with command-line interface (CLI) that can be used to compare datasets for (fuzzy) equality. It was designed mainly to serve as a tool to realize regression tests for research software, and in particular research software that deals with numerical simulations. In regression tests, the output of a software is compared to reference data that was produced by the same software at an earlier time, in order to detect if changes to the code cause unexpected changes to the behavior of the software.

Simulations typically produce discrete field data defined on computational grids, and there exists a variety of standard and widely-used file formats. fieldcompare supports a number of VTK file formats out-of-the box, a variety of further formats can be used with the help of meshio. Besides mesh files, csv files are also supported, a format that is widely used in simulation frameworks to write out secondary data such as e.g. error norms and convergence rates.

Independent of the file type and format, fieldcompare reads all fields from those files and allows you to then check all entries of the fields for equality with custom absolute and relative tolerances. Programmatically, you can provide and use custom predicates (e.g. "smaller-than"), while the CLI is currently hardwired to (fuzzy) equality checks, which is the most common use case.

A common issue with regression testing of grid files is that the grid may be written with a different ordering of points or cells, while the actual field data on the grid may be the same. To this end, fieldcompare provides the option to make the fields read from a grid unique by sorting the grid by its point coordinates and cell connectivity. Moreover, one can choose to strip the grid from ghost points, that may occur, for instance, upon merging the data from multiple grid partitions distributed over different processors.

GitHub Action

If you want to use fieldcompare in your GitHub actions, you may want to check out our fieldcompare action, which allows you to easily perform regression tests within your GitHub workflows.

Installation

After cloning this repository, you can simply install fieldcompare via pip by navigating to the top folder of this repository and then typing python -m pip install .. In case you don't want to install into your system, you can simply create a virtual environment beforehand using venv. The pip command will also install the CLI, which is then available as the fieldcompare command.

Command-line Interface

The CLI exposes two subcommands, namely file and dir, where the former is used to compare two files for equality, and the latter can be used to compare all files with matching names in two given directories. That is, type

fieldcompare file PATH_TO_FILE --reference PATH_TO_REFERENCE_FILE

to compare two files, and

fieldcompare dir PATH_TO_DIR --reference PATH_TO_REFERENCE_DIR

for comparing two directories. The latter command will scan both folders for files with matching names, and then run a file comparison on pairs of matching files. This can be useful if your simulation produces a number of files for which you have references stored in some reference folder, and you want to compare them all in a single command. For more info on the CLI options available, type in

fieldcompare file --help
fieldcompare dir --help

Examples

In examples/api you can find a few examples with instructions on how to use the API of fieldcompare. However, the examples do not cover some of the more advanced functions and classes, but we are planning to add more examples soon.

Contribution Guidelines

Contributions are highly welcome! For bug reports, please file an issue. If you want to contribute with features, improvements or bug fixes please fork this project and open a merge request into the main branch of this repository.

License

fieldcompare is licensed under the terms and conditions of the GNU General Public License (GPL) version 3 or - at your option - any later version. The GPL can be read online or in the LICENSE.txt file in this repository. See LICENSE.txt for full copying permissions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fieldcompare-0.0.6.tar.gz (90.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fieldcompare-0.0.6-py3-none-any.whl (83.7 kB view details)

Uploaded Python 3

File details

Details for the file fieldcompare-0.0.6.tar.gz.

File metadata

  • Download URL: fieldcompare-0.0.6.tar.gz
  • Upload date:
  • Size: 90.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fieldcompare-0.0.6.tar.gz
Algorithm Hash digest
SHA256 427439103e10d079b4d1ed2629fb1a1388e1700b021c3295b3a9ff1a98bf46c2
MD5 4fe4f0f3d57e188221628ef06b0cd34a
BLAKE2b-256 ff445152416b0afc44658ad7607a0653c4ee56b20eecdb76227c9fea90a22685

See more details on using hashes here.

File details

Details for the file fieldcompare-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: fieldcompare-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 83.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fieldcompare-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a20b0440fcefd1f631be73ff13af64edbfa3fa4eca791bc783a04475f572fa64
MD5 c6b350ba2ea78b21e08c6f136f9ad2a0
BLAKE2b-256 cab70e3930eec8f1fbf0faacb7844788cb37d0dbabf8e38c76a2e40316a7c5ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page