Skip to content
scinumtoolsPublic

About

Define, validate, and report scientific parameters with units and provenance across C++, Python, CLI, CMake, and REST.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

995 Commits

Folders and files

Repository files navigation

Scientific Numerical Tools v3 {?SNT3}

Unit-safe, strongly typed, validated input parameters for scientific and engineering software.

Focus on your science. Leave the parameter plumbing to SciNumTools.

Build Codecov GitHub release PyPI version Conda Version vcpkg Homebrew version License: MIT C++17 Compilers Documentation SNT3: DIPL

SciNumTools provides a common representation for physical quantities and validated scientific input parameters. Its C++17 libraries can be used from C/C++, Python, the command line, and CMake.

The project is built around two languages:

DIPL can serve as the single source of validated truth for a scientific model: values, units, constraints, derived relationships, and provenance stay together in one portable definition rather than being distributed across configuration files and application code.

The online documentation contains the concepts, language specifications, tutorials, examples, and API reference. The official SNT3 benchmarking project is scinumtools/snt-bench.

DIPL architecture: scientific parameters include physical units, hierarchies, references, constraints, dependencies, sources, and provenance; the C++ core shares them through C++, Python, C, WebAssembly and JavaScript, command-line, CMake, REST, MCP, and Parameter Viewer interfaces.

Why DIPL?

Scientific software often begins with a small configuration file, then grows into values spread across input files, unit conversions, validation code, derived constants, and undocumented assumptions. That makes a model harder to review, reproduce, and safely reuse in another tool or language.

DIPL was created to make the parameter definition itself the authoritative model interface. It keeps physical units, types, constraints, hierarchical structure, references, expressions, metadata, and provenance together, then exposes one evaluated and validated environment to every part of an application. The result is less duplicated glue code and a clearer boundary between a scientific model's assumptions and its implementation.

Features

Interfaces

See the documentation index for the complete usage guides.

Quick example

Define parameters in a parameters.dip file:

simulation
  title str = "Cylinder flow"
  fluid
    density float = 998.2 kg/m3
      !condition ({.} > 0 kg/m3)
    viscosity float = 1.003e-3 Pa*s
  time
    timestep float = 1e-3 s
    end float = 10 s
    steps int = ({?simulation.time.end} / {?simulation.time.timestep})
  boundary[inlet]
    velocity float[3] = [1.0, 0.0, 0.0] m/s
  solver
    type str = "steady"
      !options ["steady", "transient"]

The same definition can be read from C++, Python, and the command line. For persistence, exports, and reports, see the CLI guide.

Use the PUQ and DIP APIs from C++:

#include <snt/puq/quantity.h>
#include <snt/dip/dip.h>
#include <cstdint>
#include <iostream>

int main() {
  snt::puq::Quantity length("3.048*m");
  std::cout << length.convert("US_ft").to_string() << "\n";

  snt::dip::DIP dip;
  dip.add_file("parameters.dip");
  auto env = dip.parse();

  std::cout << env["simulation.fluid.density"].as<double>() << "\n";
  std::cout << env["simulation.time.steps"].as<int64_t>() << "\n";
}

Use the same functionality from Python:

from scinumtools3.puq import Quantity
from scinumtools3.dip import DIP

length = Quantity(3.048, "m").convert("US_ft")
print(length.to_string())

dip = DIP()
dip.add_file("parameters.dip")
env = dip.parse()

print(env["simulation.fluid.density"].value)
print(env["simulation.time.steps"].value)

The command-line interface can consume the same definitions:

$ snt puq convert "3.048*m" ft -s SI -S US
10*ft
$ snt dip parse -i file parameters.dip -r simulation.fluid.density --print
density = 998.2 kg*m-3

See the quickstart and examples for complete examples.

Installation

For Python, install from PyPI with pip install scinumtools3 or from conda-forge with conda install conda-forge::scinumtools3.

For C++, use vcpkg install scinumtools3. On macOS, use brew tap scinumtools/tap followed by brew install scinumtools3.

To install the precompiled snt command without administrator rights on Linux x86-64 or macOS ARM64, run:

curl -fsSLO https://raw.githubusercontent.com/scinumtools/snt3/main/packaging/installers/install-cli.sh
sh install-cli.sh

On Windows x86-64, use the PowerShell installer. See the installation guide for Windows commands, offline installation, Conan, and source builds.

CMake

After installation, find the package and link the modules required by an application:

find_package(snt REQUIRED)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE snt-api snt-dip)

The CMake integration can also parse a DIP file while configuring a project. The resulting values are available as CMake variables for the rest of the configuration process:

find_package(snt REQUIRED)

snt_dip_get(
    FILE parameters.dip
    PATH simulation.time.steps
    OUT SIMULATION_STEPS
    REQUIRED
)

One parameter layer for many scientific codes

A parameter model is validated and translated into a scientific code's native input file

We are inviting maintainers of established, open-source scientific codes to try a shared, optional parameter layer. A project-specific adapter can turn a DIPL definition into its existing native input file, while SciNumTools handles units, constraints, dependencies, and parameter documentation. The first step keeps the solver and its native parser in place. Read about the initiative and see the full flyer. The long-term aim is direct integration where a project judges the model and tooling stable and trustworthy. Explore related projects and integrations in the SNT Hub registry.

With SNT installed, create a workspace and choose a Hub project:

mkdir study && cd study
snt hub list
snt hub fetch PROJECT
snt hub examples
snt hub setup EXAMPLE

Replace PROJECT and EXAMPLE with names listed by list and examples. Generated files are placed in runs/EXAMPLE; see the SNT Hub CLI guide for prerequisites and overrides.


AI-assisted scientific setup

AI assistants, including large language models (LLMs), can draft scientific setups, but those drafts need explicit checks. DIPL gives them a readable, structured description of run settings and references to initial-condition files. SciNumTools checks declared types, units, constraints, and dependencies; a code-specific adapter can check further requirements and write the code's native input files. This makes an AI-assisted setup easier to inspect and test before a run. Scientific review is still needed to judge whether the choices are physically appropriate.

The current tools let an assistant or script list and describe evaluated parameters, then preview proposed overrides as JSON. The same operations are available through the C++ inspection API and Python bindings.

The native snt mcp interface lets AI agents validate, compare, and export DIPL candidates. Try the runnable UsingMCP example.

Built with SciNumTools

Nuclide Atlas is a unit-aware nuclear-isotope database and decay-chain calculator built with SciNumTools3. It uses DIPL for validated nuclide data, scenarios, provenance, and CMake build configuration.

See more applications and examples.

Development

The repository contains the C++ sources, Python bindings, command-line applications, tests, examples, packaging tools, and documentation.

SciNumTools v3 is the compiled successor to the original SciNumTools v2, with the same focus on units and validated scientific parameters.

Contributions and issue reports are welcome through GitHub. See CONTRIBUTING.md for the development workflow.

License

SciNumTools is released under the MIT License.

About

Define, validate, and report scientific parameters with units and provenance across C++, Python, CLI, CMake, and REST.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages