gamut-format 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gamut_format-1.0.0/.gitignore +28 -0
- gamut_format-1.0.0/CHANGELOG.md +31 -0
- gamut_format-1.0.0/CITATION.cff +34 -0
- gamut_format-1.0.0/CMakeLists.txt +176 -0
- gamut_format-1.0.0/CONTRIBUTING.md +76 -0
- gamut_format-1.0.0/LICENSE +202 -0
- gamut_format-1.0.0/PKG-INFO +230 -0
- gamut_format-1.0.0/README.md +194 -0
- gamut_format-1.0.0/SPEC.md +892 -0
- gamut_format-1.0.0/examples/00_readme.py +33 -0
- gamut_format-1.0.0/examples/01_run_table.py +31 -0
- gamut_format-1.0.0/examples/02_one_mesh.py +45 -0
- gamut_format-1.0.0/examples/03_geometry_family.py +35 -0
- gamut_format-1.0.0/examples/04_changing_mesh.py +30 -0
- gamut_format-1.0.0/examples/05_time_series.py +27 -0
- gamut_format-1.0.0/examples/06_uncertainty_gradients.py +32 -0
- gamut_format-1.0.0/examples/07_models.py +62 -0
- gamut_format-1.0.0/examples/08_selecting_parts.py +34 -0
- gamut_format-1.0.0/examples/09_combining_files.py +32 -0
- gamut_format-1.0.0/examples/10_vtk.py +37 -0
- gamut_format-1.0.0/examples/_cylinder.py +26 -0
- gamut_format-1.0.0/examples/c/one_mesh.c +96 -0
- gamut_format-1.0.0/examples/cli/second_entry.json +1 -0
- gamut_format-1.0.0/examples/cli/second_entry_runs.csv +3 -0
- gamut_format-1.0.0/examples/cli/sweep.json +9 -0
- gamut_format-1.0.0/examples/cli/sweep_runs.csv +5 -0
- gamut_format-1.0.0/examples/cpp/one_mesh.cpp +63 -0
- gamut_format-1.0.0/exports.map +4 -0
- gamut_format-1.0.0/exports.txt +1 -0
- gamut_format-1.0.0/include/gamut/gamut.h +309 -0
- gamut_format-1.0.0/include/gamut/gamut.hpp +638 -0
- gamut_format-1.0.0/pyproject.toml +80 -0
- gamut_format-1.0.0/python/gamut/__init__.py +25 -0
- gamut_format-1.0.0/python/gamut/__main__.py +6 -0
- gamut_format-1.0.0/python/gamut/_files.py +44 -0
- gamut_format-1.0.0/python/gamut/_lib.py +314 -0
- gamut_format-1.0.0/python/gamut/_models.py +429 -0
- gamut_format-1.0.0/python/gamut/_study.py +654 -0
- gamut_format-1.0.0/python/gamut/_units.py +64 -0
- gamut_format-1.0.0/python/gamut/_validate.py +63 -0
- gamut_format-1.0.0/python/gamut/cli.py +665 -0
- gamut_format-1.0.0/python/gamut/vtk.py +552 -0
- gamut_format-1.0.0/python/tests/_pages.py +25 -0
- gamut_format-1.0.0/python/tests/test_binding.py +312 -0
- gamut_format-1.0.0/python/tests/test_cli.py +89 -0
- gamut_format-1.0.0/python/tests/test_docs.py +44 -0
- gamut_format-1.0.0/python/tests/test_edges.py +460 -0
- gamut_format-1.0.0/python/tests/test_examples.py +43 -0
- gamut_format-1.0.0/python/tests/test_files.py +333 -0
- gamut_format-1.0.0/python/tests/test_guide_cli.py +69 -0
- gamut_format-1.0.0/python/tests/test_guide_languages.py +55 -0
- gamut_format-1.0.0/python/tests/test_models.py +159 -0
- gamut_format-1.0.0/python/tests/test_readme.py +46 -0
- gamut_format-1.0.0/python/tests/test_validate.py +230 -0
- gamut_format-1.0.0/python/tests/test_vtk.py +259 -0
- gamut_format-1.0.0/src/capi.cpp +1213 -0
- gamut_format-1.0.0/src/chunk.cpp +58 -0
- gamut_format-1.0.0/src/chunk.hpp +43 -0
- gamut_format-1.0.0/src/codec.cpp +213 -0
- gamut_format-1.0.0/src/codec.hpp +33 -0
- gamut_format-1.0.0/src/copy.cpp +476 -0
- gamut_format-1.0.0/src/copy.hpp +32 -0
- gamut_format-1.0.0/src/evaluate.cpp +69 -0
- gamut_format-1.0.0/src/evaluate.hpp +27 -0
- gamut_format-1.0.0/src/h5.cpp +1153 -0
- gamut_format-1.0.0/src/h5.hpp +244 -0
- gamut_format-1.0.0/src/names.cpp +152 -0
- gamut_format-1.0.0/src/names.hpp +44 -0
- gamut_format-1.0.0/src/nearest.cpp +164 -0
- gamut_format-1.0.0/src/nearest.hpp +49 -0
- gamut_format-1.0.0/src/parallel.cpp +315 -0
- gamut_format-1.0.0/src/parallel.hpp +30 -0
- gamut_format-1.0.0/src/reader.cpp +724 -0
- gamut_format-1.0.0/src/reader.hpp +79 -0
- gamut_format-1.0.0/src/schema.cpp +86 -0
- gamut_format-1.0.0/src/schema.hpp +144 -0
- gamut_format-1.0.0/src/select.cpp +253 -0
- gamut_format-1.0.0/src/select.hpp +23 -0
- gamut_format-1.0.0/src/sha256.cpp +150 -0
- gamut_format-1.0.0/src/sha256.hpp +40 -0
- gamut_format-1.0.0/src/types.cpp +152 -0
- gamut_format-1.0.0/src/types.hpp +133 -0
- gamut_format-1.0.0/src/units.cpp +295 -0
- gamut_format-1.0.0/src/units.hpp +14 -0
- gamut_format-1.0.0/src/validate.cpp +1461 -0
- gamut_format-1.0.0/src/validate.hpp +38 -0
- gamut_format-1.0.0/src/value.cpp +136 -0
- gamut_format-1.0.0/src/value.hpp +78 -0
- gamut_format-1.0.0/src/writer.cpp +1860 -0
- gamut_format-1.0.0/src/writer.hpp +190 -0
- gamut_format-1.0.0/tests/header_tests.cpp +330 -0
- gamut_format-1.0.0/tests/unit_tests.cpp +204 -0
- gamut_format-1.0.0/tests/writer_reader_tests.cpp +411 -0
- gamut_format-1.0.0/tools/build_deps.sh +86 -0
- gamut_format-1.0.0/tools/damaged_files.py +87 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
wheelhouse/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
|
|
11
|
+
# Build trees and built libraries
|
|
12
|
+
build/
|
|
13
|
+
build-*/
|
|
14
|
+
python/gamut/_native/
|
|
15
|
+
matlab/*.mex*
|
|
16
|
+
|
|
17
|
+
# Julia
|
|
18
|
+
julia/Manifest.toml
|
|
19
|
+
|
|
20
|
+
# Files the tests and benchmarks write
|
|
21
|
+
*.gamut
|
|
22
|
+
!docs/**/*.gamut
|
|
23
|
+
bench/results/raw/
|
|
24
|
+
|
|
25
|
+
.DS_Store
|
|
26
|
+
matlab/libgamut.*
|
|
27
|
+
matlab/gamut.dll
|
|
28
|
+
matlab/gamut.lib
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-10-18)
|
|
4
|
+
|
|
5
|
+
Version 1 of the format, `gamut/1`, and a new implementation. Before
|
|
6
|
+
version 1 the format and its libraries were called mestra (the 0.1 series
|
|
7
|
+
on PyPI).
|
|
8
|
+
|
|
9
|
+
The format ([SPEC.md](SPEC.md)) is redesigned around the study: a run
|
|
10
|
+
table with roles, statuses and splits; a shared mesh whose geometry is
|
|
11
|
+
fixed, per run or per member of a family, or a mesh per run; fields as one
|
|
12
|
+
block of runs × nodes; uncertainty and derivatives as relations; and model
|
|
13
|
+
files of the same shape as data. Files of the earlier `mestra/0` are
|
|
14
|
+
refused with a message naming their version.
|
|
15
|
+
|
|
16
|
+
A C++ core with a C interface implements the format, and Python, MATLAB
|
|
17
|
+
and Julia are layers over it, so every language gives the same answers.
|
|
18
|
+
The Python wheels link HDF5 statically, so the core never meets another
|
|
19
|
+
HDF5 in the same process.
|
|
20
|
+
|
|
21
|
+
Python has `create`, `open`, `append`, `extract`, `write_copy`,
|
|
22
|
+
`validate`, `create_model` and `evaluate`; the `gamut` command line
|
|
23
|
+
(`info`, `validate`, `build`, `append`, `get`); and `gamut-vtk`, which
|
|
24
|
+
turns a folder of VTK runs into a study and back. MATLAB, Julia and C++
|
|
25
|
+
(the header-only `gamut/gamut.hpp`) have the same calls in each language's
|
|
26
|
+
spelling, and C programs use the C interface, `gamut/gamut.h`.
|
|
27
|
+
|
|
28
|
+
Readers check sizes before using memory, never follow links and load no
|
|
29
|
+
HDF5 plugins ([security](docs/security.md)). The guide has fourteen pages,
|
|
30
|
+
each held to a runnable example by the tests, and the
|
|
31
|
+
[benchmarks](docs/benchmarks.md) cover two studies.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: >-
|
|
3
|
+
If you use Gamut in published work, please cite it as below, and
|
|
4
|
+
name the format version your files declare (the root attribute
|
|
5
|
+
`format`, for example "gamut/1").
|
|
6
|
+
title: "Gamut: an open file format for simulation studies"
|
|
7
|
+
type: software
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
date-released: 2026-10-18
|
|
10
|
+
authors:
|
|
11
|
+
- name: "Bijective Systems"
|
|
12
|
+
repository-code: "https://github.com/bijective-systems-org/gamut"
|
|
13
|
+
url: "https://github.com/bijective-systems-org/gamut"
|
|
14
|
+
license: Apache-2.0
|
|
15
|
+
abstract: >-
|
|
16
|
+
Gamut is an open file format for the results of a parametric
|
|
17
|
+
simulation study and the models fitted to it. One HDF5 file, laid
|
|
18
|
+
out as a valid netCDF-4 file, holds the run table (parameters with
|
|
19
|
+
roles, labels, statuses, splits and scalar results, every number with
|
|
20
|
+
its units), the mesh the fields live on, the fields themselves as one
|
|
21
|
+
block of runs by nodes when the runs share a mesh, uncertainty and
|
|
22
|
+
gradients beside the values they describe, and fitted models in the
|
|
23
|
+
same terms as the data. One C++ core, with Python, MATLAB, Julia and C
|
|
24
|
+
interfaces, implements the specification, and a shared corpus of
|
|
25
|
+
valid, broken and hostile files holds every language to it.
|
|
26
|
+
keywords:
|
|
27
|
+
- simulation data
|
|
28
|
+
- parametric study
|
|
29
|
+
- surrogate model
|
|
30
|
+
- HDF5
|
|
31
|
+
- netCDF-4
|
|
32
|
+
- mesh
|
|
33
|
+
- scientific machine learning
|
|
34
|
+
- uncertainty quantification
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16)
|
|
2
|
+
project(gamut VERSION 1.0.0 LANGUAGES C CXX)
|
|
3
|
+
|
|
4
|
+
# The shared core of spec version 1: one C++ library behind a plain C
|
|
5
|
+
# interface (include/gamut/gamut.h). Python, MATLAB and Julia bind to
|
|
6
|
+
# that interface; nothing else is exported.
|
|
7
|
+
|
|
8
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
9
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
10
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
11
|
+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
12
|
+
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
13
|
+
|
|
14
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
15
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
option(GAMUT_BUILD_TESTS "Build the core's unit tests" ON)
|
|
19
|
+
option(GAMUT_SANITIZE "Build with the address and undefined sanitizers" OFF)
|
|
20
|
+
# A process may hold another HDF5 (h5py's, MATLAB's). Where symbols share
|
|
21
|
+
# one namespace (Linux), a core linked to a shared HDF5 can bind to the
|
|
22
|
+
# other copy; linked statically, with only gamut_* exported, it cannot.
|
|
23
|
+
option(GAMUT_STATIC_HDF5 "Link HDF5 statically into the core" OFF)
|
|
24
|
+
if(GAMUT_STATIC_HDF5)
|
|
25
|
+
set(HDF5_USE_STATIC_LIBRARIES ON)
|
|
26
|
+
set(ZLIB_USE_STATIC_LIBS ON)
|
|
27
|
+
# With the C runtime linked statically, as tools/build_deps.sh builds
|
|
28
|
+
# HDF5 and zlib, the DLL needs no Visual C++ redistributable.
|
|
29
|
+
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
# No multiply and add may fuse into one rounding step: the built-in
|
|
33
|
+
# nearest-neighbour model must give bit-identical distances everywhere.
|
|
34
|
+
if(MSVC)
|
|
35
|
+
set(GAMUT_WARNINGS /W4 /permissive-)
|
|
36
|
+
set(GAMUT_FP_FLAGS /fp:precise)
|
|
37
|
+
else()
|
|
38
|
+
set(GAMUT_WARNINGS -Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
|
39
|
+
-Wsign-conversion)
|
|
40
|
+
set(GAMUT_FP_FLAGS -ffp-contract=off)
|
|
41
|
+
endif()
|
|
42
|
+
set(GAMUT_SANITIZER_FLAGS "")
|
|
43
|
+
if(GAMUT_SANITIZE)
|
|
44
|
+
set(GAMUT_SANITIZER_FLAGS -fsanitize=address,undefined
|
|
45
|
+
-fno-omit-frame-pointer
|
|
46
|
+
-fno-sanitize-recover=undefined)
|
|
47
|
+
add_link_options(-fsanitize=address,undefined)
|
|
48
|
+
endif()
|
|
49
|
+
|
|
50
|
+
find_package(HDF5 REQUIRED COMPONENTS C HL)
|
|
51
|
+
# 1.12 brought the object-token API the core uses; packages bundle 1.14.
|
|
52
|
+
if(HDF5_VERSION AND HDF5_VERSION VERSION_LESS 1.12)
|
|
53
|
+
message(FATAL_ERROR "the Gamut core needs HDF5 1.12 or later; found ${HDF5_VERSION}. "
|
|
54
|
+
"Point HDF5_ROOT at a newer HDF5.")
|
|
55
|
+
endif()
|
|
56
|
+
find_package(ZLIB REQUIRED)
|
|
57
|
+
find_package(Threads REQUIRED)
|
|
58
|
+
|
|
59
|
+
set(GAMUT_CORE_SOURCES
|
|
60
|
+
src/types.cpp
|
|
61
|
+
src/names.cpp
|
|
62
|
+
src/units.cpp
|
|
63
|
+
src/sha256.cpp
|
|
64
|
+
src/h5.cpp
|
|
65
|
+
src/chunk.cpp
|
|
66
|
+
src/schema.cpp
|
|
67
|
+
src/reader.cpp
|
|
68
|
+
src/writer.cpp
|
|
69
|
+
src/parallel.cpp
|
|
70
|
+
src/validate.cpp
|
|
71
|
+
src/value.cpp
|
|
72
|
+
src/codec.cpp
|
|
73
|
+
src/nearest.cpp
|
|
74
|
+
src/evaluate.cpp
|
|
75
|
+
src/copy.cpp
|
|
76
|
+
src/select.cpp
|
|
77
|
+
src/capi.cpp
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# The objects once, linked into the shared library the bindings load and
|
|
81
|
+
# into the unit tests, which reach the internals directly.
|
|
82
|
+
add_library(gamut_core_objects OBJECT ${GAMUT_CORE_SOURCES})
|
|
83
|
+
set_target_properties(gamut_core_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
84
|
+
target_include_directories(gamut_core_objects
|
|
85
|
+
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
86
|
+
${HDF5_INCLUDE_DIRS})
|
|
87
|
+
target_compile_definitions(gamut_core_objects PRIVATE GAMUT_BUILDING ${HDF5_DEFINITIONS})
|
|
88
|
+
if(GAMUT_STATIC_HDF5)
|
|
89
|
+
# The core owns its HDF5, and so may set it up (no filter plugins).
|
|
90
|
+
set(GAMUT_OWN_HDF5 GAMUT_OWN_HDF5)
|
|
91
|
+
endif()
|
|
92
|
+
target_compile_definitions(gamut_core_objects PRIVATE ${GAMUT_OWN_HDF5})
|
|
93
|
+
target_compile_options(gamut_core_objects PRIVATE ${GAMUT_WARNINGS}
|
|
94
|
+
${GAMUT_FP_FLAGS} ${GAMUT_SANITIZER_FLAGS})
|
|
95
|
+
|
|
96
|
+
add_library(gamut SHARED $<TARGET_OBJECTS:gamut_core_objects>)
|
|
97
|
+
target_include_directories(gamut PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
|
98
|
+
target_link_libraries(gamut PRIVATE ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ZLIB::ZLIB
|
|
99
|
+
Threads::Threads ${CMAKE_DL_LIBS})
|
|
100
|
+
# Nothing but the C interface leaves the library, whatever is linked into it.
|
|
101
|
+
if(APPLE)
|
|
102
|
+
target_link_options(gamut PRIVATE
|
|
103
|
+
"LINKER:-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/exports.txt")
|
|
104
|
+
elseif(UNIX)
|
|
105
|
+
target_link_options(gamut PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports.map")
|
|
106
|
+
if(NOT GAMUT_SANITIZE)
|
|
107
|
+
target_link_options(gamut PRIVATE "LINKER:--no-undefined")
|
|
108
|
+
endif()
|
|
109
|
+
endif()
|
|
110
|
+
set_target_properties(gamut PROPERTIES OUTPUT_NAME gamut)
|
|
111
|
+
# gamut.hpp needs C++17 in the programs that include it.
|
|
112
|
+
target_compile_features(gamut INTERFACE cxx_std_17)
|
|
113
|
+
|
|
114
|
+
if(GAMUT_BUILD_TESTS)
|
|
115
|
+
enable_testing()
|
|
116
|
+
add_executable(core_unit_tests tests/unit_tests.cpp $<TARGET_OBJECTS:gamut_core_objects>)
|
|
117
|
+
target_include_directories(core_unit_tests PRIVATE
|
|
118
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ${HDF5_INCLUDE_DIRS})
|
|
119
|
+
target_compile_definitions(core_unit_tests PRIVATE ${HDF5_DEFINITIONS} ${GAMUT_OWN_HDF5})
|
|
120
|
+
target_compile_options(core_unit_tests PRIVATE ${GAMUT_WARNINGS}
|
|
121
|
+
${GAMUT_FP_FLAGS} ${GAMUT_SANITIZER_FLAGS})
|
|
122
|
+
target_link_libraries(core_unit_tests PRIVATE ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES}
|
|
123
|
+
ZLIB::ZLIB Threads::Threads)
|
|
124
|
+
add_test(NAME core_unit_tests COMMAND core_unit_tests
|
|
125
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
126
|
+
add_executable(core_writer_reader_tests tests/writer_reader_tests.cpp
|
|
127
|
+
$<TARGET_OBJECTS:gamut_core_objects>)
|
|
128
|
+
target_include_directories(core_writer_reader_tests PRIVATE
|
|
129
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ${HDF5_INCLUDE_DIRS})
|
|
130
|
+
target_compile_definitions(core_writer_reader_tests PRIVATE ${HDF5_DEFINITIONS} ${GAMUT_OWN_HDF5})
|
|
131
|
+
target_compile_options(core_writer_reader_tests PRIVATE ${GAMUT_WARNINGS}
|
|
132
|
+
${GAMUT_FP_FLAGS} ${GAMUT_SANITIZER_FLAGS})
|
|
133
|
+
target_link_libraries(core_writer_reader_tests PRIVATE ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES}
|
|
134
|
+
ZLIB::ZLIB Threads::Threads)
|
|
135
|
+
add_test(NAME core_writer_reader_tests COMMAND core_writer_reader_tests
|
|
136
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
137
|
+
# The C++ interface, linked to the shared library as a program using it is.
|
|
138
|
+
add_executable(header_tests tests/header_tests.cpp)
|
|
139
|
+
target_include_directories(header_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
140
|
+
target_compile_options(header_tests PRIVATE ${GAMUT_WARNINGS} ${GAMUT_SANITIZER_FLAGS})
|
|
141
|
+
target_link_libraries(header_tests PRIVATE gamut)
|
|
142
|
+
add_test(NAME header_tests COMMAND header_tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
143
|
+
endif()
|
|
144
|
+
|
|
145
|
+
# Installing. A Python wheel (scikit-build-core) takes the library alone,
|
|
146
|
+
# beside the package; otherwise the header, the library and a CMake package
|
|
147
|
+
# (find_package(gamut) gives gamut::gamut). Linked to a shared HDF5
|
|
148
|
+
# outside the install (a source build), the library keeps the path to it.
|
|
149
|
+
set_target_properties(gamut PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
150
|
+
if(SKBUILD)
|
|
151
|
+
# On Windows the import library (gamut.lib) goes too, so MATLAB's gateway
|
|
152
|
+
# can be built against the wheel's core.
|
|
153
|
+
install(TARGETS gamut LIBRARY DESTINATION gamut/_native RUNTIME DESTINATION gamut/_native
|
|
154
|
+
ARCHIVE DESTINATION gamut/_native)
|
|
155
|
+
else()
|
|
156
|
+
include(GNUInstallDirs)
|
|
157
|
+
include(CMakePackageConfigHelpers)
|
|
158
|
+
target_include_directories(gamut INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
159
|
+
install(TARGETS gamut EXPORT gamutTargets
|
|
160
|
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
161
|
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
162
|
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
163
|
+
install(FILES include/gamut/gamut.h include/gamut/gamut.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gamut)
|
|
164
|
+
install(EXPORT gamutTargets NAMESPACE gamut::
|
|
165
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gamut)
|
|
166
|
+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gamutConfig.cmake.in
|
|
167
|
+
"@PACKAGE_INIT@\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/gamutTargets.cmake\")\n")
|
|
168
|
+
configure_package_config_file(${CMAKE_CURRENT_BINARY_DIR}/gamutConfig.cmake.in
|
|
169
|
+
${CMAKE_CURRENT_BINARY_DIR}/gamutConfig.cmake
|
|
170
|
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gamut)
|
|
171
|
+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/gamutConfigVersion.cmake
|
|
172
|
+
COMPATIBILITY SameMajorVersion)
|
|
173
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gamutConfig.cmake
|
|
174
|
+
${CMAKE_CURRENT_BINARY_DIR}/gamutConfigVersion.cmake
|
|
175
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gamut)
|
|
176
|
+
endif()
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
The [specification](SPEC.md) and the [corpus](corpus) define Gamut. The
|
|
4
|
+
C++ core in `src/` implements them once; Python, MATLAB, Julia and the C++
|
|
5
|
+
header are thin layers over its C interface. A change of behaviour starts from the
|
|
6
|
+
specification and the corpus, never from one language.
|
|
7
|
+
|
|
8
|
+
## A bug
|
|
9
|
+
|
|
10
|
+
Describe what happened and what you expected, with the smallest file or
|
|
11
|
+
script that shows it, and the output of `gamut --version`. A fix comes
|
|
12
|
+
with a test at the layer that owns the problem: the core's tests for the
|
|
13
|
+
core, the language's tests for its layer, the corpus for anything every
|
|
14
|
+
language must agree on.
|
|
15
|
+
|
|
16
|
+
## A change to the format
|
|
17
|
+
|
|
18
|
+
Open an issue first, with:
|
|
19
|
+
|
|
20
|
+
1. a real study or workflow that the format cannot hold today;
|
|
21
|
+
2. the meaning proposed, and what readers that do not know it will do;
|
|
22
|
+
3. whether it is an addition within version 1 (SPEC.md section 17: a
|
|
23
|
+
reader that does not know it reports W5 and goes on) or needs a new
|
|
24
|
+
major version;
|
|
25
|
+
4. the corpus cases that pin it.
|
|
26
|
+
|
|
27
|
+
The specification, the corpus and the core change together.
|
|
28
|
+
|
|
29
|
+
## Building and running the checks
|
|
30
|
+
|
|
31
|
+
The core needs CMake 3.16 or later, a C++17 compiler and HDF5 1.12 or
|
|
32
|
+
later (or `tools/build_deps.sh` and `-DGAMUT_STATIC_HDF5=ON`, as in
|
|
33
|
+
[installing](docs/install.md)). From the top of a checkout:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cmake -S . -B build -DHDF5_ROOT=/path/to/hdf5
|
|
37
|
+
cmake --build build -j2
|
|
38
|
+
./build/core_unit_tests && ./build/core_writer_reader_tests
|
|
39
|
+
(cd build && ./header_tests)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Python finds the core in `build/` when run from the checkout:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install numpy pytest h5py pint xarray netCDF4 pyvista pandas
|
|
46
|
+
cd python && python -m pytest -q tests
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The tests also run every script in `examples/`, check that each page of
|
|
50
|
+
`docs/guide/` quotes its example and shows what it prints, run the
|
|
51
|
+
command-line page's sessions, and build the C example. Change an example
|
|
52
|
+
and its page together.
|
|
53
|
+
|
|
54
|
+
Julia's tests, and the corpus from Python and Julia (the Julia check needs
|
|
55
|
+
the JSON package in its environment):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
julia --project=julia -e 'include("julia/test/runtests.jl")'
|
|
59
|
+
python corpus/generate.py /tmp/corpus
|
|
60
|
+
GAMUT_LIBRARY=build/libgamut.so python corpus/check.py /tmp/corpus
|
|
61
|
+
julia --project=<an environment with JSON and Gamut> julia/test/check_corpus.jl /tmp/corpus
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
In MATLAB, from `matlab/`: `build_mex`, then `run_tests`, then
|
|
65
|
+
`corpus='/tmp/corpus'; run('tests/check_corpus.m')`.
|
|
66
|
+
|
|
67
|
+
`tools/damaged_files.py` measures how readers meet damaged files, and
|
|
68
|
+
`bench/` holds the benchmarks (`bench/figures.py` rebuilds the benchmark
|
|
69
|
+
page's tables and figures from `bench/results/`).
|
|
70
|
+
|
|
71
|
+
## Style
|
|
72
|
+
|
|
73
|
+
Code reads like the code around it: plain names, few comments, each
|
|
74
|
+
saying why. Messages say what is wrong and what to do, with the rule
|
|
75
|
+
(`E7`) when one applies. Documentation is short and tested where it can
|
|
76
|
+
be.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|