blastingpy 0.1.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.
Files changed (98) hide show
  1. blastingpy-0.1.0/.github/workflows/release.yml +50 -0
  2. blastingpy-0.1.0/.github/workflows/tests.yml +55 -0
  3. blastingpy-0.1.0/.gitignore +52 -0
  4. blastingpy-0.1.0/CITATION.cff +27 -0
  5. blastingpy-0.1.0/CMakeLists.txt +119 -0
  6. blastingpy-0.1.0/LICENSE +21 -0
  7. blastingpy-0.1.0/PKG-INFO +810 -0
  8. blastingpy-0.1.0/README.es.md +387 -0
  9. blastingpy-0.1.0/README.md +382 -0
  10. blastingpy-0.1.0/bindings/bindings.cpp +427 -0
  11. blastingpy-0.1.0/examples/01-site-law-and-compliance/README.md +26 -0
  12. blastingpy-0.1.0/examples/01-site-law-and-compliance/site_law.py +43 -0
  13. blastingpy-0.1.0/examples/02-waveform-to-events/README.md +24 -0
  14. blastingpy-0.1.0/examples/02-waveform-to-events/waveform_to_events.py +67 -0
  15. blastingpy-0.1.0/examples/03-airblast/README.md +24 -0
  16. blastingpy-0.1.0/examples/03-airblast/airblast.py +51 -0
  17. blastingpy-0.1.0/examples/04-flyrock/README.md +18 -0
  18. blastingpy-0.1.0/examples/04-flyrock/flyrock.py +73 -0
  19. blastingpy-0.1.0/examples/05-nearfield/README.md +27 -0
  20. blastingpy-0.1.0/examples/05-nearfield/nearfield.py +113 -0
  21. blastingpy-0.1.0/include/blastingpy/airblast.hpp +44 -0
  22. blastingpy-0.1.0/include/blastingpy/attenuation.hpp +352 -0
  23. blastingpy-0.1.0/include/blastingpy/criteria_curve.hpp +114 -0
  24. blastingpy-0.1.0/include/blastingpy/flyrock.hpp +303 -0
  25. blastingpy-0.1.0/include/blastingpy/least_squares.hpp +128 -0
  26. blastingpy-0.1.0/include/blastingpy/method_info.hpp +23 -0
  27. blastingpy-0.1.0/include/blastingpy/nearfield.hpp +792 -0
  28. blastingpy-0.1.0/include/blastingpy/units.hpp +41 -0
  29. blastingpy-0.1.0/include/blastingpy/validation.hpp +69 -0
  30. blastingpy-0.1.0/include/blastingpy/waveform.hpp +234 -0
  31. blastingpy-0.1.0/pyproject.toml +74 -0
  32. blastingpy-0.1.0/python/blastingpy/__init__.py +17 -0
  33. blastingpy-0.1.0/python/blastingpy/airblast.py +377 -0
  34. blastingpy-0.1.0/python/blastingpy/airblast_data/equations.json +308 -0
  35. blastingpy-0.1.0/python/blastingpy/airblast_data/limits.json +57 -0
  36. blastingpy-0.1.0/python/blastingpy/attenuation.py +97 -0
  37. blastingpy-0.1.0/python/blastingpy/criteria.py +505 -0
  38. blastingpy-0.1.0/python/blastingpy/datasets.py +126 -0
  39. blastingpy-0.1.0/python/blastingpy/events.py +310 -0
  40. blastingpy-0.1.0/python/blastingpy/flyrock.py +416 -0
  41. blastingpy-0.1.0/python/blastingpy/io.py +1061 -0
  42. blastingpy-0.1.0/python/blastingpy/nearfield.py +735 -0
  43. blastingpy-0.1.0/python/blastingpy/plotting.py +198 -0
  44. blastingpy-0.1.0/python/blastingpy/profiles/bs_7385_2_1993.json +56 -0
  45. blastingpy-0.1.0/python/blastingpy/profiles/din_4150_3_2016.json +53 -0
  46. blastingpy-0.1.0/python/blastingpy/profiles/osmre_30cfr816_67.json +37 -0
  47. blastingpy-0.1.0/python/blastingpy/profiles/pe_mem_1995.json +37 -0
  48. blastingpy-0.1.0/python/blastingpy/profiles/usbm_ri8507_1980.json +85 -0
  49. blastingpy-0.1.0/python/blastingpy/py.typed +0 -0
  50. blastingpy-0.1.0/python/blastingpy/templates/events_template.csv +3 -0
  51. blastingpy-0.1.0/python/blastingpy/units.py +51 -0
  52. blastingpy-0.1.0/python/blastingpy/waveform.py +303 -0
  53. blastingpy-0.1.0/requirements-dev.txt +51 -0
  54. blastingpy-0.1.0/tests/cpp/test_airblast.cpp +62 -0
  55. blastingpy-0.1.0/tests/cpp/test_attenuation_fit.cpp +323 -0
  56. blastingpy-0.1.0/tests/cpp/test_attenuation_inverse.cpp +226 -0
  57. blastingpy-0.1.0/tests/cpp/test_criteria_curve.cpp +145 -0
  58. blastingpy-0.1.0/tests/cpp/test_flyrock_ballistics.cpp +113 -0
  59. blastingpy-0.1.0/tests/cpp/test_flyrock_models.cpp +112 -0
  60. blastingpy-0.1.0/tests/cpp/test_least_squares.cpp +105 -0
  61. blastingpy-0.1.0/tests/cpp/test_nearfield_column.cpp +138 -0
  62. blastingpy-0.1.0/tests/cpp/test_nearfield_heelan.cpp +165 -0
  63. blastingpy-0.1.0/tests/cpp/test_nearfield_hp.cpp +118 -0
  64. blastingpy-0.1.0/tests/cpp/test_nearfield_monte_carlo.cpp +158 -0
  65. blastingpy-0.1.0/tests/cpp/test_nearfield_superposition.cpp +279 -0
  66. blastingpy-0.1.0/tests/cpp/test_units.cpp +69 -0
  67. blastingpy-0.1.0/tests/cpp/test_validation.cpp +45 -0
  68. blastingpy-0.1.0/tests/cpp/test_waveform_derived.cpp +99 -0
  69. blastingpy-0.1.0/tests/cpp/test_waveform_peaks.cpp +98 -0
  70. blastingpy-0.1.0/tests/cpp/test_waveform_zero_crossing.cpp +142 -0
  71. blastingpy-0.1.0/tests/python/data/bivdep_example.csv +186 -0
  72. blastingpy-0.1.0/tests/python/test_airblast.py +339 -0
  73. blastingpy-0.1.0/tests/python/test_airblast_core.py +45 -0
  74. blastingpy-0.1.0/tests/python/test_airblast_limits.py +180 -0
  75. blastingpy-0.1.0/tests/python/test_attenuation.py +145 -0
  76. blastingpy-0.1.0/tests/python/test_attenuation_fit.py +111 -0
  77. blastingpy-0.1.0/tests/python/test_criteria.py +506 -0
  78. blastingpy-0.1.0/tests/python/test_criteria_curve.py +49 -0
  79. blastingpy-0.1.0/tests/python/test_criteria_invariants.py +105 -0
  80. blastingpy-0.1.0/tests/python/test_datasets.py +127 -0
  81. blastingpy-0.1.0/tests/python/test_events.py +365 -0
  82. blastingpy-0.1.0/tests/python/test_examples.py +105 -0
  83. blastingpy-0.1.0/tests/python/test_flyrock.py +261 -0
  84. blastingpy-0.1.0/tests/python/test_flyrock_core.py +70 -0
  85. blastingpy-0.1.0/tests/python/test_integration.py +52 -0
  86. blastingpy-0.1.0/tests/python/test_io_histogram_csv.py +389 -0
  87. blastingpy-0.1.0/tests/python/test_io_instantel.py +475 -0
  88. blastingpy-0.1.0/tests/python/test_io_obspy.py +155 -0
  89. blastingpy-0.1.0/tests/python/test_io_record.py +256 -0
  90. blastingpy-0.1.0/tests/python/test_least_squares.py +57 -0
  91. blastingpy-0.1.0/tests/python/test_nearfield.py +754 -0
  92. blastingpy-0.1.0/tests/python/test_nearfield_core.py +202 -0
  93. blastingpy-0.1.0/tests/python/test_package.py +47 -0
  94. blastingpy-0.1.0/tests/python/test_plotting.py +265 -0
  95. blastingpy-0.1.0/tests/python/test_units.py +48 -0
  96. blastingpy-0.1.0/tests/python/test_waveform.py +396 -0
  97. blastingpy-0.1.0/tests/python/test_waveform_core.py +88 -0
  98. blastingpy-0.1.0/tools/extraer_texto.py +63 -0
@@ -0,0 +1,50 @@
1
+ name: Build & publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build_wheels:
10
+ name: Wheels on ${{ matrix.os }}
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu-latest, windows-latest, macos-latest]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ # 3.x: cp314 sale por defecto; la configuración (versiones, pruebas de cada rueda) está en pyproject.toml
19
+ - uses: pypa/cibuildwheel@v3.4.1
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: wheels-${{ matrix.os }}
23
+ path: wheelhouse/*.whl
24
+
25
+ build_sdist:
26
+ name: Source distribution
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - run: pipx run build --sdist
31
+ - uses: actions/upload-artifact@v4
32
+ with:
33
+ name: sdist
34
+ path: dist/*.tar.gz
35
+
36
+ publish:
37
+ name: Publish to PyPI
38
+ needs: [build_wheels, build_sdist]
39
+ runs-on: ubuntu-latest
40
+ # solo con un tag v*; con workflow_dispatch construye y prueba las ruedas sin publicar
41
+ if: startsWith(github.ref, 'refs/tags/v')
42
+ environment: pypi
43
+ permissions:
44
+ id-token: write # trusted publishing (sin token en secrets)
45
+ steps:
46
+ - uses: actions/download-artifact@v4
47
+ with:
48
+ path: dist
49
+ merge-multiple: true
50
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,55 @@
1
+ name: Tests
2
+
3
+ # Repo privado: sin correr en cada push (la matriz gasta los minutos gratuitos). El pull request ya cubre lo que
4
+ # entra a main, así que no se corre otra vez al integrar.
5
+ on:
6
+ workflow_dispatch:
7
+ pull_request:
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ # Suite C++ en las tres plataformas, en Debug y Release por separado: la optimización puede mover la coma
15
+ # flotante y varias pruebas miran fronteras exactas de las tablas.
16
+ cpp:
17
+ name: C++ ${{ matrix.os }} / ${{ matrix.build_type }}
18
+ runs-on: ${{ matrix.os }}
19
+ timeout-minutes: 20
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ os: [ubuntu-latest, macos-latest, windows-latest]
24
+ build_type: [Debug, Release]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - name: Configurar
28
+ run: cmake -S . -B build -DBLASTINGPY_BUILD_TESTS=ON -DBLASTINGPY_BUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
29
+ - name: Compilar
30
+ run: cmake --build build --config ${{ matrix.build_type }} --parallel
31
+ - name: Ejecutar pruebas
32
+ run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure
33
+
34
+ # Suite Python contra la extensión compilada e instalada, con la versión mínima y la última estable.
35
+ python:
36
+ name: Python ${{ matrix.python }} / ${{ matrix.os }}
37
+ runs-on: ${{ matrix.os }}
38
+ timeout-minutes: 20
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ os: [ubuntu-latest, macos-latest, windows-latest]
43
+ python: ["3.10", "3.13"]
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: actions/setup-python@v5
47
+ with:
48
+ python-version: ${{ matrix.python }}
49
+ - name: Instalar el paquete con todos sus extras
50
+ run: python -m pip install --upgrade pip && python -m pip install ".[test,io,viz]"
51
+ # ObsPy no tiene ruedas en toda plataforma: donde falte, la prueba de miniSEED/SAC se omite sola.
52
+ - name: Instalar ObsPy si hay rueda
53
+ run: python -m pip install obspy || echo "obspy no disponible en esta plataforma"
54
+ - name: Ejecutar la suite
55
+ run: python -m pytest tests/python -q
@@ -0,0 +1,52 @@
1
+ # Build artifacts
2
+ build/
3
+ build-tests/
4
+ build-release/
5
+ _build/
6
+ dist/
7
+ wheelhouse/
8
+ *.egg-info/
9
+ *.so
10
+ *.pyd
11
+ *.dll
12
+
13
+ # CMake
14
+ CMakeFiles/
15
+ CMakeCache.txt
16
+ cmake_install.cmake
17
+ compile_commands.json
18
+
19
+ # Python caches and virtual environments
20
+ __pycache__/
21
+ *.pyc
22
+ .pytest_cache/
23
+ .hypothesis/
24
+ .mypy_cache/
25
+ .ruff_cache/
26
+ .venv/
27
+ venv/
28
+ env/
29
+
30
+ # IDE and editor state
31
+ .vs/
32
+ .vscode/
33
+ .idea/
34
+ *.sln
35
+ *.vcxproj*
36
+
37
+ # Internal working notes (not part of the published repository)
38
+ .claude/
39
+ .superpowers/
40
+
41
+ # OS files
42
+ .DS_Store
43
+ Thumbs.db
44
+
45
+ # Documentos de terceros (derechos de autor): viven en OneDrive, TRABAJOS\_Tableros\BlastingPy\referencias
46
+ docs/referencias/
47
+
48
+ # Research material kept only on the owner's machines (copyright or pending attribution)
49
+ docs/investigacion/pdfs/
50
+ docs/investigacion/papers/
51
+ docs/investigacion/img/
52
+ docs/investigacion/datos_publicos/
@@ -0,0 +1,27 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use BlastingPy in your work, please cite it as below."
3
+ type: software
4
+ title: "BlastingPy: blast vibration, airblast, flyrock and near-field analysis for mining"
5
+ abstract: >-
6
+ Open-source blasting effects library for mining: event records and per-country damage criteria, site attenuation
7
+ laws, waveform analysis and signature-hole superposition, airblast, flyrock range and clearance, and near-field
8
+ vibration (Holmberg-Persson and Heelan models). C++20 core with a Python API. Every result records the method and
9
+ the source it follows.
10
+ authors:
11
+ - family-names: "Quintanilla Ventura"
12
+ given-names: "Miqueas"
13
+ email: "miqueasq@gmail.com"
14
+ version: "0.1.0"
15
+ date-released: "2026-11-14"
16
+ license: MIT
17
+ repository-code: "https://github.com/Miqueas7/BlastingPy"
18
+ url: "https://miqueas.dev/blastingpy"
19
+ keywords:
20
+ - mining
21
+ - blasting
22
+ - ground vibration
23
+ - PPV
24
+ - airblast
25
+ - flyrock
26
+ - scaled distance
27
+ - near field
@@ -0,0 +1,119 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ project(blastingpy
3
+ VERSION 0.1.0
4
+ DESCRIPTION "Blast vibration, airblast and flyrock analysis for mining"
5
+ LANGUAGES CXX
6
+ )
7
+
8
+ set(CMAKE_CXX_STANDARD 20)
9
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
10
+ set(CMAKE_CXX_EXTENSIONS OFF)
11
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
12
+
13
+ # Núcleo header-only (interfaz)
14
+ add_library(blastingpy_core INTERFACE)
15
+ target_include_directories(blastingpy_core INTERFACE
16
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
17
+ $<INSTALL_INTERFACE:include>
18
+ )
19
+ target_compile_features(blastingpy_core INTERFACE cxx_std_20)
20
+ # MSVC lee el código como UTF-8 (las cabeceras llevan α, ≤ y rayas en comentarios y textos)
21
+ target_compile_options(blastingpy_core INTERFACE $<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
22
+
23
+ # Bindings Python (nanobind vía scikit-build-core)
24
+ option(BLASTINGPY_BUILD_PYTHON "Build Python bindings" ON)
25
+
26
+ if(BLASTINGPY_BUILD_PYTHON)
27
+ find_package(Python 3.10
28
+ REQUIRED COMPONENTS Interpreter Development.Module
29
+ OPTIONAL_COMPONENTS Development.SABIModule
30
+ )
31
+
32
+ execute_process(
33
+ COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
34
+ OUTPUT_STRIP_TRAILING_WHITESPACE
35
+ OUTPUT_VARIABLE NB_DIR
36
+ RESULT_VARIABLE NB_RESULT
37
+ )
38
+
39
+ if(NB_RESULT EQUAL 0 AND EXISTS "${NB_DIR}")
40
+ list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
41
+ find_package(nanobind CONFIG REQUIRED)
42
+
43
+ nanobind_add_module(_blastingpy_core
44
+ STABLE_ABI
45
+ NB_STATIC
46
+ bindings/bindings.cpp
47
+ )
48
+ target_link_libraries(_blastingpy_core PRIVATE blastingpy_core)
49
+
50
+ install(TARGETS _blastingpy_core
51
+ LIBRARY DESTINATION blastingpy
52
+ RUNTIME DESTINATION blastingpy
53
+ ARCHIVE DESTINATION blastingpy
54
+ )
55
+
56
+ # Stubs .pyi para editores y mypy; se generan al instalar (la ruta es relativa al prefijo del wheel).
57
+ # python/blastingpy/py.typed marca el paquete como tipado.
58
+ nanobind_add_stub(_blastingpy_core_stub
59
+ MODULE _blastingpy_core
60
+ OUTPUT blastingpy/_blastingpy_core.pyi
61
+ PYTHON_PATH blastingpy
62
+ INSTALL_TIME
63
+ )
64
+ else()
65
+ message(FATAL_ERROR
66
+ "nanobind not found, so the Python package would be incomplete.\n"
67
+ "Install with: pip install nanobind"
68
+ )
69
+ endif()
70
+ endif()
71
+
72
+ # Pruebas C++ (Google Test)
73
+ option(BLASTINGPY_BUILD_TESTS "Build C++ unit tests" OFF)
74
+
75
+ if(BLASTINGPY_BUILD_TESTS)
76
+ enable_testing()
77
+
78
+ include(FetchContent)
79
+ FetchContent_Declare(
80
+ googletest
81
+ URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
82
+ )
83
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
84
+ FetchContent_MakeAvailable(googletest)
85
+
86
+ # Cada tarea agrega aquí su archivo de pruebas
87
+ add_executable(blastingpy_tests
88
+ tests/cpp/test_validation.cpp
89
+ tests/cpp/test_units.cpp
90
+ tests/cpp/test_airblast.cpp
91
+ tests/cpp/test_least_squares.cpp
92
+ tests/cpp/test_attenuation_fit.cpp
93
+ tests/cpp/test_attenuation_inverse.cpp
94
+ tests/cpp/test_criteria_curve.cpp
95
+ tests/cpp/test_waveform_peaks.cpp
96
+ tests/cpp/test_waveform_zero_crossing.cpp
97
+ tests/cpp/test_waveform_derived.cpp
98
+ tests/cpp/test_flyrock_ballistics.cpp
99
+ tests/cpp/test_flyrock_models.cpp
100
+ tests/cpp/test_nearfield_hp.cpp
101
+ tests/cpp/test_nearfield_heelan.cpp
102
+ tests/cpp/test_nearfield_column.cpp
103
+ tests/cpp/test_nearfield_superposition.cpp
104
+ tests/cpp/test_nearfield_monte_carlo.cpp
105
+ )
106
+ target_link_libraries(blastingpy_tests PRIVATE
107
+ blastingpy_core
108
+ GTest::gtest_main
109
+ )
110
+ # Avisos del compilador solo en las pruebas (sin tratarlos como errores)
111
+ target_compile_options(blastingpy_tests PRIVATE
112
+ $<$<CXX_COMPILER_ID:MSVC>:/W4>
113
+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall>
114
+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wextra>
115
+ )
116
+
117
+ include(GoogleTest)
118
+ gtest_discover_tests(blastingpy_tests)
119
+ endif()
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Miqueas Quintanilla Ventura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.