From 790eb41a2601340bbe909cc118b4ea071899ce0f Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Fri, 14 Jul 2023 16:40:57 +0200 Subject: [PATCH 01/60] Switch to pyproject build structure --- CMakeLists.txt | 2 +- cpp_src/CMakeLists.txt | 53 +++++++++++++++++ {src/lasp => cpp_src}/device/CMakeLists.txt | 0 {src/lasp => cpp_src}/device/lasp_daq.cpp | 0 {src/lasp => cpp_src}/device/lasp_daq.h | 0 .../device/lasp_daqconfig.cpp | 0 {src/lasp => cpp_src}/device/lasp_daqconfig.h | 0 {src/lasp => cpp_src}/device/lasp_daqdata.cpp | 0 {src/lasp => cpp_src}/device/lasp_daqdata.h | 0 .../device/lasp_deviceinfo.cpp | 0 .../lasp => cpp_src}/device/lasp_deviceinfo.h | 0 .../device/lasp_indatahandler.cpp | 0 .../device/lasp_indatahandler.h | 0 .../device/lasp_rtaudiodaq.cpp | 0 .../lasp => cpp_src}/device/lasp_rtaudiodaq.h | 0 .../device/lasp_streammgr.cpp | 0 {src/lasp => cpp_src}/device/lasp_streammgr.h | 0 {src/lasp => cpp_src}/device/lasp_uldaq.cpp | 0 {src/lasp => cpp_src}/device/lasp_uldaq.h | 0 .../device/portaudio/lasp_portaudiodaq.cpp | 0 .../device/portaudio/lasp_portaudiodaq.h | 0 .../device/uldaq/lasp_uldaq_bufhandler.cpp | 0 .../device/uldaq/lasp_uldaq_bufhandler.h | 0 .../device/uldaq/lasp_uldaq_common.cpp | 0 .../device/uldaq/lasp_uldaq_common.h | 0 .../device/uldaq/lasp_uldaq_impl.cpp | 0 .../device/uldaq/lasp_uldaq_impl.h | 0 {src/lasp => cpp_src}/dsp/CMakeLists.txt | 0 .../dsp/lasp_avpowerspectra.cpp | 0 .../dsp/lasp_avpowerspectra.h | 0 {src/lasp => cpp_src}/dsp/lasp_biquadbank.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_biquadbank.h | 0 {src/lasp => cpp_src}/dsp/lasp_clip.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_clip.h | 0 {src/lasp => cpp_src}/dsp/lasp_fft.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_fft.h | 0 {src/lasp => cpp_src}/dsp/lasp_filter.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_filter.h | 0 {src/lasp => cpp_src}/dsp/lasp_mathtypes.h | 0 {src/lasp => cpp_src}/dsp/lasp_ppm.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_ppm.h | 0 {src/lasp => cpp_src}/dsp/lasp_rtaps.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_rtaps.h | 0 .../dsp/lasp_rtsignalviewer.cpp | 0 .../dsp/lasp_rtsignalviewer.h | 0 {src/lasp => cpp_src}/dsp/lasp_siggen.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_siggen.h | 0 .../lasp => cpp_src}/dsp/lasp_siggen_impl.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_siggen_impl.h | 0 {src/lasp => cpp_src}/dsp/lasp_slm.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_slm.h | 0 {src/lasp => cpp_src}/dsp/lasp_thread.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_thread.h | 0 .../dsp/lasp_threadedindatahandler.cpp | 0 .../dsp/lasp_threadedindatahandler.h | 0 {src/lasp => cpp_src}/dsp/lasp_timebuffer.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_timebuffer.h | 0 {src/lasp => cpp_src}/dsp/lasp_types.h | 0 {src/lasp => cpp_src}/dsp/lasp_window.cpp | 0 {src/lasp => cpp_src}/dsp/lasp_window.h | 0 {src/lasp => cpp_src}/lasp_config.h.in | 0 {src/lasp => cpp_src}/lasp_cpp.cpp | 0 {src/lasp => cpp_src}/pybind11/arma_npy.h | 0 {src/lasp => cpp_src}/pybind11/lasp_daq.cpp | 0 .../pybind11/lasp_daqconfig.cpp | 0 .../pybind11/lasp_deviceinfo.cpp | 0 .../pybind11/lasp_dsp_pybind.cpp | 0 .../pybind11/lasp_pyindatahandler.cpp | 0 .../lasp => cpp_src}/pybind11/lasp_siggen.cpp | 0 .../pybind11/lasp_streammgr.cpp | 0 pyproject.toml | 43 ++++++++++++++ {src => python_src}/lasp/__init__.py | 0 {src => python_src}/lasp/filter/__init__.py | 0 {src => python_src}/lasp/filter/biquad.py | 0 .../lasp/filter/colorednoise.py | 0 .../lasp/filter/decimation_fir.py | 0 .../lasp/filter/filterbank_design.py | 0 {src => python_src}/lasp/filter/fir_design.py | 0 .../lasp/filter/soundpressureweighting.py | 0 {src => python_src}/lasp/lasp_atomic.py | 0 {src => python_src}/lasp/lasp_common.py | 0 {src => python_src}/lasp/lasp_config.py | 0 {src => python_src}/lasp/lasp_daqconfigs.py | 0 {src => python_src}/lasp/lasp_imptube.py | 0 {src => python_src}/lasp/lasp_logging.py | 0 {src => python_src}/lasp/lasp_measurement.py | 0 .../lasp/lasp_measurementset.py | 0 {src => python_src}/lasp/lasp_octavefilter.py | 0 {src => python_src}/lasp/lasp_playback.py | 0 {src => python_src}/lasp/lasp_record.py | 0 {src => python_src}/lasp/lasp_reverb.py | 0 {src => python_src}/lasp/lasp_slm.py | 0 {src => python_src}/lasp/lasp_weighcal.py | 0 {src => python_src}/lasp/plot/__init__.py | 0 {src => python_src}/lasp/plot/bar.py | 0 {src => python_src}/lasp/tools/__init__.py | 0 {src => python_src}/lasp/tools/tools.py | 0 setup.py | 58 ------------------- src/lasp/CMakeLists.txt | 40 ------------- 99 files changed, 97 insertions(+), 99 deletions(-) create mode 100644 cpp_src/CMakeLists.txt rename {src/lasp => cpp_src}/device/CMakeLists.txt (100%) rename {src/lasp => cpp_src}/device/lasp_daq.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_daq.h (100%) rename {src/lasp => cpp_src}/device/lasp_daqconfig.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_daqconfig.h (100%) rename {src/lasp => cpp_src}/device/lasp_daqdata.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_daqdata.h (100%) rename {src/lasp => cpp_src}/device/lasp_deviceinfo.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_deviceinfo.h (100%) rename {src/lasp => cpp_src}/device/lasp_indatahandler.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_indatahandler.h (100%) rename {src/lasp => cpp_src}/device/lasp_rtaudiodaq.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_rtaudiodaq.h (100%) rename {src/lasp => cpp_src}/device/lasp_streammgr.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_streammgr.h (100%) rename {src/lasp => cpp_src}/device/lasp_uldaq.cpp (100%) rename {src/lasp => cpp_src}/device/lasp_uldaq.h (100%) rename {src/lasp => cpp_src}/device/portaudio/lasp_portaudiodaq.cpp (100%) rename {src/lasp => cpp_src}/device/portaudio/lasp_portaudiodaq.h (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_bufhandler.cpp (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_bufhandler.h (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_common.cpp (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_common.h (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_impl.cpp (100%) rename {src/lasp => cpp_src}/device/uldaq/lasp_uldaq_impl.h (100%) rename {src/lasp => cpp_src}/dsp/CMakeLists.txt (100%) rename {src/lasp => cpp_src}/dsp/lasp_avpowerspectra.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_avpowerspectra.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_biquadbank.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_biquadbank.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_clip.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_clip.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_fft.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_fft.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_filter.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_filter.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_mathtypes.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_ppm.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_ppm.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_rtaps.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_rtaps.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_rtsignalviewer.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_rtsignalviewer.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_siggen.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_siggen.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_siggen_impl.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_siggen_impl.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_slm.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_slm.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_thread.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_thread.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_threadedindatahandler.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_threadedindatahandler.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_timebuffer.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_timebuffer.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_types.h (100%) rename {src/lasp => cpp_src}/dsp/lasp_window.cpp (100%) rename {src/lasp => cpp_src}/dsp/lasp_window.h (100%) rename {src/lasp => cpp_src}/lasp_config.h.in (100%) rename {src/lasp => cpp_src}/lasp_cpp.cpp (100%) rename {src/lasp => cpp_src}/pybind11/arma_npy.h (100%) rename {src/lasp => cpp_src}/pybind11/lasp_daq.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_daqconfig.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_deviceinfo.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_dsp_pybind.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_pyindatahandler.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_siggen.cpp (100%) rename {src/lasp => cpp_src}/pybind11/lasp_streammgr.cpp (100%) create mode 100644 pyproject.toml rename {src => python_src}/lasp/__init__.py (100%) rename {src => python_src}/lasp/filter/__init__.py (100%) rename {src => python_src}/lasp/filter/biquad.py (100%) rename {src => python_src}/lasp/filter/colorednoise.py (100%) rename {src => python_src}/lasp/filter/decimation_fir.py (100%) rename {src => python_src}/lasp/filter/filterbank_design.py (100%) rename {src => python_src}/lasp/filter/fir_design.py (100%) rename {src => python_src}/lasp/filter/soundpressureweighting.py (100%) rename {src => python_src}/lasp/lasp_atomic.py (100%) rename {src => python_src}/lasp/lasp_common.py (100%) rename {src => python_src}/lasp/lasp_config.py (100%) rename {src => python_src}/lasp/lasp_daqconfigs.py (100%) rename {src => python_src}/lasp/lasp_imptube.py (100%) rename {src => python_src}/lasp/lasp_logging.py (100%) rename {src => python_src}/lasp/lasp_measurement.py (100%) rename {src => python_src}/lasp/lasp_measurementset.py (100%) rename {src => python_src}/lasp/lasp_octavefilter.py (100%) rename {src => python_src}/lasp/lasp_playback.py (100%) rename {src => python_src}/lasp/lasp_record.py (100%) rename {src => python_src}/lasp/lasp_reverb.py (100%) rename {src => python_src}/lasp/lasp_slm.py (100%) rename {src => python_src}/lasp/lasp_weighcal.py (100%) rename {src => python_src}/lasp/plot/__init__.py (100%) rename {src => python_src}/lasp/plot/bar.py (100%) rename {src => python_src}/lasp/tools/__init__.py (100%) rename {src => python_src}/lasp/tools/tools.py (100%) delete mode 100644 setup.py delete mode 100644 src/lasp/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 382904d..92079d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ include(portaudio) include(uldaq) # add_definitions(-Dgsl_CONFIG_DEFAULTS_VERSION=1) -add_subdirectory(src/lasp) +add_subdirectory(cpp_src) if(LASP_BUILD_CPP_TESTS) add_subdirectory(test) endif() diff --git a/cpp_src/CMakeLists.txt b/cpp_src/CMakeLists.txt new file mode 100644 index 0000000..53f939e --- /dev/null +++ b/cpp_src/CMakeLists.txt @@ -0,0 +1,53 @@ +# src/lasp/CMakeLists.txt + +# Armadillo, don't build the wrapper lib, but instead directly link to +# openblas. +add_definitions(-DARMA_DONT_USE_WRAPPER) + +configure_file(lasp_config.h.in lasp_config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(SYSTEM + ${PROJECT_SOURCE_DIR}/third_party/armadillo-code/include) + +include_directories(${PROJECT_SOURCE_DIR}/third_party/DebugTrace-cpp/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/gsl-lite/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/tomlplusplus/include) +include_directories(${PROJECT_SOURCE_DIR}/third_party/thread-pool) + +if(LASP_HAS_RTAUDIO) + include_directories(${PROJECT_SOURCE_DIR}/third_party/rtaudio) +endif() +if(LASP_HAS_ULDAQ) + include_directories(${PROJECT_SOURCE_DIR}/third_party/uldaq/src) +endif() + +add_subdirectory(device) +add_subdirectory(dsp) + +pybind11_add_module(lasp_cpp MODULE lasp_cpp.cpp + pybind11/lasp_deviceinfo.cpp + pybind11/lasp_daqconfig.cpp + pybind11//lasp_dsp_pybind.cpp + pybind11/lasp_streammgr.cpp + pybind11/lasp_daq.cpp + pybind11/lasp_deviceinfo.cpp + pybind11/lasp_pyindatahandler.cpp + pybind11/lasp_siggen.cpp + ) + +target_link_libraries(lasp_cpp PRIVATE lasp_device_lib lasp_dsp_lib + ${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS} ${TARGET_OS_LINKLIBS}) + +# Install the Python module +install(TARGETS lasp_cpp + EXCLUDE_FROM_ALL + COMPONENT python_modules + DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME}) +# Install the debug file for the Python module (Windows only) +if (WIN32) + install(FILES $ + EXCLUDE_FROM_ALL + COMPONENT python_modules + DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME} + OPTIONAL) +endif() diff --git a/src/lasp/device/CMakeLists.txt b/cpp_src/device/CMakeLists.txt similarity index 100% rename from src/lasp/device/CMakeLists.txt rename to cpp_src/device/CMakeLists.txt diff --git a/src/lasp/device/lasp_daq.cpp b/cpp_src/device/lasp_daq.cpp similarity index 100% rename from src/lasp/device/lasp_daq.cpp rename to cpp_src/device/lasp_daq.cpp diff --git a/src/lasp/device/lasp_daq.h b/cpp_src/device/lasp_daq.h similarity index 100% rename from src/lasp/device/lasp_daq.h rename to cpp_src/device/lasp_daq.h diff --git a/src/lasp/device/lasp_daqconfig.cpp b/cpp_src/device/lasp_daqconfig.cpp similarity index 100% rename from src/lasp/device/lasp_daqconfig.cpp rename to cpp_src/device/lasp_daqconfig.cpp diff --git a/src/lasp/device/lasp_daqconfig.h b/cpp_src/device/lasp_daqconfig.h similarity index 100% rename from src/lasp/device/lasp_daqconfig.h rename to cpp_src/device/lasp_daqconfig.h diff --git a/src/lasp/device/lasp_daqdata.cpp b/cpp_src/device/lasp_daqdata.cpp similarity index 100% rename from src/lasp/device/lasp_daqdata.cpp rename to cpp_src/device/lasp_daqdata.cpp diff --git a/src/lasp/device/lasp_daqdata.h b/cpp_src/device/lasp_daqdata.h similarity index 100% rename from src/lasp/device/lasp_daqdata.h rename to cpp_src/device/lasp_daqdata.h diff --git a/src/lasp/device/lasp_deviceinfo.cpp b/cpp_src/device/lasp_deviceinfo.cpp similarity index 100% rename from src/lasp/device/lasp_deviceinfo.cpp rename to cpp_src/device/lasp_deviceinfo.cpp diff --git a/src/lasp/device/lasp_deviceinfo.h b/cpp_src/device/lasp_deviceinfo.h similarity index 100% rename from src/lasp/device/lasp_deviceinfo.h rename to cpp_src/device/lasp_deviceinfo.h diff --git a/src/lasp/device/lasp_indatahandler.cpp b/cpp_src/device/lasp_indatahandler.cpp similarity index 100% rename from src/lasp/device/lasp_indatahandler.cpp rename to cpp_src/device/lasp_indatahandler.cpp diff --git a/src/lasp/device/lasp_indatahandler.h b/cpp_src/device/lasp_indatahandler.h similarity index 100% rename from src/lasp/device/lasp_indatahandler.h rename to cpp_src/device/lasp_indatahandler.h diff --git a/src/lasp/device/lasp_rtaudiodaq.cpp b/cpp_src/device/lasp_rtaudiodaq.cpp similarity index 100% rename from src/lasp/device/lasp_rtaudiodaq.cpp rename to cpp_src/device/lasp_rtaudiodaq.cpp diff --git a/src/lasp/device/lasp_rtaudiodaq.h b/cpp_src/device/lasp_rtaudiodaq.h similarity index 100% rename from src/lasp/device/lasp_rtaudiodaq.h rename to cpp_src/device/lasp_rtaudiodaq.h diff --git a/src/lasp/device/lasp_streammgr.cpp b/cpp_src/device/lasp_streammgr.cpp similarity index 100% rename from src/lasp/device/lasp_streammgr.cpp rename to cpp_src/device/lasp_streammgr.cpp diff --git a/src/lasp/device/lasp_streammgr.h b/cpp_src/device/lasp_streammgr.h similarity index 100% rename from src/lasp/device/lasp_streammgr.h rename to cpp_src/device/lasp_streammgr.h diff --git a/src/lasp/device/lasp_uldaq.cpp b/cpp_src/device/lasp_uldaq.cpp similarity index 100% rename from src/lasp/device/lasp_uldaq.cpp rename to cpp_src/device/lasp_uldaq.cpp diff --git a/src/lasp/device/lasp_uldaq.h b/cpp_src/device/lasp_uldaq.h similarity index 100% rename from src/lasp/device/lasp_uldaq.h rename to cpp_src/device/lasp_uldaq.h diff --git a/src/lasp/device/portaudio/lasp_portaudiodaq.cpp b/cpp_src/device/portaudio/lasp_portaudiodaq.cpp similarity index 100% rename from src/lasp/device/portaudio/lasp_portaudiodaq.cpp rename to cpp_src/device/portaudio/lasp_portaudiodaq.cpp diff --git a/src/lasp/device/portaudio/lasp_portaudiodaq.h b/cpp_src/device/portaudio/lasp_portaudiodaq.h similarity index 100% rename from src/lasp/device/portaudio/lasp_portaudiodaq.h rename to cpp_src/device/portaudio/lasp_portaudiodaq.h diff --git a/src/lasp/device/uldaq/lasp_uldaq_bufhandler.cpp b/cpp_src/device/uldaq/lasp_uldaq_bufhandler.cpp similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_bufhandler.cpp rename to cpp_src/device/uldaq/lasp_uldaq_bufhandler.cpp diff --git a/src/lasp/device/uldaq/lasp_uldaq_bufhandler.h b/cpp_src/device/uldaq/lasp_uldaq_bufhandler.h similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_bufhandler.h rename to cpp_src/device/uldaq/lasp_uldaq_bufhandler.h diff --git a/src/lasp/device/uldaq/lasp_uldaq_common.cpp b/cpp_src/device/uldaq/lasp_uldaq_common.cpp similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_common.cpp rename to cpp_src/device/uldaq/lasp_uldaq_common.cpp diff --git a/src/lasp/device/uldaq/lasp_uldaq_common.h b/cpp_src/device/uldaq/lasp_uldaq_common.h similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_common.h rename to cpp_src/device/uldaq/lasp_uldaq_common.h diff --git a/src/lasp/device/uldaq/lasp_uldaq_impl.cpp b/cpp_src/device/uldaq/lasp_uldaq_impl.cpp similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_impl.cpp rename to cpp_src/device/uldaq/lasp_uldaq_impl.cpp diff --git a/src/lasp/device/uldaq/lasp_uldaq_impl.h b/cpp_src/device/uldaq/lasp_uldaq_impl.h similarity index 100% rename from src/lasp/device/uldaq/lasp_uldaq_impl.h rename to cpp_src/device/uldaq/lasp_uldaq_impl.h diff --git a/src/lasp/dsp/CMakeLists.txt b/cpp_src/dsp/CMakeLists.txt similarity index 100% rename from src/lasp/dsp/CMakeLists.txt rename to cpp_src/dsp/CMakeLists.txt diff --git a/src/lasp/dsp/lasp_avpowerspectra.cpp b/cpp_src/dsp/lasp_avpowerspectra.cpp similarity index 100% rename from src/lasp/dsp/lasp_avpowerspectra.cpp rename to cpp_src/dsp/lasp_avpowerspectra.cpp diff --git a/src/lasp/dsp/lasp_avpowerspectra.h b/cpp_src/dsp/lasp_avpowerspectra.h similarity index 100% rename from src/lasp/dsp/lasp_avpowerspectra.h rename to cpp_src/dsp/lasp_avpowerspectra.h diff --git a/src/lasp/dsp/lasp_biquadbank.cpp b/cpp_src/dsp/lasp_biquadbank.cpp similarity index 100% rename from src/lasp/dsp/lasp_biquadbank.cpp rename to cpp_src/dsp/lasp_biquadbank.cpp diff --git a/src/lasp/dsp/lasp_biquadbank.h b/cpp_src/dsp/lasp_biquadbank.h similarity index 100% rename from src/lasp/dsp/lasp_biquadbank.h rename to cpp_src/dsp/lasp_biquadbank.h diff --git a/src/lasp/dsp/lasp_clip.cpp b/cpp_src/dsp/lasp_clip.cpp similarity index 100% rename from src/lasp/dsp/lasp_clip.cpp rename to cpp_src/dsp/lasp_clip.cpp diff --git a/src/lasp/dsp/lasp_clip.h b/cpp_src/dsp/lasp_clip.h similarity index 100% rename from src/lasp/dsp/lasp_clip.h rename to cpp_src/dsp/lasp_clip.h diff --git a/src/lasp/dsp/lasp_fft.cpp b/cpp_src/dsp/lasp_fft.cpp similarity index 100% rename from src/lasp/dsp/lasp_fft.cpp rename to cpp_src/dsp/lasp_fft.cpp diff --git a/src/lasp/dsp/lasp_fft.h b/cpp_src/dsp/lasp_fft.h similarity index 100% rename from src/lasp/dsp/lasp_fft.h rename to cpp_src/dsp/lasp_fft.h diff --git a/src/lasp/dsp/lasp_filter.cpp b/cpp_src/dsp/lasp_filter.cpp similarity index 100% rename from src/lasp/dsp/lasp_filter.cpp rename to cpp_src/dsp/lasp_filter.cpp diff --git a/src/lasp/dsp/lasp_filter.h b/cpp_src/dsp/lasp_filter.h similarity index 100% rename from src/lasp/dsp/lasp_filter.h rename to cpp_src/dsp/lasp_filter.h diff --git a/src/lasp/dsp/lasp_mathtypes.h b/cpp_src/dsp/lasp_mathtypes.h similarity index 100% rename from src/lasp/dsp/lasp_mathtypes.h rename to cpp_src/dsp/lasp_mathtypes.h diff --git a/src/lasp/dsp/lasp_ppm.cpp b/cpp_src/dsp/lasp_ppm.cpp similarity index 100% rename from src/lasp/dsp/lasp_ppm.cpp rename to cpp_src/dsp/lasp_ppm.cpp diff --git a/src/lasp/dsp/lasp_ppm.h b/cpp_src/dsp/lasp_ppm.h similarity index 100% rename from src/lasp/dsp/lasp_ppm.h rename to cpp_src/dsp/lasp_ppm.h diff --git a/src/lasp/dsp/lasp_rtaps.cpp b/cpp_src/dsp/lasp_rtaps.cpp similarity index 100% rename from src/lasp/dsp/lasp_rtaps.cpp rename to cpp_src/dsp/lasp_rtaps.cpp diff --git a/src/lasp/dsp/lasp_rtaps.h b/cpp_src/dsp/lasp_rtaps.h similarity index 100% rename from src/lasp/dsp/lasp_rtaps.h rename to cpp_src/dsp/lasp_rtaps.h diff --git a/src/lasp/dsp/lasp_rtsignalviewer.cpp b/cpp_src/dsp/lasp_rtsignalviewer.cpp similarity index 100% rename from src/lasp/dsp/lasp_rtsignalviewer.cpp rename to cpp_src/dsp/lasp_rtsignalviewer.cpp diff --git a/src/lasp/dsp/lasp_rtsignalviewer.h b/cpp_src/dsp/lasp_rtsignalviewer.h similarity index 100% rename from src/lasp/dsp/lasp_rtsignalviewer.h rename to cpp_src/dsp/lasp_rtsignalviewer.h diff --git a/src/lasp/dsp/lasp_siggen.cpp b/cpp_src/dsp/lasp_siggen.cpp similarity index 100% rename from src/lasp/dsp/lasp_siggen.cpp rename to cpp_src/dsp/lasp_siggen.cpp diff --git a/src/lasp/dsp/lasp_siggen.h b/cpp_src/dsp/lasp_siggen.h similarity index 100% rename from src/lasp/dsp/lasp_siggen.h rename to cpp_src/dsp/lasp_siggen.h diff --git a/src/lasp/dsp/lasp_siggen_impl.cpp b/cpp_src/dsp/lasp_siggen_impl.cpp similarity index 100% rename from src/lasp/dsp/lasp_siggen_impl.cpp rename to cpp_src/dsp/lasp_siggen_impl.cpp diff --git a/src/lasp/dsp/lasp_siggen_impl.h b/cpp_src/dsp/lasp_siggen_impl.h similarity index 100% rename from src/lasp/dsp/lasp_siggen_impl.h rename to cpp_src/dsp/lasp_siggen_impl.h diff --git a/src/lasp/dsp/lasp_slm.cpp b/cpp_src/dsp/lasp_slm.cpp similarity index 100% rename from src/lasp/dsp/lasp_slm.cpp rename to cpp_src/dsp/lasp_slm.cpp diff --git a/src/lasp/dsp/lasp_slm.h b/cpp_src/dsp/lasp_slm.h similarity index 100% rename from src/lasp/dsp/lasp_slm.h rename to cpp_src/dsp/lasp_slm.h diff --git a/src/lasp/dsp/lasp_thread.cpp b/cpp_src/dsp/lasp_thread.cpp similarity index 100% rename from src/lasp/dsp/lasp_thread.cpp rename to cpp_src/dsp/lasp_thread.cpp diff --git a/src/lasp/dsp/lasp_thread.h b/cpp_src/dsp/lasp_thread.h similarity index 100% rename from src/lasp/dsp/lasp_thread.h rename to cpp_src/dsp/lasp_thread.h diff --git a/src/lasp/dsp/lasp_threadedindatahandler.cpp b/cpp_src/dsp/lasp_threadedindatahandler.cpp similarity index 100% rename from src/lasp/dsp/lasp_threadedindatahandler.cpp rename to cpp_src/dsp/lasp_threadedindatahandler.cpp diff --git a/src/lasp/dsp/lasp_threadedindatahandler.h b/cpp_src/dsp/lasp_threadedindatahandler.h similarity index 100% rename from src/lasp/dsp/lasp_threadedindatahandler.h rename to cpp_src/dsp/lasp_threadedindatahandler.h diff --git a/src/lasp/dsp/lasp_timebuffer.cpp b/cpp_src/dsp/lasp_timebuffer.cpp similarity index 100% rename from src/lasp/dsp/lasp_timebuffer.cpp rename to cpp_src/dsp/lasp_timebuffer.cpp diff --git a/src/lasp/dsp/lasp_timebuffer.h b/cpp_src/dsp/lasp_timebuffer.h similarity index 100% rename from src/lasp/dsp/lasp_timebuffer.h rename to cpp_src/dsp/lasp_timebuffer.h diff --git a/src/lasp/dsp/lasp_types.h b/cpp_src/dsp/lasp_types.h similarity index 100% rename from src/lasp/dsp/lasp_types.h rename to cpp_src/dsp/lasp_types.h diff --git a/src/lasp/dsp/lasp_window.cpp b/cpp_src/dsp/lasp_window.cpp similarity index 100% rename from src/lasp/dsp/lasp_window.cpp rename to cpp_src/dsp/lasp_window.cpp diff --git a/src/lasp/dsp/lasp_window.h b/cpp_src/dsp/lasp_window.h similarity index 100% rename from src/lasp/dsp/lasp_window.h rename to cpp_src/dsp/lasp_window.h diff --git a/src/lasp/lasp_config.h.in b/cpp_src/lasp_config.h.in similarity index 100% rename from src/lasp/lasp_config.h.in rename to cpp_src/lasp_config.h.in diff --git a/src/lasp/lasp_cpp.cpp b/cpp_src/lasp_cpp.cpp similarity index 100% rename from src/lasp/lasp_cpp.cpp rename to cpp_src/lasp_cpp.cpp diff --git a/src/lasp/pybind11/arma_npy.h b/cpp_src/pybind11/arma_npy.h similarity index 100% rename from src/lasp/pybind11/arma_npy.h rename to cpp_src/pybind11/arma_npy.h diff --git a/src/lasp/pybind11/lasp_daq.cpp b/cpp_src/pybind11/lasp_daq.cpp similarity index 100% rename from src/lasp/pybind11/lasp_daq.cpp rename to cpp_src/pybind11/lasp_daq.cpp diff --git a/src/lasp/pybind11/lasp_daqconfig.cpp b/cpp_src/pybind11/lasp_daqconfig.cpp similarity index 100% rename from src/lasp/pybind11/lasp_daqconfig.cpp rename to cpp_src/pybind11/lasp_daqconfig.cpp diff --git a/src/lasp/pybind11/lasp_deviceinfo.cpp b/cpp_src/pybind11/lasp_deviceinfo.cpp similarity index 100% rename from src/lasp/pybind11/lasp_deviceinfo.cpp rename to cpp_src/pybind11/lasp_deviceinfo.cpp diff --git a/src/lasp/pybind11/lasp_dsp_pybind.cpp b/cpp_src/pybind11/lasp_dsp_pybind.cpp similarity index 100% rename from src/lasp/pybind11/lasp_dsp_pybind.cpp rename to cpp_src/pybind11/lasp_dsp_pybind.cpp diff --git a/src/lasp/pybind11/lasp_pyindatahandler.cpp b/cpp_src/pybind11/lasp_pyindatahandler.cpp similarity index 100% rename from src/lasp/pybind11/lasp_pyindatahandler.cpp rename to cpp_src/pybind11/lasp_pyindatahandler.cpp diff --git a/src/lasp/pybind11/lasp_siggen.cpp b/cpp_src/pybind11/lasp_siggen.cpp similarity index 100% rename from src/lasp/pybind11/lasp_siggen.cpp rename to cpp_src/pybind11/lasp_siggen.cpp diff --git a/src/lasp/pybind11/lasp_streammgr.cpp b/cpp_src/pybind11/lasp_streammgr.cpp similarity index 100% rename from src/lasp/pybind11/lasp_streammgr.cpp rename to cpp_src/pybind11/lasp_streammgr.cpp diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a07b3dc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[project] +name = "lasp" +readme = "README.md" +requires-python = ">=3.10" +description = "Library for Acoustic Signal Processing" +license = { "file" = "LICENSE" } +authors = [{ "name" = "J.A. de Jong", "email" = "j.a.dejong@ascee.nl" }] +dynamic = ["version"] + +keywords = ["DSP", "DAQ", "Signal processing"] + +classifiers = [ + "Development Status :: 3 - Alpha", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Topic :: Scientific/Engineering", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", +] +urls = { "Documentation" = "https://lasp.ascee.nl" } + +dependencies = ["scipy", "numpy", "matplotlib", "appdirs", "dataclasses_json", + "h5py", "pybind11"] + +[build-system] # How pip and other frontends should build this project +requires = ["py-build-cmake~=0.1.8", "setuptools-scm"] +build-backend = "py_build_cmake.build" + +[tool.py-build-cmake.module] # Where to find the Python module to package +directory = "python_src" + +[tool.py-build-cmake.sdist] # What to include in source distributions +include = ["CMakeLists.txt", "cmake", "cpp_src", "python_src", "img", "scripts", + "third_party"] + +[tool.py-build-cmake.cmake] # How to build the CMake project +build_type = "Release" +source_path = "." +build_args = ["-j"] +install_components = ["python_modules", "python_stubs"] diff --git a/src/lasp/__init__.py b/python_src/lasp/__init__.py similarity index 100% rename from src/lasp/__init__.py rename to python_src/lasp/__init__.py diff --git a/src/lasp/filter/__init__.py b/python_src/lasp/filter/__init__.py similarity index 100% rename from src/lasp/filter/__init__.py rename to python_src/lasp/filter/__init__.py diff --git a/src/lasp/filter/biquad.py b/python_src/lasp/filter/biquad.py similarity index 100% rename from src/lasp/filter/biquad.py rename to python_src/lasp/filter/biquad.py diff --git a/src/lasp/filter/colorednoise.py b/python_src/lasp/filter/colorednoise.py similarity index 100% rename from src/lasp/filter/colorednoise.py rename to python_src/lasp/filter/colorednoise.py diff --git a/src/lasp/filter/decimation_fir.py b/python_src/lasp/filter/decimation_fir.py similarity index 100% rename from src/lasp/filter/decimation_fir.py rename to python_src/lasp/filter/decimation_fir.py diff --git a/src/lasp/filter/filterbank_design.py b/python_src/lasp/filter/filterbank_design.py similarity index 100% rename from src/lasp/filter/filterbank_design.py rename to python_src/lasp/filter/filterbank_design.py diff --git a/src/lasp/filter/fir_design.py b/python_src/lasp/filter/fir_design.py similarity index 100% rename from src/lasp/filter/fir_design.py rename to python_src/lasp/filter/fir_design.py diff --git a/src/lasp/filter/soundpressureweighting.py b/python_src/lasp/filter/soundpressureweighting.py similarity index 100% rename from src/lasp/filter/soundpressureweighting.py rename to python_src/lasp/filter/soundpressureweighting.py diff --git a/src/lasp/lasp_atomic.py b/python_src/lasp/lasp_atomic.py similarity index 100% rename from src/lasp/lasp_atomic.py rename to python_src/lasp/lasp_atomic.py diff --git a/src/lasp/lasp_common.py b/python_src/lasp/lasp_common.py similarity index 100% rename from src/lasp/lasp_common.py rename to python_src/lasp/lasp_common.py diff --git a/src/lasp/lasp_config.py b/python_src/lasp/lasp_config.py similarity index 100% rename from src/lasp/lasp_config.py rename to python_src/lasp/lasp_config.py diff --git a/src/lasp/lasp_daqconfigs.py b/python_src/lasp/lasp_daqconfigs.py similarity index 100% rename from src/lasp/lasp_daqconfigs.py rename to python_src/lasp/lasp_daqconfigs.py diff --git a/src/lasp/lasp_imptube.py b/python_src/lasp/lasp_imptube.py similarity index 100% rename from src/lasp/lasp_imptube.py rename to python_src/lasp/lasp_imptube.py diff --git a/src/lasp/lasp_logging.py b/python_src/lasp/lasp_logging.py similarity index 100% rename from src/lasp/lasp_logging.py rename to python_src/lasp/lasp_logging.py diff --git a/src/lasp/lasp_measurement.py b/python_src/lasp/lasp_measurement.py similarity index 100% rename from src/lasp/lasp_measurement.py rename to python_src/lasp/lasp_measurement.py diff --git a/src/lasp/lasp_measurementset.py b/python_src/lasp/lasp_measurementset.py similarity index 100% rename from src/lasp/lasp_measurementset.py rename to python_src/lasp/lasp_measurementset.py diff --git a/src/lasp/lasp_octavefilter.py b/python_src/lasp/lasp_octavefilter.py similarity index 100% rename from src/lasp/lasp_octavefilter.py rename to python_src/lasp/lasp_octavefilter.py diff --git a/src/lasp/lasp_playback.py b/python_src/lasp/lasp_playback.py similarity index 100% rename from src/lasp/lasp_playback.py rename to python_src/lasp/lasp_playback.py diff --git a/src/lasp/lasp_record.py b/python_src/lasp/lasp_record.py similarity index 100% rename from src/lasp/lasp_record.py rename to python_src/lasp/lasp_record.py diff --git a/src/lasp/lasp_reverb.py b/python_src/lasp/lasp_reverb.py similarity index 100% rename from src/lasp/lasp_reverb.py rename to python_src/lasp/lasp_reverb.py diff --git a/src/lasp/lasp_slm.py b/python_src/lasp/lasp_slm.py similarity index 100% rename from src/lasp/lasp_slm.py rename to python_src/lasp/lasp_slm.py diff --git a/src/lasp/lasp_weighcal.py b/python_src/lasp/lasp_weighcal.py similarity index 100% rename from src/lasp/lasp_weighcal.py rename to python_src/lasp/lasp_weighcal.py diff --git a/src/lasp/plot/__init__.py b/python_src/lasp/plot/__init__.py similarity index 100% rename from src/lasp/plot/__init__.py rename to python_src/lasp/plot/__init__.py diff --git a/src/lasp/plot/bar.py b/python_src/lasp/plot/bar.py similarity index 100% rename from src/lasp/plot/bar.py rename to python_src/lasp/plot/bar.py diff --git a/src/lasp/tools/__init__.py b/python_src/lasp/tools/__init__.py similarity index 100% rename from src/lasp/tools/__init__.py rename to python_src/lasp/tools/__init__.py diff --git a/src/lasp/tools/tools.py b/python_src/lasp/tools/tools.py similarity index 100% rename from src/lasp/tools/tools.py rename to python_src/lasp/tools/tools.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 51982ec..0000000 --- a/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -import glob, os -import platform -from setuptools import setup - -pf = platform.platform() - -if 'Linux' in pf: - ext_name_glob = 'lasp_cpp.cpython*' - # Split of path from file. - extensions = list(glob.glob('src/lasp/' + ext_name_glob)) -elif 'Windows' in pf: - ext_name_glob = 'lasp_cpp*.cp*.pyd' - # Split of path from file. - extensions = list(glob.glob('src\\lasp/' + ext_name_glob)) -else: - raise RuntimeError('Not yet Windows-proof') - - - -print(extensions) -ext_names = [os.path.split(a)[1] for a in extensions] - -if len(extensions) == 0: - raise RuntimeError('Please first run CMake to build extension') -elif len(extensions) > 1: - raise RuntimeError('Too many extension files found') - -pkgdata = ext_names -classifiers = [ - "Topic :: Scientific/Engineering", - "Programming Language :: Python :: 3.8", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", -] - -keywords = ["DSP", "DAQ", "Signal processing"] - - -setup( - name="lasp", - version="1.0", - description="LASP: Library for Acoustic Signal Processing", - - author='J.A. de Jong (ASCEE / Redu-Sone)', - author_email='info@ascee.nl', - - url='https://www.ascee.nl/lasp', - classifiers=classifiers, - keywords=keywords, - license="MIT", - dependencies=["numpy", "scipy", "appdirs", "h5py", "appdirs", - "dataclasses_json"], - package_dir={"": "src"}, - packages=['lasp', 'lasp.filter', 'lasp.tools'], - include_package_data=True, - package_data={'lasp': pkgdata}, - python_requires='>=3.8', -) diff --git a/src/lasp/CMakeLists.txt b/src/lasp/CMakeLists.txt deleted file mode 100644 index 4ffef55..0000000 --- a/src/lasp/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# src/lasp/CMakeLists.txt - -# Armadillo -add_definitions(-DARMA_DONT_USE_WRAPPER) - -configure_file(lasp_config.h.in lasp_config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(SYSTEM - ${PROJECT_SOURCE_DIR}/third_party/armadillo-code/include) - -include_directories(../../third_party/DebugTrace-cpp/include) -include_directories(../../third_party/gsl-lite/include) -include_directories(../../third_party/tomlplusplus/include) -include_directories(../../third_party/thread-pool) - -if(LASP_HAS_RTAUDIO) - include_directories(../../third_party/rtaudio) -endif() -if(LASP_HAS_ULDAQ) - include_directories(../../third_party/uldaq/src) -endif() - -add_subdirectory(device) -add_subdirectory(dsp) - -pybind11_add_module(lasp_cpp MODULE lasp_cpp.cpp - pybind11/lasp_deviceinfo.cpp - pybind11/lasp_daqconfig.cpp - pybind11//lasp_dsp_pybind.cpp - pybind11/lasp_streammgr.cpp - pybind11/lasp_daq.cpp - pybind11/lasp_deviceinfo.cpp - pybind11/lasp_pyindatahandler.cpp - pybind11/lasp_siggen.cpp - ) - -target_link_libraries(lasp_cpp PRIVATE lasp_device_lib lasp_dsp_lib - ${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS} ${TARGET_OS_LINKLIBS}) - -install(TARGETS lasp_cpp DESTINATION .) From 72716ecd39092d07ea657e8a91ec4eb4e78735fa Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Fri, 14 Jul 2023 16:42:05 +0200 Subject: [PATCH 02/60] Updated .gitignore --- .gitignore | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 180b6d4..87c0172 100644 --- a/.gitignore +++ b/.gitignore @@ -15,14 +15,11 @@ CMakeFiles CMakeCache.txt cmake_install.cmake Makefile -build __pycache__ -cython_debug doc .ropeproject .ipynb_checkpoints .spyproject -.cache -_skbuild acme_log.log -testenv +.venv +.py-build-cmake_cache From 914da898197517dfc7905ddcde2ec02e23f61fde Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 18 Jul 2023 17:06:40 +0200 Subject: [PATCH 03/60] build(Testing): Not yet --- .pre-commit-config.yaml | 8 ++++++++ CMakeLists.txt | 1 - pyproject.toml | 7 +++++-- python_src/lasp/__init__.py | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2ca1bb7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +--- +repos: + - repo: https://github.com/commitizen-tools/commitizen + rev: master + hooks: + - id: commitizen + - id: commitizen-branch + stages: [push] diff --git a/CMakeLists.txt b/CMakeLists.txt index 92079d6..43173bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required (VERSION 3.16) project(LASP LANGUAGES C CXX VERSION 1.0) - set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED) diff --git a/pyproject.toml b/pyproject.toml index a07b3dc..fa45bde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = ["scipy", "numpy", "matplotlib", "appdirs", "dataclasses_json", "h5py", "pybind11"] [build-system] # How pip and other frontends should build this project -requires = ["py-build-cmake~=0.1.8", "setuptools-scm"] +requires = ["py-build-cmake~=0.1.8", "setuptools_scm[toml]>=6.2"] build-backend = "py_build_cmake.build" [tool.py-build-cmake.module] # Where to find the Python module to package @@ -40,4 +40,7 @@ include = ["CMakeLists.txt", "cmake", "cpp_src", "python_src", "img", "scripts", build_type = "Release" source_path = "." build_args = ["-j"] -install_components = ["python_modules", "python_stubs"] +install_components = ["python_modules"] + +[tool.setuptools_scm] +version_file = ["python_src/lasp/_version.py" , "cpp_src/_version.txt"] diff --git a/python_src/lasp/__init__.py b/python_src/lasp/__init__.py index b6f3e90..7cfbdc5 100644 --- a/python_src/lasp/__init__.py +++ b/python_src/lasp/__init__.py @@ -2,10 +2,10 @@ LASP: Library for Acoustic Signal Processing """ +from ._version import * from .lasp_cpp import * import lasp.lasp_cpp from .lasp_common import * -__version__ = lasp_cpp.__version__ # from .lasp_imptube import * # TwoMicImpedanceTube from .lasp_measurement import * # Measurement, scaleBlockSens From 9f81db8eeb800ff97833244567735bd571a6c346 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 18 Jul 2023 17:12:34 +0200 Subject: [PATCH 04/60] Bla --- cpp_src/lasp_config.h.in | 3 --- cpp_src/lasp_cpp.cpp | 7 ------- pyproject.toml | 12 ++++++++---- python_src/lasp/__init__.py | 7 +++++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cpp_src/lasp_config.h.in b/cpp_src/lasp_config.h.in index c71b8e9..af309b9 100644 --- a/cpp_src/lasp_config.h.in +++ b/cpp_src/lasp_config.h.in @@ -9,9 +9,6 @@ #ifndef LASP_CONFIG_H #define LASP_CONFIG_H -const int LASP_VERSION_MAJOR = @CMAKE_PROJECT_VERSION_MAJOR@; -const int LASP_VERSION_MINOR = @CMAKE_PROJECT_VERSION_MINOR@; - /* Debug flag */ #cmakedefine01 LASP_DEBUG diff --git a/cpp_src/lasp_cpp.cpp b/cpp_src/lasp_cpp.cpp index f541f1b..d5c7f76 100644 --- a/cpp_src/lasp_cpp.cpp +++ b/cpp_src/lasp_cpp.cpp @@ -52,12 +52,5 @@ PYBIND11_MODULE(lasp_cpp, m) { init_datahandler(m); init_siggen(m); - // We store the version number of the code via CMake, and create an - // attribute in the C++ code. - m.attr("__version__") = std::to_string(LASP_VERSION_MAJOR) + "." + - std::to_string(LASP_VERSION_MINOR); - - m.attr("LASP_VERSION_MAJOR") = LASP_VERSION_MAJOR; - m.attr("LASP_VERSION_MINOR") = LASP_VERSION_MINOR; } /** @} */ diff --git a/pyproject.toml b/pyproject.toml index fa45bde..f1611a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires-python = ">=3.10" description = "Library for Acoustic Signal Processing" license = { "file" = "LICENSE" } authors = [{ "name" = "J.A. de Jong", "email" = "j.a.dejong@ascee.nl" }] -dynamic = ["version"] +version = "1.0" keywords = ["DSP", "DAQ", "Signal processing"] @@ -26,7 +26,7 @@ dependencies = ["scipy", "numpy", "matplotlib", "appdirs", "dataclasses_json", "h5py", "pybind11"] [build-system] # How pip and other frontends should build this project -requires = ["py-build-cmake~=0.1.8", "setuptools_scm[toml]>=6.2"] +requires = ["py-build-cmake~=0.1.8" ] build-backend = "py_build_cmake.build" [tool.py-build-cmake.module] # Where to find the Python module to package @@ -42,5 +42,9 @@ source_path = "." build_args = ["-j"] install_components = ["python_modules"] -[tool.setuptools_scm] -version_file = ["python_src/lasp/_version.py" , "cpp_src/_version.txt"] +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "v$version" +version_scheme = "semver" +version_provider = "pep621" +update_changelog_on_bump = true diff --git a/python_src/lasp/__init__.py b/python_src/lasp/__init__.py index 7cfbdc5..e6537f1 100644 --- a/python_src/lasp/__init__.py +++ b/python_src/lasp/__init__.py @@ -2,9 +2,12 @@ LASP: Library for Acoustic Signal Processing """ -from ._version import * + from .lasp_cpp import * -import lasp.lasp_cpp +from ._version import __version__, __version_tuple__ + +LASP_VERSION_MAJOR = __version_tuple__[0] +LASP_VERSION_MINOR = __version_tuple__[1] from .lasp_common import * # from .lasp_imptube import * # TwoMicImpedanceTube From 37048c54face342a25eb5ad90e7c72c72185bbae Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 18 Jul 2023 17:17:28 +0200 Subject: [PATCH 05/60] build(Testing-with-pre-commit): Not yet --- .pre-commit-config.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ca1bb7..a2720e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,19 @@ --- repos: - repo: https://github.com/commitizen-tools/commitizen - rev: master + rev: 3.5.3 hooks: - - id: commitizen - - id: commitizen-branch - stages: [push] + - id: commitizen + - id: commitizen-branch + stages: [push] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black From d96c591183c4d8bf567222d47feb2f1acd7c3acd Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 19 Jul 2023 16:56:50 +0200 Subject: [PATCH 06/60] build(Removed-requirements,-they-are-in-pyproject.toml.-Added-lasp_version.py-that-will-obtain-version-from-metadata.): Black changed single quotes to double quotes. This commit should be tested now we have a patch number in the version --- python_src/lasp/__init__.py | 9 +- python_src/lasp/lasp_daqconfigs.py | 3 +- python_src/lasp/lasp_measurement.py | 342 +++++++++++++++------------- python_src/lasp/lasp_record.py | 14 +- python_src/lasp/lasp_version.py | 4 + requirements.txt | 6 - 6 files changed, 200 insertions(+), 178 deletions(-) create mode 100644 python_src/lasp/lasp_version.py delete mode 100644 requirements.txt diff --git a/python_src/lasp/__init__.py b/python_src/lasp/__init__.py index e6537f1..d28c3e8 100644 --- a/python_src/lasp/__init__.py +++ b/python_src/lasp/__init__.py @@ -3,12 +3,10 @@ LASP: Library for Acoustic Signal Processing """ -from .lasp_cpp import * -from ._version import __version__, __version_tuple__ -LASP_VERSION_MAJOR = __version_tuple__[0] -LASP_VERSION_MINOR = __version_tuple__[1] -from .lasp_common import * +from .lasp_version import __version__ +from .lasp_common import * +from .lasp_cpp import * # from .lasp_imptube import * # TwoMicImpedanceTube from .lasp_measurement import * # Measurement, scaleBlockSens @@ -17,6 +15,7 @@ from .lasp_slm import * # SLM, Dummy from .lasp_record import * # RecordStatus, Recording from .lasp_daqconfigs import * from .lasp_measurementset import * + # from .lasp_siggen import * # SignalType, NoiseType, SiggenMessage, SiggenData, Siggen # from .lasp_weighcal import * # WeighCal # from .tools import * # SmoothingType, smoothSpectralData, SmoothingWidth diff --git a/python_src/lasp/lasp_daqconfigs.py b/python_src/lasp/lasp_daqconfigs.py index c7bf381..df6463d 100644 --- a/python_src/lasp/lasp_daqconfigs.py +++ b/python_src/lasp/lasp_daqconfigs.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -from .lasp_cpp import DaqConfiguration, LASP_VERSION_MAJOR +from .lasp_cpp import DaqConfiguration +from .lasp_version import LASP_VERSION_MAJOR """! Author: J.A. de Jong - ASCEE diff --git a/python_src/lasp/lasp_measurement.py b/python_src/lasp/lasp_measurement.py index 899bb74..f798577 100644 --- a/python_src/lasp/lasp_measurement.py +++ b/python_src/lasp/lasp_measurement.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations + """! Author: J.A. de Jong - ASCEE @@ -43,7 +44,7 @@ The video dataset can possibly be not present in the data. """ -__all__ = ['Measurement', 'scaleBlockSens'] +__all__ = ["Measurement", "scaleBlockSens"] from contextlib import contextmanager import h5py as h5 import numpy as np @@ -51,7 +52,8 @@ from .lasp_config import LASP_NUMPY_FLOAT_TYPE from scipy.io import wavfile import os, time, wave, logging from .lasp_common import SIQtys, Qty, getFreq -from .lasp_cpp import Window, DaqChannel, LASP_VERSION_MAJOR, AvPowerSpectra +from .lasp_version import LASP_VERSION_MAJOR, LASP_VERSION_MINOR +from .lasp_cpp import Window, DaqChannel, AvPowerSpectra from typing import List from functools import lru_cache @@ -72,7 +74,7 @@ def getSampWidth(dtype): elif dtype == np.float64: return 8 else: - raise ValueError('Invalid data type: %s' % dtype) + raise ValueError("Invalid data type: %s" % dtype) def scaleBlockSens(block, sens): @@ -87,9 +89,9 @@ def scaleBlockSens(block, sens): assert sens.size == block.shape[1] if np.issubdtype(block.dtype.type, np.integer): sw = getSampWidth(block.dtype) - fac = 2**(8 * sw - 1) - 1 + fac = 2 ** (8 * sw - 1) - 1 else: - fac = 1. + fac = 1.0 return block.astype(LASP_NUMPY_FLOAT_TYPE) / fac / sens[np.newaxis, :] @@ -107,7 +109,7 @@ class IterRawData: """ assert isinstance(channels, list) - fa = f['audio'] + fa = f["audio"] self.fa = fa self.i = 0 @@ -117,8 +119,8 @@ class IterRawData: # nchannels = fa.shape[2] self.channels = channels - self.istart = kwargs.pop('istart', 0) - self.istop = kwargs.pop('istop', blocksize*nblocks) + self.istart = kwargs.pop("istart", 0) + self.istop = kwargs.pop("istop", blocksize * nblocks) self.firstblock = self.istart // blocksize self.lastblock = self.istop // blocksize @@ -128,11 +130,11 @@ class IterRawData: self.firstblock_start_offset = self.istart % blocksize if self.istop < 0: - self.istop += blocksize*nblocks + self.istop += blocksize * nblocks if self.istop <= self.istart: - raise ValueError('Stop index is smaller than start index') + raise ValueError("Stop index is smaller than start index") - if self.istop != blocksize*nblocks: + if self.istop != blocksize * nblocks: self.lastblock_stop_offset = self.istop % blocksize else: self.lastblock_stop_offset = blocksize @@ -171,6 +173,7 @@ class IterData(IterRawData): Iterate over blocks of data, scaled with sensitivity and integer scaling between 0 and 1 """ + def __init__(self, fa, channels, sensitivity, **kwargs): super().__init__(fa, channels, **kwargs) self.sens = np.asarray(sensitivity)[self.channels] @@ -187,8 +190,8 @@ class Measurement: def __init__(self, fn): """Initialize a Measurement object based on the filename.""" - if '.h5' not in fn: - fn += '.h5' + if ".h5" not in fn: + fn += ".h5" # Full filepath self.fn = fn @@ -198,26 +201,26 @@ class Measurement: # Open the h5 file in read-plus mode, to allow for changing the # measurement comment. - with h5.File(fn, 'r') as f: + with h5.File(fn, "r") as f: # Check for video data try: - f['video'] + f["video"] self.has_video = True except KeyError: self.has_video = False - self.nblocks, self.blocksize, self.nchannels = f['audio'].shape - dtype = f['audio'].dtype + self.nblocks, self.blocksize, self.nchannels = f["audio"].shape + dtype = f["audio"].dtype self.dtype = dtype self.sampwidth = getSampWidth(dtype) - self.samplerate = f.attrs['samplerate'] - self.N = (self.nblocks * self.blocksize) + self.samplerate = f.attrs["samplerate"] + self.N = self.nblocks * self.blocksize self.T = self.N / self.samplerate try: - self.version_major = f.attrs['LASP_VERSION_MAJOR'] - self.version_minor = f.attrs['LASP_VERSION_MINOR'] + self.version_major = f.attrs["LASP_VERSION_MAJOR"] + self.version_minor = f.attrs["LASP_VERSION_MINOR"] except KeyError: self.version_major = 0 self.version_minor = 1 @@ -225,45 +228,47 @@ class Measurement: # Due to a previous bug, the channel names were not stored # consistently, i.e. as 'channel_names' and later camelcase. try: - self._channelNames = f.attrs['channelNames'] + self._channelNames = f.attrs["channelNames"] except KeyError: try: - self._channelNames = f.attrs['channel_names'] - logging.info("Measurement file obtained which stores channel names with *old* attribute 'channel_names'") + self._channelNames = f.attrs["channel_names"] + logging.info( + "Measurement file obtained which stores channel names with *old* attribute 'channel_names'" + ) except KeyError: # No channel names found in measurement file - logging.info('No channel name data found in measurement') - self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)] + logging.info("No channel name data found in measurement") + self._channelNames = [f"Unnamed {i}" for i in range(self.nchannels)] # comment = read-write thing - if 'comment' in f.attrs: - self._comment = f.attrs['comment'] + if "comment" in f.attrs: + self._comment = f.attrs["comment"] else: - self._comment = '' + self._comment = "" # Sensitivity try: - sens = f.attrs['sensitivity'] - self._sens = sens * \ - np.ones(self.nchannels) if isinstance( - sens, float) else sens + sens = f.attrs["sensitivity"] + self._sens = ( + sens * np.ones(self.nchannels) if isinstance(sens, float) else sens + ) except KeyError: self._sens = np.ones(self.nchannels) # The time is cached AND ALWAYS ASSUMED TO BE AN IMMUTABLE OBJECT. # It is also cached. Changing the measurement timestamp should not # be done. - self._time = f.attrs['time'] + self._time = f.attrs["time"] # Quantity stored as channel. self._qtys = None try: - qtys_enum_idx = f.attrs['qtys_enum_idx'] + qtys_enum_idx = f.attrs["qtys_enum_idx"] self._qtys = [SIQtys.fromInt(idx) for idx in qtys_enum_idx] except KeyError: try: - qtys_json = f.attrs['qtys'] + qtys_json = f.attrs["qtys"] # Load quantity data self._qtys = [Qty.from_json(qty_json) for qty_json in qtys_json] except KeyError: @@ -273,17 +278,19 @@ class Measurement: if self._qtys is None: self._qtys = [SIQtys.default() for i in range(self.nchannels)] - logging.debug(f'Physical quantity data not available in measurement file. Assuming {SIQtys.default}') + logging.debug( + f"Physical quantity data not available in measurement file. Assuming {SIQtys.default}" + ) def setAttribute(self, atrname, value): """ Set an attribute in the measurement file, and keep a local copy in memory for efficient accessing. """ - with self.file('r+') as f: + with self.file("r+") as f: # Update comment attribute in the file f.attrs[atrname] = value - setattr(self, '_' + atrname, value) + setattr(self, "_" + atrname, value) @property def name(self): @@ -297,14 +304,13 @@ class Measurement: @channelNames.setter def channelNames(self, newchnames): if len(newchnames) != self.nchannels: - raise RuntimeError('Invalid length of new channel names') - self.setAttribute('channelNames', newchnames) + raise RuntimeError("Invalid length of new channel names") + self.setAttribute("channelNames", newchnames) @property def channelConfig(self): chcfg = [] - for chname, sens, qty in zip(self.channelNames, self.sensitivity, - self.qtys): + for chname, sens, qty in zip(self.channelNames, self.sensitivity, self.qtys): ch = DaqChannel() ch.enabled = True ch.name = chname @@ -334,26 +340,26 @@ class Measurement: @qtys.setter def qtys(self, newqtys): if not len(newqtys) == len(self._qtys): - raise ValueError('Invalid number of quantities') + raise ValueError("Invalid number of quantities") qtys_int = [qty.toInt() for qty in newqtys] # Use setAttribute here, but thos store the jsonified version as well, # which we have to overwrite again with the deserialized ones. This is # actually not a very nice way of coding. - with self.file('r+') as f: + with self.file("r+") as f: # Update comment attribute in the file - f.attrs['qtys_enum_idx'] = qtys_int + f.attrs["qtys_enum_idx"] = qtys_int self._qtys = newqtys @contextmanager - def file(self, mode='r'): + def file(self, mode="r"): """Contextmanager which opens the storage file and yields the file. Args: mode: Opening mode for the file. Should either be 'r', or 'r+' """ - if mode not in ('r', 'r+'): - raise ValueError('Invalid file opening mode.') + if mode not in ("r", "r+"): + raise ValueError("Invalid file opening mode.") with h5.File(self.fn, mode) as f: yield f @@ -373,9 +379,9 @@ class Measurement: Args: cmt: Comment text string to set """ - with self.file('r+') as f: + with self.file("r+") as f: # Update comment attribute in the file - f.attrs['comment'] = cmt + f.attrs["comment"] = cmt self._comment = cmt @property @@ -400,7 +406,7 @@ class Measurement: """ time_struct = time.localtime(self.time) - time_string = time.strftime('%Y-%m-%d %H:%M:%S', time_struct) + time_string = time.strftime("%Y-%m-%d %H:%M:%S", time_struct) return time_string def rms(self, channels=None, substract_average=False): @@ -415,8 +421,8 @@ class Measurement: Returns: 1D array with rms values for each channel """ - meansquare = 0. # Mean square of the signal, including its average - sum_ = 0. # Sumf of the values of the signal, used to compute average + meansquare = 0.0 # Mean square of the signal, including its average + sum_ = 0.0 # Sumf of the values of the signal, used to compute average N = 0 with self.file() as f: for block in self.iterData(channels): @@ -425,7 +431,7 @@ class Measurement: N += Nblock meansquare += np.sum(block**2, axis=0) / self.N - avg = sum_/N + avg = sum_ / N # In fact, this is not the complete RMS, as in includes the DC # If p = p_dc + p_osc, then rms(p_osc) = sqrt(ms(p)-ms(p_dc)) if substract_average: @@ -461,7 +467,7 @@ class Measurement: return np.concatenate(rawdata, axis=0) def iterData(self, channels, **kwargs): - sensitivity = kwargs.pop('sensitivity', self.sensitivity) + sensitivity = kwargs.pop("sensitivity", self.sensitivity) if channels is None: channels = list(range(self.nchannels)) with self.file() as f: @@ -496,9 +502,9 @@ class Measurement: Cross-power-spectra. C[freq, ch_i, ch_j] = C_ij """ - nfft = kwargs.pop('nfft', 2048) - window = kwargs.pop('windowType', Window.WindowType.Hann) - overlap = kwargs.pop('overlap', 50.0) + nfft = kwargs.pop("nfft", 2048) + window = kwargs.pop("windowType", Window.WindowType.Hann) + overlap = kwargs.pop("overlap", 50.0) if channels is None: channels = list(range(self.nchannels)) @@ -527,35 +533,37 @@ class Measurement: """ # Create blocks of equal length N Ntot = self.N - Nblocks = Ntot//N + Nblocks = Ntot // N # TODO: This method graps the whole measurement file into memory. Can # only be done with relatively small measurement files. signal = self.data(channels) # Estimate noise power in block - blocks = [signal[i*N:(i+1)*N] for i in range(Nblocks)] + blocks = [signal[i * N : (i + 1) * N] for i in range(Nblocks)] if noiseCorrection: # The difference between the measured signal in the previous block and # the current block - en = [None] + [blocks[i] - blocks[i-1] for i in range(1,Nblocks)] + en = [None] + [blocks[i] - blocks[i - 1] for i in range(1, Nblocks)] - noise_est = [None] + [-np.average(en[i]*en[i+1]) for i in range(1,len(en)-1)] + noise_est = [None] + [ + -np.average(en[i] * en[i + 1]) for i in range(1, len(en) - 1) + ] # Create weighting coefficients - sum_inverse_noise = sum([1/n for n in noise_est[1:]]) - c_n = [1/(ni*sum_inverse_noise) for ni in noise_est[1:]] + sum_inverse_noise = sum([1 / n for n in noise_est[1:]]) + c_n = [1 / (ni * sum_inverse_noise) for ni in noise_est[1:]] else: - c_n = [1/(Nblocks-2)]*(Nblocks-2) + c_n = [1 / (Nblocks - 2)] * (Nblocks - 2) assert np.isclose(sum(c_n), 1.0) - assert Nblocks-2 == len(c_n) + assert Nblocks - 2 == len(c_n) # Average signal over blocks avg = np.zeros((blocks[0].shape), dtype=float) - for n in range(0, Nblocks-2): - avg += c_n[n]*blocks[n+1] + for n in range(0, Nblocks - 2): + avg += c_n[n] * blocks[n + 1] return avg @@ -578,7 +586,6 @@ class Measurement: return freq, CS - @property def sensitivity(self): """Sensitivity of the data in U^-1, from floating point data scaled @@ -607,9 +614,9 @@ class Measurement: valid &= sens.shape[0] == self.nchannels valid &= sens.dtype == float if not valid: - raise ValueError('Invalid sensitivity value(s) given') - with self.file('r+') as f: - f.attrs['sensitivity'] = sens + raise ValueError("Invalid sensitivity value(s) given") + with self.file("r+") as f: + f.attrs["sensitivity"] = sens self._sens = sens def checkOverflow(self, channels): @@ -621,19 +628,17 @@ class Measurement: for block in self.iterData(channels): dtype = block.dtype - if dtype.kind == 'i': + if dtype.kind == "i": # minvalue = np.iinfo(dtype).min maxvalue = np.iinfo(dtype).max - if np.max(np.abs(block)) >= 0.9*maxvalue: + if np.max(np.abs(block)) >= 0.9 * maxvalue: return True else: # Cannot check for floating point values. return False return False - - def exportAsWave(self, fn=None, force=False, dtype=None, - normalize=False, **kwargs): + def exportAsWave(self, fn=None, force=False, dtype=None, normalize=False, **kwargs): """Export measurement file as wave. In case the measurement data is stored as floats, the values are scaled to the proper integer (PCM) data format. @@ -654,14 +659,16 @@ class Measurement: fn = self.fn fn = os.path.splitext(fn)[0] - if os.path.splitext(fn)[1] != '.wav': - fn += '.wav' + if os.path.splitext(fn)[1] != ".wav": + fn += ".wav" if os.path.exists(fn) and not force: - raise RuntimeError(f'File already exists: {fn}') + raise RuntimeError(f"File already exists: {fn}") - if not np.isclose(self.samplerate%1,0): - raise RuntimeError(f'Sample rates should be approximately integer for exporting to Wave to work') + if not np.isclose(self.samplerate % 1, 0): + raise RuntimeError( + f"Sample rates should be approximately integer for exporting to Wave to work" + ) # TODO: With VERY large measurment files, this is not possible! Is this # a theoretical case? @@ -673,20 +680,20 @@ class Measurement: maxabs = np.max(np.abs(data)) data = data / maxabs # "data /= maxabs" fails if dtpyes differ - if dtype==None: + if dtype == None: dtype = data.dtype # keep existing logging.debug(f"dtype not passed as arg; using dtype = {dtype}") # dtype conversion - if dtype=='int16': + if dtype == "int16": newtype = np.int16 newsampwidth = 2 - elif dtype=='int32': + elif dtype == "int32": newtype = np.int32 newsampwidth = 4 - elif dtype=='float32': + elif dtype == "float32": newtype = np.float32 - elif dtype=='float64': + elif dtype == "float64": newtype = np.float64 else: logging.debug(f"cannot handle this dtype {dtype}") @@ -697,22 +704,24 @@ class Measurement: sensone = np.ones_like(self.sensitivity) data = scaleBlockSens(data, sensone) - if dtype=='int16' or dtype=='int32': + if dtype == "int16" or dtype == "int32": # Scale data to integer range and convert to integers - scalefac = 2**(8*newsampwidth-1)-1 - data = (data*scalefac).astype(newtype) + scalefac = 2 ** (8 * newsampwidth - 1) - 1 + data = (data * scalefac).astype(newtype) wavfile.write(fn, int(self.samplerate), data.astype(newtype)) @staticmethod - def fromtxt(fn, - skiprows, - samplerate, - sensitivity, - mfn=None, - timestamp=None, - delimiter='\t', - firstcoltime=True): + def fromtxt( + fn, + skiprows, + samplerate, + sensitivity, + mfn=None, + timestamp=None, + delimiter="\t", + firstcoltime=True, + ): """Converts a txt file to a LASP Measurement file, opens the associated Measurement object and returns it. The measurement file will have the same file name as the txt file, except with h5 extension. @@ -732,50 +741,57 @@ class Measurement: sample time. """ if not os.path.exists(fn): - raise ValueError(f'File {fn} does not exist.') + raise ValueError(f"File {fn} does not exist.") if timestamp is None: timestamp = os.path.getmtime(fn) if mfn is None: - mfn = os.path.splitext(fn)[0] + '.h5' + mfn = os.path.splitext(fn)[0] + ".h5" else: - mfn = os.path.splitext(mfn)[0] + '.h5' + mfn = os.path.splitext(mfn)[0] + ".h5" dat = np.loadtxt(fn, skiprows=skiprows, delimiter=delimiter) if firstcoltime: time = dat[:, 0] if not np.isclose(time[1] - time[0], 1 / samplerate): - raise ValueError('Samplerate given does not agree with ' - 'samplerate in file') + raise ValueError( + "Samplerate given does not agree with " "samplerate in file" + ) # Chop off first column dat = dat[:, 1:] nchannels = dat.shape[1] if nchannels != sensitivity.shape[0]: raise ValueError( - f'Invalid sensitivity length given. Should be: {nchannels}') + f"Invalid sensitivity length given. Should be: {nchannels}" + ) - with h5.File(mfn, 'w') as hf: - hf.attrs['samplerate'] = samplerate - hf.attrs['sensitivity'] = sensitivity - hf.attrs['time'] = timestamp - hf.attrs['blocksize'] = 1 - hf.attrs['nchannels'] = nchannels - ad = hf.create_dataset('audio', (1, dat.shape[0], dat.shape[1]), - dtype=dat.dtype, - maxshape=(1, dat.shape[0], dat.shape[1]), - compression='gzip') + with h5.File(mfn, "w") as hf: + hf.attrs["samplerate"] = samplerate + hf.attrs["sensitivity"] = sensitivity + hf.attrs["time"] = timestamp + hf.attrs["blocksize"] = 1 + hf.attrs["nchannels"] = nchannels + ad = hf.create_dataset( + "audio", + (1, dat.shape[0], dat.shape[1]), + dtype=dat.dtype, + maxshape=(1, dat.shape[0], dat.shape[1]), + compression="gzip", + ) ad[0] = dat return Measurement(mfn) @staticmethod - def fromnpy(data, - samplerate, - sensitivity, - mfn, - timestamp=None, - qtys: List[SIQtys] = None, - channelNames: List[str] = None, - force=False) -> Measurement: + def fromnpy( + data, + samplerate, + sensitivity, + mfn, + timestamp=None, + qtys: List[SIQtys] = None, + channelNames: List[str] = None, + force=False, + ) -> Measurement: """ Converts a numpy array to a LASP Measurement file, opens the associated Measurement object and returns it. The measurement file will @@ -784,76 +800,79 @@ class Measurement: Args: data: Numpy array, first column is sample, second is channel. Can also be specified with a single column for single-channel data. - + samplerate: Sampling frequency in [Hz] - + sensitivity: 1D array of channel sensitivities in [U^-1], where U is the recorded unit. - + mfn: Filepath of the file where the data is stored. - + timestamp: If given, a custom timestamp for the measurement (integer containing seconds since epoch). qtys: If a list of physical quantity data is given here channelNames: Name of the channels - + force: If True, overwrites existing files with specified `mfn` name. """ - if os.path.splitext(mfn)[1] != '.h5': - mfn += '.h5' + if os.path.splitext(mfn)[1] != ".h5": + mfn += ".h5" if os.path.exists(mfn) and not force: - raise ValueError(f'File {mfn} already exist.') + raise ValueError(f"File {mfn} already exist.") if timestamp is None: timestamp = int(time.time()) if data.ndim != 2: data = data[:, np.newaxis] - try: len(sensitivity) except: - raise ValueError('Sensitivity should be given as array-like data type') + raise ValueError("Sensitivity should be given as array-like data type") sensitivity = np.asarray(sensitivity) nchannels = data.shape[1] if nchannels != sensitivity.shape[0]: raise ValueError( - f'Invalid sensitivity length given. Should be: {nchannels}') + f"Invalid sensitivity length given. Should be: {nchannels}" + ) if channelNames is not None: if len(channelNames) != nchannels: raise RuntimeError("Illegal length of channelNames list given") if qtys is None: - qtys = [SIQtys.AP]*nchannels + qtys = [SIQtys.AP] * nchannels else: if len(qtys) != nchannels: raise RuntimeError("Illegal length of qtys list given") qtyvals = [qty.value for qty in qtys] - with h5.File(mfn, 'w') as hf: - hf.attrs['samplerate'] = samplerate - hf.attrs['sensitivity'] = sensitivity - hf.attrs['time'] = timestamp - hf.attrs['blocksize'] = 1 - hf.attrs['nchannels'] = nchannels + with h5.File(mfn, "w") as hf: + hf.attrs["samplerate"] = samplerate + hf.attrs["sensitivity"] = sensitivity + hf.attrs["time"] = timestamp + hf.attrs["blocksize"] = 1 + hf.attrs["nchannels"] = nchannels # Add physical quantity indices - hf.attrs['qtys_enum_idx'] = [qtyval.toInt() for qtyval in qtyvals] + hf.attrs["qtys_enum_idx"] = [qtyval.toInt() for qtyval in qtyvals] # Add channel names in case given if channelNames is not None: - hf.attrs['channelNames'] = channelNames + hf.attrs["channelNames"] = channelNames - ad = hf.create_dataset('audio', (1, data.shape[0], data.shape[1]), - dtype=data.dtype, - maxshape=(1, data.shape[0], data.shape[1]), - compression='gzip') + ad = hf.create_dataset( + "audio", + (1, data.shape[0], data.shape[1]), + dtype=data.dtype, + maxshape=(1, data.shape[0], data.shape[1]), + compression="gzip", + ) ad[0] = data return Measurement(mfn) @@ -866,9 +885,11 @@ class Measurement: base_fn = os.path.splitext(fn)[0] if newfn is None: - newfn = base_fn + '.h5' + newfn = base_fn + ".h5" if os.path.exists(newfn) and not force: - raise RuntimeError(f'Measurement file name {newfn} already exists in path, set "force" to true to overwrite') + raise RuntimeError( + f'Measurement file name {newfn} already exists in path, set "force" to true to overwrite' + ) samplerate, data = wavfile.read(fn) if data.ndim == 2: @@ -879,16 +900,19 @@ class Measurement: data = data[:, np.newaxis] sensitivity = np.ones(nchannels) - with h5.File(newfn, 'w') as hf: - hf.attrs['samplerate'] = samplerate - hf.attrs['nchannels'] = nchannels - hf.attrs['time'] = timestamp - hf.attrs['blocksize'] = 1 - hf.attrs['sensitivity'] = sensitivity - ad = hf.create_dataset('audio', (1, nframes, nchannels), - dtype=data.dtype, - maxshape=(1, nframes, nchannels), - compression='gzip') + with h5.File(newfn, "w") as hf: + hf.attrs["samplerate"] = samplerate + hf.attrs["nchannels"] = nchannels + hf.attrs["time"] = timestamp + hf.attrs["blocksize"] = 1 + hf.attrs["sensitivity"] = sensitivity + ad = hf.create_dataset( + "audio", + (1, nframes, nchannels), + dtype=data.dtype, + maxshape=(1, nframes, nchannels), + compression="gzip", + ) ad[0] = data return Measurement(newfn) diff --git a/python_src/lasp/lasp_record.py b/python_src/lasp/lasp_record.py index 158665b..2b666cf 100644 --- a/python_src/lasp/lasp_record.py +++ b/python_src/lasp/lasp_record.py @@ -7,8 +7,8 @@ import dataclasses, logging, os, time, h5py, threading import numpy as np from .lasp_atomic import Atomic -from .lasp_cpp import (LASP_VERSION_MAJOR, LASP_VERSION_MINOR, InDataHandler, - StreamMgr) +from .lasp_cpp import InDataHandler, StreamMgr +from .lasp_version import LASP_VERSION_MAJOR, LASP_VERSION_MINOR @dataclasses.dataclass @@ -84,10 +84,10 @@ class Recording: try: # Open the file - self.f = h5py.File(self.fn, "w", 'stdio') + self.f = h5py.File(self.fn, "w", "stdio") self.f.flush() except Exception as e: - logging.error(f'Error creating measurement file {e}') + logging.error(f"Error creating measurement file {e}") raise # This flag is used to delete the file on finish(), and can be used @@ -191,7 +191,7 @@ class Recording: """ if self.stop(): - logging.debug('Stop flag set, early return in inCallback') + logging.debug("Stop flag set, early return in inCallback") # Stop flag is raised. We do not add any data anymore. return True @@ -225,12 +225,12 @@ class Recording: with self.file_mtx: self.f.flush() # Remove indata handler, which also should remove callback function - # from StreamMgr. This, however does not have to happen + # from StreamMgr. This, however does not have to happen # instantaneously. For which we have to implement extra mutex # guards in this class del self.indh self.indh = None - + # Remove handle to dataset otherwise the h5 file is not closed # properly. del self.ad diff --git a/python_src/lasp/lasp_version.py b/python_src/lasp/lasp_version.py new file mode 100644 index 0000000..fd4b171 --- /dev/null +++ b/python_src/lasp/lasp_version.py @@ -0,0 +1,4 @@ +import importlib.metadata + +__version__ = importlib.metadata.version(__package__ or __name__) +LASP_VERSION_MAJOR, LASP_VERSION_MINOR = [int(a) for a in __version__.split(".")] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 28f5ba9..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -appdirs -dataclasses_json -scipy -matplotlib -h5py -pytest From ff1cfddf97d9abb83a75992f36caaa4b8b2cc582 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 19 Jul 2023 17:00:22 +0200 Subject: [PATCH 07/60] fix: Added patch number to semver in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f1611a1..e896482 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires-python = ">=3.10" description = "Library for Acoustic Signal Processing" license = { "file" = "LICENSE" } authors = [{ "name" = "J.A. de Jong", "email" = "j.a.dejong@ascee.nl" }] -version = "1.0" +version = "1.0.0" keywords = ["DSP", "DAQ", "Signal processing"] From 01a6c35f6e1a5e74dc0ad91a326852cde89132f1 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 19 Jul 2023 17:00:27 +0200 Subject: [PATCH 08/60] =?UTF-8?q?bump:=20version=201.0.0=20=E2=86=92=201.0?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..638c552 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +## v1.0.1 (2023-07-19) + +### Fix + +- Added patch number to semver in pyproject.toml + +## v1.0.0 (2023-07-19) diff --git a/pyproject.toml b/pyproject.toml index e896482..792947d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires-python = ">=3.10" description = "Library for Acoustic Signal Processing" license = { "file" = "LICENSE" } authors = [{ "name" = "J.A. de Jong", "email" = "j.a.dejong@ascee.nl" }] -version = "1.0.0" +version = "1.0.1" keywords = ["DSP", "DAQ", "Signal processing"] From aa0803e2f14d396bbed33028fadb94b61f8d5447 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Thu, 20 Jul 2023 15:22:56 +0200 Subject: [PATCH 09/60] build(pyproject.toml): Added pybind11 build dependency --- pyproject.toml | 4 ++-- scripts/test.sh | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 792947d..a45edae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,11 @@ classifiers = [ ] urls = { "Documentation" = "https://lasp.ascee.nl" } -dependencies = ["scipy", "numpy", "matplotlib", "appdirs", "dataclasses_json", +dependencies = ["scipy", "numpy", "matplotlib>=3.7.2", "appdirs", "dataclasses_json", "h5py", "pybind11"] [build-system] # How pip and other frontends should build this project -requires = ["py-build-cmake~=0.1.8" ] +requires = ["py-build-cmake~=0.1.8", "pybind11" ] build-backend = "py_build_cmake.build" [tool.py-build-cmake.module] # Where to find the Python module to package diff --git a/scripts/test.sh b/scripts/test.sh index 4d33f1b..3802d96 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -5,7 +5,6 @@ python3 -m venv testenv # Activate environment . testenv/bin/activate -pip install -r requirements.txt pip install . arch_os_line='NAME="Arch Linux"' From 89b303497bc4c6935632092f1d3d77a5be562eb1 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Sun, 23 Jul 2023 15:24:17 +0200 Subject: [PATCH 10/60] fix(lasp_version.py): Added patch to tuple unpack --- python_src/lasp/lasp_version.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python_src/lasp/lasp_version.py b/python_src/lasp/lasp_version.py index fd4b171..f3c68db 100644 --- a/python_src/lasp/lasp_version.py +++ b/python_src/lasp/lasp_version.py @@ -1,4 +1,6 @@ import importlib.metadata __version__ = importlib.metadata.version(__package__ or __name__) -LASP_VERSION_MAJOR, LASP_VERSION_MINOR = [int(a) for a in __version__.split(".")] +LASP_VERSION_MAJOR, LASP_VERSION_MINOR, LASP_VERSION_PATCH = [ + int(a) for a in __version__.split(".") +] From a29f72a5922b0f7082fd2991913e57495928eab9 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 Jul 2023 17:24:12 +0200 Subject: [PATCH 11/60] Updated tests with build scripts in docker containers --- pyproject.toml | 5 +++++ scripts/build_archlinux.sh | 17 +++++++++++++++++ scripts/build_ubuntu.sh | 12 +++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a45edae..a24c88e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,11 @@ source_path = "." build_args = ["-j"] install_components = ["python_modules"] +[tool.py-build-cmake.editable] +# This might not work properly on Windows. Comment this out when testing on +# Windows. +mode = "symlink" + [tool.commitizen] name = "cz_conventional_commits" tag_format = "v$version" diff --git a/scripts/build_archlinux.sh b/scripts/build_archlinux.sh index e69de29..b0484bd 100755 --- a/scripts/build_archlinux.sh +++ b/scripts/build_archlinux.sh @@ -0,0 +1,17 @@ +#/bin/bash +# Build LASP on Arch Linux, assuming we start in a clean docker container. +# After that, test stuff. +# Assumptions +# - CWD is root of lasp repository +# - Nothing is installed + +# Stop on first error +set -e +pacman -Syu --noconfirm base-devel git ccache openblas fftw pulseaudio python-build libusb +git submodule update --init --recursive +pyproject-build +python -m venv .venv +source .venv/bin/activate +pip install pytest +pip install dist/lasp-*linux_x86_64.whl +pytest diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index df0363e..084267b 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -1,9 +1,11 @@ #!/bin/sh # apt update -apt install -y python3-venv +apt install -y python3-venv libopenblas-dev python3-pip libusb-1.0-0-dev libpulse-dev python3-build git submodule update --init --recursive - -cmake . -# More than two processes creates too much load -make -j2 +pyproject-build +python -m venv .venv +source .venv/bin/activate +pip install pytest +pip install dist/lasp-*linux_x86_64.whl +pytest From 94f0ec1d84ae47e85a56472227a88d90f28fe9c8 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 Jul 2023 18:01:02 +0200 Subject: [PATCH 12/60] ci(scripts/build_ubuntu.sh): Fixed build script for Ubuntu builds --- scripts/build_ubuntu.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index 084267b..6fdea1c 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -1,10 +1,11 @@ #!/bin/sh # +set -e apt update -apt install -y python3-venv libopenblas-dev python3-pip libusb-1.0-0-dev libpulse-dev python3-build +apt install -y python3-virtualenv libopenblas-dev python3-pip libusb-1.0-0-dev libpulse-dev python3-build git submodule update --init --recursive -pyproject-build -python -m venv .venv +python3 -m build +python3 -m venv .venv source .venv/bin/activate pip install pytest pip install dist/lasp-*linux_x86_64.whl From 8397779a2a6e66673e86d3e78d912e32950acce5 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 Jul 2023 18:01:51 +0200 Subject: [PATCH 13/60] ci: Fixed build script for Ubuntu build (2) --- scripts/build_ubuntu.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index 6fdea1c..a2455a0 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -1,12 +1,22 @@ #!/bin/sh -# +# Build LASP on Arch Linux, assuming we start in a clean docker container. +# After that, test stuff. +# Assumptions +# - CWD is root of lasp repository +# - Nothing is installed + +# Stop on first error set -e +# Update cache apt update -apt install -y python3-virtualenv libopenblas-dev python3-pip libusb-1.0-0-dev libpulse-dev python3-build +# Install requirements +apt install -y python3-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +# Build git submodule update --init --recursive python3 -m build python3 -m venv .venv source .venv/bin/activate pip install pytest pip install dist/lasp-*linux_x86_64.whl +# Test pytest From c9243b11434d4fad802dfcf3ac4a539fbf76f68d Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 Jul 2023 18:11:45 +0200 Subject: [PATCH 14/60] build(Pre-commit-drone-file-cannot-be-checked): Removed check-yaml hook, updated drone config --- .drone.yml | 31 ++++++------------------------- .pre-commit-config.yaml | 1 - 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/.drone.yml b/.drone.yml index b38e32b..7e4d72a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,26 +6,14 @@ clone: depth: 50 steps: - - name: archlinux_build - image: archlinux_build:latest + - name: archlinux_build_test + image: archlinux:latest pull: if-not-exists volumes: - name: archlinux_ccache path: /root/.ccache commands: - # The following command is not required, we included this in the docker - # image of archlinux_build - # - pacman -S --noconfirm ccache openblas fftw pulseaudio pybind11 - - git submodule update --init --recursive - - cmake . - # More than two makes ascee2 irresponsive for now - - make -j2 - - - name: archlinux_test - image: archlinux_build:latest - pull: if-not-exists - commands: - - scripts/test.sh + - scripts/build_archlinux.sh volumes: - name: archlinux_ccache @@ -45,22 +33,15 @@ volumes: path: /root/.ccache steps: - - name: ubuntu_build - image: ubuntu_build:latest + - name: ubuntu_build_test + image: ubuntu:latest pull: if-not-exists volumes: - name: ubuntu_ccache path: /root/.ccache environment: commands: - # The following commands are not required, we included this in the docker - # image of ubuntu_builud - scripts/build_ubuntu.sh - - name: ubuntu_test - image: ubuntu_build:latest - pull: if-not-exists - commands: - - scripts/test.sh volumes: - name: ubuntu_ccache @@ -77,7 +58,7 @@ clone: steps: - - name: build_docker_master + - name: build_documentation_master image: plugins/docker settings: repo: ascee/lasp_ascee_nl diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2720e3..807cc84 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black From 1bf022d6480d806201f67b278bd9eb7de1607b1f Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 Jul 2023 20:02:18 +0200 Subject: [PATCH 15/60] ci: Ubuntu build: added git to list of install packages --- scripts/build_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index a2455a0..bea0a17 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -10,7 +10,7 @@ set -e # Update cache apt update # Install requirements -apt install -y python3-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +apt install -y git python3-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build # Build git submodule update --init --recursive python3 -m build From dbd9c7c1af88bb95799e63076a0a996d87588826 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 30 Aug 2023 16:01:08 +0200 Subject: [PATCH 16/60] Updated drone to use all cpus available --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index b38e32b..2be96ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,8 +18,7 @@ steps: # - pacman -S --noconfirm ccache openblas fftw pulseaudio pybind11 - git submodule update --init --recursive - cmake . - # More than two makes ascee2 irresponsive for now - - make -j2 + - make -j - name: archlinux_test image: archlinux_build:latest From e51463a6cc41aee3434ebd4af771d9c3e5d50d36 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F." Date: Sun, 17 Sep 2023 17:14:55 +0200 Subject: [PATCH 17/60] build(Build-on-Ubuntu-fuix): hopefully fixed build error for Ubuntu builds --- scripts/build_ubuntu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index a703e25..3fb49d8 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -10,13 +10,13 @@ set -e # Update cache apt update # Install requirements -apt install -y git python3.10-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +apt install -y git python3.10-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build # Build git submodule update --init --recursive -python3 -m build python3 -m venv .venv source .venv/bin/activate -pip install pytest +pip install build pytest +python3 -m build pip install dist/lasp-*linux_x86_64.whl # Test pytest From 0425195ffd760b5f42c1ddc5cb8e1ba9a894991e Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F." Date: Sun, 17 Sep 2023 17:19:43 +0200 Subject: [PATCH 18/60] build(python3-virtualenv): Not python3.10-virtualenv but python3-virtualenv --- scripts/build_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index 3fb49d8..7940eac 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -10,7 +10,7 @@ set -e # Update cache apt update # Install requirements -apt install -y git python3.10-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +apt install -y git python3-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build # Build git submodule update --init --recursive python3 -m venv .venv From df4e2cb57331a89ebb74b07ff53b7ba0bcf70f3a Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F." Date: Sun, 17 Sep 2023 17:34:21 +0200 Subject: [PATCH 19/60] build(Build-docu-only-on-master,-python3-venv-(sigh)..): Added extra install ubuntu dept, trigger documentation build only on branch master --- .drone.yml | 7 ++++--- scripts/build_ubuntu.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index ad9ff63..63264b5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -50,7 +50,10 @@ volumes: --- kind: pipeline type: docker -name: documentation_build +name: documentation_build_master +trigger: + branch: + master clone: depth: 3 @@ -66,5 +69,3 @@ steps: from_secret: docker_username password: from_secret: docker_password - when: - branch: master diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index 7940eac..0456a00 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -10,7 +10,7 @@ set -e # Update cache apt update # Install requirements -apt install -y git python3-virtualenv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +apt install -y git python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build # Build git submodule update --init --recursive python3 -m venv .venv From 63122b8a42fced939c97a329640607e485428cc0 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F." Date: Sun, 17 Sep 2023 19:52:31 +0200 Subject: [PATCH 20/60] build(Not-sh-but-bash): Changed from sh to bash shell --- scripts/build_ubuntu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index 0456a00..0b7bec2 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -1,5 +1,5 @@ -#!/bin/sh -# Build LASP on Arch Linux, assuming we start in a clean docker container. +#!/bin/bash +# Build LASP on Ubuntu Linux, assuming we start in a clean docker container. # After that, test stuff. # Assumptions # - CWD is root of lasp repository From 5b1051bf99ddc9ceac56556914cc783fcf9dc230 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 27 Sep 2023 20:52:36 +0200 Subject: [PATCH 21/60] Check whether publishing works --- .drone.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index ad9ff63..1bc4622 100644 --- a/.drone.yml +++ b/.drone.yml @@ -41,6 +41,13 @@ steps: environment: commands: - scripts/build_ubuntu.sh + - name: ubuntu_publish + image: plugins/gitea_release + settings: + files: dist/* + base_url: https:/code.ascee.nl + # when: + #branch: master volumes: - name: ubuntu_ccache @@ -50,7 +57,10 @@ volumes: --- kind: pipeline type: docker -name: documentation_build +name: documentation_build_master +trigger: + branch: + master clone: depth: 3 @@ -66,5 +76,3 @@ steps: from_secret: docker_username password: from_secret: docker_password - when: - branch: master From 586dfb38b3994fb7d6c346defdd2135a7d9cba3d Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 4 Oct 2023 21:30:22 +0200 Subject: [PATCH 22/60] Some fix for building on Ubuntu --- scripts/build_ubuntu.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build_ubuntu.sh b/scripts/build_ubuntu.sh index a703e25..0b7bec2 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_ubuntu.sh @@ -1,5 +1,5 @@ -#!/bin/sh -# Build LASP on Arch Linux, assuming we start in a clean docker container. +#!/bin/bash +# Build LASP on Ubuntu Linux, assuming we start in a clean docker container. # After that, test stuff. # Assumptions # - CWD is root of lasp repository @@ -10,13 +10,13 @@ set -e # Update cache apt update # Install requirements -apt install -y git python3.10-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +apt install -y git python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build # Build git submodule update --init --recursive -python3 -m build python3 -m venv .venv source .venv/bin/activate -pip install pytest +pip install build pytest +python3 -m build pip install dist/lasp-*linux_x86_64.whl # Test pytest From 31208db3251f3fc2c1f10743f403595d34180f5c Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Thu, 5 Oct 2023 21:39:41 +0200 Subject: [PATCH 23/60] Action roll... --- .drone.yml | 78 ------------------- .gitea/workflows/workflow.yml | 35 +++++++++ pyproject.toml | 2 +- scripts/act_test | 3 + .../{build_ubuntu.sh => build_test_ubuntu.sh} | 13 ++-- 5 files changed, 47 insertions(+), 84 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/workflow.yml create mode 100755 scripts/act_test rename scripts/{build_ubuntu.sh => build_test_ubuntu.sh} (56%) diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 1bc4622..0000000 --- a/.drone.yml +++ /dev/null @@ -1,78 +0,0 @@ -kind: pipeline -type: docker -name: archlinux - -clone: - depth: 50 - -steps: - - name: archlinux_build_test - image: archlinux:latest - pull: if-not-exists - volumes: - - name: archlinux_ccache - path: /root/.ccache - commands: - - scripts/build_archlinux.sh -volumes: - - name: archlinux_ccache - host: - path: /tmp/archlinux_ccache - ---- -kind: pipeline -type: docker -name: ubuntu - -clone: - depth: 3 - -volumes: -- name: archlinux_ccache - path: /root/.ccache - -steps: - - name: ubuntu_build_test - image: ubuntu:latest - pull: if-not-exists - volumes: - - name: ubuntu_ccache - path: /root/.ccache - environment: - commands: - - scripts/build_ubuntu.sh - - name: ubuntu_publish - image: plugins/gitea_release - settings: - files: dist/* - base_url: https:/code.ascee.nl - # when: - #branch: master - -volumes: - - name: ubuntu_ccache - host: - path: /tmp/ubuntu_ccache - ---- -kind: pipeline -type: docker -name: documentation_build_master -trigger: - branch: - master - -clone: - depth: 3 - - -steps: - - name: build_documentation_master - image: plugins/docker - settings: - repo: ascee/lasp_ascee_nl - tags: latest - username: - from_secret: docker_username - password: - from_secret: docker_password diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml new file mode 100644 index 0000000..aaaf11a --- /dev/null +++ b/.gitea/workflows/workflow.yml @@ -0,0 +1,35 @@ +name: Building and testing LASP + +on: + push: + tags: + - '*' + +jobs: + Build-Test-Ubuntu: + runs-on: ubuntu-latest + container: ascee/ubuntu_build:latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build + run: | + pip install build + python3 -m build + + Release-Ubuntu: + runs-on: ubuntu-latest + container: ascee/ubuntu_build:latest + needs: Build-Test-Ubuntu + steps: + - name: Release + uses: actions/release-action@main + with: + files: |- + dist/** + api_key: '${{secrets.RELEASE_TOKEN}}' + if: gitea.ref == 'refs/heads/master' + diff --git a/pyproject.toml b/pyproject.toml index a24c88e..41b30ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ include = ["CMakeLists.txt", "cmake", "cpp_src", "python_src", "img", "scripts", [tool.py-build-cmake.cmake] # How to build the CMake project build_type = "Release" source_path = "." -build_args = ["-j"] +build_args = ["-j12"] install_components = ["python_modules"] [tool.py-build-cmake.editable] diff --git a/scripts/act_test b/scripts/act_test new file mode 100755 index 0000000..477332b --- /dev/null +++ b/scripts/act_test @@ -0,0 +1,3 @@ +#!/bin/bash +# Test push workflow of Gitea runner +act push --workflows .gitea/workflows diff --git a/scripts/build_ubuntu.sh b/scripts/build_test_ubuntu.sh similarity index 56% rename from scripts/build_ubuntu.sh rename to scripts/build_test_ubuntu.sh index 0b7bec2..7df11cf 100755 --- a/scripts/build_ubuntu.sh +++ b/scripts/build_test_ubuntu.sh @@ -8,13 +8,16 @@ # Stop on first error set -e # Update cache -apt update -# Install requirements -apt install -y git python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build -# Build -git submodule update --init --recursive +# apt update +# Install requirements, this is done inside the Docker container to safe some +# work! +# apt install -y git python3 python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build +# +# Build in venv python3 -m venv .venv +# Activate venv source .venv/bin/activate +# Build in venv pip install build pytest python3 -m build pip install dist/lasp-*linux_x86_64.whl From 6bb15965d60ecc6dee22eff136c7c5f47c34db00 Mon Sep 17 00:00:00 2001 From: Anne de Jong Date: Thu, 5 Oct 2023 19:50:19 +0000 Subject: [PATCH 24/60] Update .gitea/workflows/workflow.yml --- .gitea/workflows/workflow.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index aaaf11a..9995a4c 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -31,5 +31,4 @@ jobs: files: |- dist/** api_key: '${{secrets.RELEASE_TOKEN}}' - if: gitea.ref == 'refs/heads/master' - + if: gitea.ref == 'refs/heads/master' \ No newline at end of file From 2d0d24a35a9eb1db5d0885ec87f61edb08a2da88 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Thu, 5 Oct 2023 21:52:51 +0200 Subject: [PATCH 25/60] Removed constraints on tag --- .gitea/workflows/workflow.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 9995a4c..b43c410 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -2,8 +2,6 @@ name: Building and testing LASP on: push: - tags: - - '*' jobs: Build-Test-Ubuntu: @@ -31,4 +29,5 @@ jobs: files: |- dist/** api_key: '${{secrets.RELEASE_TOKEN}}' - if: gitea.ref == 'refs/heads/master' \ No newline at end of file + if: gitea.ref == 'refs/heads/master' + From 2b060b77087add9995090e79fd1f50181172c904 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 9 Oct 2023 21:51:52 +0200 Subject: [PATCH 26/60] release action from gitea fork --- .gitea/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index b43c410..54db57c 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -24,7 +24,7 @@ jobs: needs: Build-Test-Ubuntu steps: - name: Release - uses: actions/release-action@main + uses: https://gitea.com/actions/release-action@main with: files: |- dist/** From 1bf32fe81dbfbc0c8c88d2548f9039d22f049d87 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 16:21:12 +0200 Subject: [PATCH 27/60] gitub ref? --- .gitea/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 54db57c..cff8672 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -29,5 +29,5 @@ jobs: files: |- dist/** api_key: '${{secrets.RELEASE_TOKEN}}' - if: gitea.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' From 9b44ff7262c2a61e95de0cea832d6747c901d96f Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 16:45:04 +0200 Subject: [PATCH 28/60] if on different level --- .gitea/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index cff8672..a178112 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -22,6 +22,7 @@ jobs: runs-on: ubuntu-latest container: ascee/ubuntu_build:latest needs: Build-Test-Ubuntu + if: gitea.ref == 'refs/heads/master' steps: - name: Release uses: https://gitea.com/actions/release-action@main @@ -29,5 +30,4 @@ jobs: files: |- dist/** api_key: '${{secrets.RELEASE_TOKEN}}' - if: github.ref == 'refs/heads/master' From 78181ebca9c47e4259979ecde9fec7dfc055dbad Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:03:55 +0200 Subject: [PATCH 29/60] Split two files. No other way possible? --- .gitea/workflows/master.yml | 28 ++++++++++++++++++++++++++++ .gitea/workflows/workflow.yml | 5 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/master.yml diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml new file mode 100644 index 0000000..feada41 --- /dev/null +++ b/.gitea/workflows/master.yml @@ -0,0 +1,28 @@ +name: Building and releasing LASP (master branch) +on: + push: + branches: + - master + +jobs: + Build-Test-Release-Ubuntu: + runs-on: ubuntu-latest + container: ascee/ubuntu_build:latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build + run: | + pip install build + python3 -m build + + - name: Release + uses: https://gitea.com/actions/release-action@main + with: + files: |- + dist/** + api_key: '${{secrets.RELEASE_TOKEN}}' + diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index a178112..46da048 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -1,7 +1,9 @@ -name: Building and testing LASP +name: Building and testing LASP (not-master branch) on: push: + branches: + - '!master' jobs: Build-Test-Ubuntu: @@ -31,3 +33,4 @@ jobs: dist/** api_key: '${{secrets.RELEASE_TOKEN}}' + From 6be9e14c131980ee190f8404eaf3a76d027802aa Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:13:59 +0200 Subject: [PATCH 30/60] Sigh............... Does this work? --- .gitea/workflows/master.yml | 8 ++++++-- .gitea/workflows/workflow.yml | 17 +++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index feada41..ac80e28 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -5,7 +5,7 @@ on: - master jobs: - Build-Test-Release-Ubuntu: + Build-Test-Ubuntu: runs-on: ubuntu-latest container: ascee/ubuntu_build:latest steps: @@ -18,9 +18,13 @@ jobs: run: | pip install build python3 -m build + pip install dist/lasp*.whl + pytest + Release-Ubuntu: + runs-on: ubuntu-latest - name: Release - uses: https://gitea.com/actions/release-action@main + uses: actions/release-action@main with: files: |- dist/** diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 46da048..b7cbe31 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -17,20 +17,9 @@ jobs: - name: Build run: | - pip install build + pip install build pytest python3 -m build - - Release-Ubuntu: - runs-on: ubuntu-latest - container: ascee/ubuntu_build:latest - needs: Build-Test-Ubuntu - if: gitea.ref == 'refs/heads/master' - steps: - - name: Release - uses: https://gitea.com/actions/release-action@main - with: - files: |- - dist/** - api_key: '${{secrets.RELEASE_TOKEN}}' + pip install dist/lasp*.whl + pytest From bab69c8018e8b5184e34506949c70c36d09fc526 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:18:09 +0200 Subject: [PATCH 31/60] Sigh............... Does this work? --- .gitea/workflows/master.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index ac80e28..67c9d0c 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -23,6 +23,7 @@ jobs: Release-Ubuntu: runs-on: ubuntu-latest + steps: - name: Release uses: actions/release-action@main with: From 8ef5fd5a64443b395dc117aa16dbc0fc8a92500c Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:22:35 +0200 Subject: [PATCH 32/60] With upload and download artifacts --- .gitea/workflows/master.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 67c9d0c..c6733e0 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -20,10 +20,20 @@ jobs: python3 -m build pip install dist/lasp*.whl pytest - + - name: Upload artifact + - uses: actions/upload-artifact@master + with: + name: Build files + path: dist Release-Ubuntu: runs-on: ubuntu-latest steps: + - name: Download artifacts + - uses: actions/download-artifact@master + with: + name: my-artifact + path: dist + - name: Release uses: actions/release-action@main with: From 03513b650225d06e0ebb4d9f11569f0715f20b10 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:23:31 +0200 Subject: [PATCH 33/60] With upload and download artifacts - now with yaml syntax correct --- .gitea/workflows/master.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index c6733e0..44741c5 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -21,18 +21,18 @@ jobs: pip install dist/lasp*.whl pytest - name: Upload artifact - - uses: actions/upload-artifact@master + uses: actions/upload-artifact@master with: name: Build files path: dist Release-Ubuntu: runs-on: ubuntu-latest steps: - - name: Download artifacts - - uses: actions/download-artifact@master - with: - name: my-artifact - path: dist + - name: Download artifacts + uses: actions/download-artifact@master + with: + name: my-artifact + path: dist - name: Release uses: actions/release-action@main From 2206f47cffa3b17059b1e3eec74ab29b1d5badd2 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:24:08 +0200 Subject: [PATCH 34/60] Forgot pytest --- .gitea/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 44741c5..3fd48d3 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -16,7 +16,7 @@ jobs: - name: Build run: | - pip install build + pip install build pytest python3 -m build pip install dist/lasp*.whl pytest From b9c42c1c2422c0a37903c4d48c2a871ad5392f8f Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:26:02 +0200 Subject: [PATCH 35/60] Checkout before --- .gitea/workflows/master.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 3fd48d3..2ac1296 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -28,6 +28,8 @@ jobs: Release-Ubuntu: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 - name: Download artifacts uses: actions/download-artifact@master with: From 02b95f9aa821daf2418a2b0a417f5dfb3f89abf4 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 17:36:44 +0200 Subject: [PATCH 36/60] Upload / download artifact. Test2 --- .gitea/workflows/master.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 2ac1296..18b3786 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -21,9 +21,9 @@ jobs: pip install dist/lasp*.whl pytest - name: Upload artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: - name: Build files + name: build_files path: dist Release-Ubuntu: runs-on: ubuntu-latest @@ -31,9 +31,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@master + uses: actions/download-artifact@v3 with: - name: my-artifact + name: build_files path: dist - name: Release From abbb3fee2c88aa84b5a192045748eb82c456a9cc Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 18:04:43 +0200 Subject: [PATCH 37/60] Specify release action from gitea --- .gitea/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 18b3786..7654cf2 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -37,7 +37,7 @@ jobs: path: dist - name: Release - uses: actions/release-action@main + uses: https://gitea.com/actions/release-action@main with: files: |- dist/** From 44c3782b46e52289ca9bbfab6ce67bb0c89cd70b Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Wed, 11 Oct 2023 18:14:32 +0200 Subject: [PATCH 38/60] Apparently release action requires golang --- .gitea/workflows/master.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 7654cf2..32d08c3 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -36,6 +36,8 @@ jobs: name: build_files path: dist + - name: Apparently Golang is required + uses: actions/setup-go@v4 - name: Release uses: https://gitea.com/actions/release-action@main with: From 5565b10fb2c3c23bdc633655d1df885e8c1350e7 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Thu, 12 Oct 2023 16:28:02 +0200 Subject: [PATCH 39/60] Upload and download artifact test 2 --- .gitea/workflows/master.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 32d08c3..17b9624 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -25,19 +25,23 @@ jobs: with: name: build_files path: dist + Release-Ubuntu: runs-on: ubuntu-latest + needs: Build-Test-Ubuntu steps: + - name: Checkout uses: actions/checkout@v4 + - name: Download artifacts uses: actions/download-artifact@v3 with: name: build_files - path: dist - name: Apparently Golang is required uses: actions/setup-go@v4 + - name: Release uses: https://gitea.com/actions/release-action@main with: From 7857c3aed5fee4ccbb5ab2388c70edeaf014d1b3 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Fri, 13 Oct 2023 11:26:36 +0200 Subject: [PATCH 40/60] Go v3? --- .gitea/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 17b9624..25964da 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -40,7 +40,7 @@ jobs: name: build_files - name: Apparently Golang is required - uses: actions/setup-go@v4 + uses: actions/setup-go@v3 - name: Release uses: https://gitea.com/actions/release-action@main From 941b83abe8ed3ca26f86d2e39e62cad8ae94b69d Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Fri, 13 Oct 2023 11:34:10 +0200 Subject: [PATCH 41/60] Try with catthehacker image --- .gitea/workflows/master.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 25964da..adfa3e8 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -28,6 +28,7 @@ jobs: Release-Ubuntu: runs-on: ubuntu-latest + image: catthehacker/ubuntu:act-latest needs: Build-Test-Ubuntu steps: From 749d5354c9f9c5b9878693ccf3b1b30c3702ef57 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Fri, 13 Oct 2023 12:30:31 +0200 Subject: [PATCH 42/60] Install golang manually --- .gitea/workflows/master.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index adfa3e8..ce3c25f 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -28,7 +28,6 @@ jobs: Release-Ubuntu: runs-on: ubuntu-latest - image: catthehacker/ubuntu:act-latest needs: Build-Test-Ubuntu steps: @@ -40,8 +39,8 @@ jobs: with: name: build_files - - name: Apparently Golang is required - uses: actions/setup-go@v3 + - name: Apparently Golang is required (install manually) + run: apt update && apt install -y golang - name: Release uses: https://gitea.com/actions/release-action@main From bf6a18bcf88cbcfb1df473303241992e80bf2b82 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 13:37:18 +0200 Subject: [PATCH 43/60] Use a volume to share state --- .gitea/workflows/master.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index ce3c25f..a4230a3 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -7,7 +7,10 @@ on: jobs: Build-Test-Ubuntu: runs-on: ubuntu-latest - container: ascee/ubuntu_build:latest + container: + image: ascee/ubuntu_build:latest + volumes: + - dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -20,25 +23,22 @@ jobs: python3 -m build pip install dist/lasp*.whl pytest - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: build_files - path: dist + - name: Copy dist + run: + cp dist/* /dist Release-Ubuntu: runs-on: ubuntu-latest needs: Build-Test-Ubuntu + container: + volumes: + - dist:/dist + steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: build_files - - name: Apparently Golang is required (install manually) run: apt update && apt install -y golang @@ -46,6 +46,6 @@ jobs: uses: https://gitea.com/actions/release-action@main with: files: |- - dist/** + /dist/** api_key: '${{secrets.RELEASE_TOKEN}}' From bcbb5b0720f892a0543f6cee89eda6f288845ac2 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 13:44:55 +0200 Subject: [PATCH 44/60] More explicit name of volume --- .gitea/workflows/master.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index a4230a3..7c1e0bb 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -10,7 +10,7 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - - dist:/dist + - lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -32,7 +32,7 @@ jobs: needs: Build-Test-Ubuntu container: volumes: - - dist:/dist + - lasp_dist:/dist steps: From 24f849d9ee3e0089cef3bda9caf6d5225cd1e670 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 13:49:04 +0200 Subject: [PATCH 45/60] Should be host volume --- .gitea/workflows/master.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 7c1e0bb..ff6ee43 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -10,7 +10,7 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - - lasp_dist:/dist + - /docker_volumes/lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -32,7 +32,7 @@ jobs: needs: Build-Test-Ubuntu container: volumes: - - lasp_dist:/dist + - /docker_volumes/lasp_dist:/dist steps: From db9a1a28a532102e19c4c33f5a85fd0527be9d7e Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 14:14:36 +0200 Subject: [PATCH 46/60] Volumes should be specified in runner config --- .gitea/workflows/master.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index ff6ee43..5d29996 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -10,7 +10,8 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - - /docker_volumes/lasp_dist:/dist + # Volumes should also be specified in config.yml of the act runner + - lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -32,7 +33,7 @@ jobs: needs: Build-Test-Ubuntu container: volumes: - - /docker_volumes/lasp_dist:/dist + - lasp_dist:/dist steps: From 07b2d97e7a14cfbe3ffbf899abb211c51238d2e1 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 14:26:02 +0200 Subject: [PATCH 47/60] Sigh. requires go 1.18 --- .gitea/workflows/master.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 5d29996..d59d218 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -39,10 +39,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - - name: Apparently Golang is required (install manually) - run: apt update && apt install -y golang - + - name: setup go + uses: https://github.com/actions/setup-go@v4 + with: + go-version: '1.18' - name: Release uses: https://gitea.com/actions/release-action@main with: From 402425ebd128a542985f101db64933ae5f33c535 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 14:58:00 +0200 Subject: [PATCH 48/60] Test with only release. Removed last line --- .gitea/workflows/master.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index d59d218..5bf5746 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -26,7 +26,7 @@ jobs: pytest - name: Copy dist run: - cp dist/* /dist + cp -v dist/* /dist Release-Ubuntu: runs-on: ubuntu-latest @@ -37,16 +37,15 @@ jobs: steps: - - name: Checkout - uses: actions/checkout@v4 - - name: setup go - uses: https://github.com/actions/setup-go@v4 - with: - go-version: '1.18' + # - name: Checkout + # uses: actions/checkout@v4 + # - name: setup go + # uses: https://github.com/actions/setup-go@v4 + # with: + # go-version: '1.18' - name: Release uses: https://gitea.com/actions/release-action@main with: files: |- /dist/** api_key: '${{secrets.RELEASE_TOKEN}}' - From 592448eea9a32fa8f3c9cb218a4558245e1189d7 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:17:00 +0200 Subject: [PATCH 49/60] Release when tag. That is the only way the release action is working --- .gitea/workflows/master.yml | 51 ----------------------------------- .gitea/workflows/workflow.yml | 33 +++++++++++++++++++---- 2 files changed, 28 insertions(+), 56 deletions(-) delete mode 100644 .gitea/workflows/master.yml diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml deleted file mode 100644 index 5bf5746..0000000 --- a/.gitea/workflows/master.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Building and releasing LASP (master branch) -on: - push: - branches: - - master - -jobs: - Build-Test-Ubuntu: - runs-on: ubuntu-latest - container: - image: ascee/ubuntu_build:latest - volumes: - # Volumes should also be specified in config.yml of the act runner - - lasp_dist:/dist - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - - name: Build - run: | - pip install build pytest - python3 -m build - pip install dist/lasp*.whl - pytest - - name: Copy dist - run: - cp -v dist/* /dist - - Release-Ubuntu: - runs-on: ubuntu-latest - needs: Build-Test-Ubuntu - container: - volumes: - - lasp_dist:/dist - - steps: - - # - name: Checkout - # uses: actions/checkout@v4 - # - name: setup go - # uses: https://github.com/actions/setup-go@v4 - # with: - # go-version: '1.18' - - name: Release - uses: https://gitea.com/actions/release-action@main - with: - files: |- - /dist/** - api_key: '${{secrets.RELEASE_TOKEN}}' diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index b7cbe31..38ff713 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -1,9 +1,7 @@ -name: Building and testing LASP (not-master branch) +name: Building, testing and releasing LASP if it has a tag on: - push: - branches: - - '!master' + - push jobs: Build-Test-Ubuntu: @@ -15,11 +13,36 @@ jobs: with: submodules: true - - name: Build + - name: Build and test run: | pip install build pytest python3 -m build pip install dist/lasp*.whl pytest + - name: Copy dist files to /dist dir + run: + cp -v dist/* /dist + Release-Ubuntu: + runs-on: ubuntu-latest + needs: Build-Test-Ubuntu + if: startsWith(gitea.ref, 'refs/tags/v') + container: + volumes: + - lasp_dist:/dist + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: setup go + uses: https://github.com/actions/setup-go@v4 + with: + go-version: '1.18' + - name: Release + uses: https://gitea.com/actions/release-action@main + with: + files: |- + /dist/** + api_key: '${{secrets.RELEASE_TOKEN}}' From 5b76ff007cbb66064eede16e259f1ada5ac77c08 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:24:20 +0200 Subject: [PATCH 50/60] Added volumes --- .gitea/workflows/workflow.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 38ff713..9b5edf3 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -6,7 +6,10 @@ on: jobs: Build-Test-Ubuntu: runs-on: ubuntu-latest - container: ascee/ubuntu_build:latest + container: + image: ascee/ubuntu_build:latest + volumes: + lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -26,6 +29,9 @@ jobs: Release-Ubuntu: runs-on: ubuntu-latest + container: + volumes: + lasp_dist:/dist needs: Build-Test-Ubuntu if: startsWith(gitea.ref, 'refs/tags/v') container: From 67ff10b5e55da93600bec249b618531aebed698b Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:26:42 +0200 Subject: [PATCH 51/60] Forgot dash --- .gitea/workflows/workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 9b5edf3..93447ee 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -9,7 +9,7 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - lasp_dist:/dist + - lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest container: volumes: - lasp_dist:/dist + - lasp_dist:/dist needs: Build-Test-Ubuntu if: startsWith(gitea.ref, 'refs/tags/v') container: From a72284880d072e8285880d2a20d110ae088ea42c Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:28:11 +0200 Subject: [PATCH 52/60] Twice container key --- .gitea/workflows/workflow.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 93447ee..0eff31a 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -34,10 +34,6 @@ jobs: - lasp_dist:/dist needs: Build-Test-Ubuntu if: startsWith(gitea.ref, 'refs/tags/v') - container: - volumes: - - lasp_dist:/dist - steps: - name: Checkout uses: actions/checkout@v4 From ab103b74f71002ecb3177970c0a19806cfb13a11 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:36:15 +0200 Subject: [PATCH 53/60] Set working directory correct for release action. Is apparently required --- .gitea/workflows/workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 0eff31a..bbde113 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -44,6 +44,7 @@ jobs: go-version: '1.18' - name: Release uses: https://gitea.com/actions/release-action@main + working-directory: "/" with: files: |- /dist/** From 5ca899fa0a33948feb25e8a5b8cf79a004d96e1c Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:43:17 +0200 Subject: [PATCH 54/60] Volume not mounted absolute, but in repo. --- .gitea/workflows/workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index bbde113..6e84f22 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -9,7 +9,7 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - - lasp_dist:/dist + - lasp_dist:./dist steps: - name: Checkout uses: actions/checkout@v4 @@ -47,5 +47,5 @@ jobs: working-directory: "/" with: files: |- - /dist/** + ./dist/** api_key: '${{secrets.RELEASE_TOKEN}}' From de3ef1b4c1a44e67d26cc217695bfc810f0318ce Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:53:06 +0200 Subject: [PATCH 55/60] Apparently path may not be absolute. What a inflexible release system! --- .gitea/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 6e84f22..57621d6 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -47,5 +47,5 @@ jobs: working-directory: "/" with: files: |- - ./dist/** + ../../../../../dist/** api_key: '${{secrets.RELEASE_TOKEN}}' From 152d6d635d8b49d73c34034fdd66db056767c468 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE / Redu-Sone B.V." Date: Mon, 16 Oct 2023 15:54:08 +0200 Subject: [PATCH 56/60] Apparently path may not be absolute. What a inflexible release system! --- .gitea/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 57621d6..919eb98 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -9,7 +9,7 @@ jobs: container: image: ascee/ubuntu_build:latest volumes: - - lasp_dist:./dist + - lasp_dist:/dist steps: - name: Checkout uses: actions/checkout@v4 From bfa670436076407917620e3bd04c69d503dacf15 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 24 Oct 2023 15:13:06 +0200 Subject: [PATCH 57/60] New armadillo version, some updates in pyproject and README --- README.md | 24 ++++++++++++++++++++---- pyproject.toml | 4 ++-- third_party/armadillo-code | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 802c53e..a950ae8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Library for Acoustic Signal Processing -- Master branch: [![Build Status](https://drone.ascee.nl/api/badges/ASCEE/lasp/status.svg?ref=refs/heads/master)](https://drone.ascee.nl/ASCEE/lasp) -- Develop branch: [![Build Status](https://drone.ascee.nl/api/badges/ASCEE/lasp/status.svg?ref=refs/heads/develop)](https://drone.ascee.nl/ASCEE/lasp) - Welcome to LASP: Library for Acoustic Signal Processing. LASP is a C++ library with a Python interface which is supposed to acquire and process (multi) sensor data in real time on a PC and output results. @@ -48,7 +45,26 @@ If you have any question(s), please feel free to contact us: [email](info@ascee. # Installation - Linux (Debian-based) -## Dependencies +## From wheel (recommended for non-developers) + +### Prerequisites + +Run the following on the command line to install all prerequisites on +Debian-based Linux: + +- `sudo apt install python3-pip libfftw3-3 libopenblas-base libusb-1.0-0 + libpulse0` + +### Download and install LASP + +Go to: [LASP releases](https://code.ascee.nl/ASCEE/lasp/releases/latest/) and +download the latest `.whl`. Then run: + +- `pip install lasp-*-linux_x86_64.whl` + +## From source (Debian) + +### Prerequisites One-liner: diff --git a/pyproject.toml b/pyproject.toml index 41b30ad..a2aface 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,8 +22,8 @@ classifiers = [ ] urls = { "Documentation" = "https://lasp.ascee.nl" } -dependencies = ["scipy", "numpy", "matplotlib>=3.7.2", "appdirs", "dataclasses_json", - "h5py", "pybind11"] +dependencies = ["scipy", "numpy", "matplotlib>=3.7.2", "appdirs", + "dataclasses_json", "h5py"] [build-system] # How pip and other frontends should build this project requires = ["py-build-cmake~=0.1.8", "pybind11" ] diff --git a/third_party/armadillo-code b/third_party/armadillo-code index 3865a05..b6e810f 160000 --- a/third_party/armadillo-code +++ b/third_party/armadillo-code @@ -1 +1 @@ -Subproject commit 3865a0520d577ac293d88c4fd726a41bda949869 +Subproject commit b6e810f2d33bcc234d67db5277d027949fec82f8 From ee7e5fbba936b6cda3b0743f818d632e3c94aeaf Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 24 Oct 2023 15:14:37 +0200 Subject: [PATCH 58/60] Added test_input.py --- examples/test_input.py | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 examples/test_input.py diff --git a/examples/test_input.py b/examples/test_input.py new file mode 100755 index 0000000..c248836 --- /dev/null +++ b/examples/test_input.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import lasp +# Get handle to stream manager +mgr = lasp.StreamMgr.getInstance() +import time +time.sleep(1) + +ds = mgr.getDeviceInfo() +# Search for a device +for i, d in enumerate(ds): + print(f'{i}: ' + d.device_name) + +d = ds[0] # Create a configuration and enable some input channels +config = lasp.DaqConfiguration(d) +config.inchannel_config[0].enabled = True +config.inchannel_config[1].enabled = True +# Choose a different number of frames per block +config.framesPerBlockIndex = 2 + +# Start a stream with a configuration +mgr.startStream(config) + +def reset_cb(daq): + print('Reset called') + +def cb(data): + # Print something on callback + print(data.shape) + return True + + +# Attach the indata handler to the stream +#i = lasp.InDataHandler(mgr, cb, reset_cb) + +ppm = lasp.PPMHandler(mgr) +#del ppm +del mgr + +#del i +try: + while True: + val, clip = ppm.getCurrentValue() + print(val) + time.sleep(0.1) + + #print(f'{val[0]} {val[1]}', end='') +except KeyboardInterrupt: + pass +# mgr.stopStream(lasp.StreamMgr.StreamType.input) From e4f887dc5bc6dae708355af87015104b5b9f9540 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 24 Oct 2023 19:47:35 +0200 Subject: [PATCH 59/60] Renamed test_input.py to example_input.py --- .gitignore | 4 +--- README.md | 28 +++++++----------------- examples/test_input.py | 49 ------------------------------------------ 3 files changed, 9 insertions(+), 72 deletions(-) delete mode 100755 examples/test_input.py diff --git a/.gitignore b/.gitignore index 87c0172..e74d8ac 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,6 @@ .ninja* build.ninja dist -src/lasp.egg-info -test/.ipynb_checkpoints -src/lasp/lasp_config.h _deps compile_commands.json CMakeFiles @@ -23,3 +20,4 @@ doc acme_log.log .venv .py-build-cmake_cache +cpp_src/lasp_config.h diff --git a/README.md b/README.md index a950ae8..401cae6 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ in a sister repository [lasp-doc](https://code.ascee.nl/ascee/lasp-doc). If you have any question(s), please feel free to contact us: [email](info@ascee.nl). -# Installation - Linux (Debian-based) +# Installation - Linux (Ubuntu-based) ## From wheel (recommended for non-developers) @@ -62,39 +62,27 @@ download the latest `.whl`. Then run: - `pip install lasp-*-linux_x86_64.whl` -## From source (Debian) +## From source (Ubuntu-based) ### Prerequisites -One-liner: - -- `$ sudo apt install python3-pybind11 libopenblas-dev python3-pip python3-scipy libusb-1.0-0-dev libpulse-dev cmake-curses-gui python3-h5py python3-dataclasses-json python3-matplotlib python3-appdirs` +Run the following one-liner: +- `sudo apt install -y git python3 python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build` If building RtAudio with the ALSA backend, you will also require the following packages: -- libclalsadrv-dev +- `sudo apt install libclalsadrv-dev` If building RtAudio with the Jack Audio Connection Kit (JACK) backend, you will also require the following packages: -- libjack-jackd2-dev +- `sudo apt install libjack-jackd2-dev` -## Download & build +### Download & build - `$ git clone --recursive https://code.ascee.nl/ASCEE/lasp.git` - `$ cd lasp` - -For a release build: - -- `$ cmake .` - -or optionally for a custom build: - -- `$ ccmake .` - -Configure and run: - -- `$ make -j` +- `pip install -e .` # Installation - (x86_64) Windows (with WinPython), build with MSYS2 diff --git a/examples/test_input.py b/examples/test_input.py deleted file mode 100755 index c248836..0000000 --- a/examples/test_input.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 -import lasp -# Get handle to stream manager -mgr = lasp.StreamMgr.getInstance() -import time -time.sleep(1) - -ds = mgr.getDeviceInfo() -# Search for a device -for i, d in enumerate(ds): - print(f'{i}: ' + d.device_name) - -d = ds[0] # Create a configuration and enable some input channels -config = lasp.DaqConfiguration(d) -config.inchannel_config[0].enabled = True -config.inchannel_config[1].enabled = True -# Choose a different number of frames per block -config.framesPerBlockIndex = 2 - -# Start a stream with a configuration -mgr.startStream(config) - -def reset_cb(daq): - print('Reset called') - -def cb(data): - # Print something on callback - print(data.shape) - return True - - -# Attach the indata handler to the stream -#i = lasp.InDataHandler(mgr, cb, reset_cb) - -ppm = lasp.PPMHandler(mgr) -#del ppm -del mgr - -#del i -try: - while True: - val, clip = ppm.getCurrentValue() - print(val) - time.sleep(0.1) - - #print(f'{val[0]} {val[1]}', end='') -except KeyboardInterrupt: - pass -# mgr.stopStream(lasp.StreamMgr.StreamType.input) From a7b219a1e10b8ea65210a93066b1e738aaba00ea Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Tue, 24 Oct 2023 19:49:56 +0200 Subject: [PATCH 60/60] Updated readme --- README.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 401cae6..c0c0b9c 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ If building RtAudio with the Jack Audio Connection Kit (JACK) backend, you will - `$ cd lasp` - `pip install -e .` -# Installation - (x86_64) Windows (with WinPython), build with MSYS2 +# Installation - (x86_64) Windows (with WinPython), build with MSYS2 (NOT YET UPDATED!!) ## Prerequisites @@ -117,7 +117,11 @@ If building RtAudio with the Jack Audio Connection Kit (JACK) backend, you will # Documentation -In directory: +## Online + +[Online LASP documentation](https://lasp.ascee.nl/). + +## In directory `$ sudo apt install doxygen graphviz` `$ pip install doxypypy` @@ -130,21 +134,7 @@ This will build the documentation. It can be read by: `$ doc/html/index.html` -Or via docker: - -`$ docker build -t lasp_ascee_nl:latest .` - -## Install - -For an editable install (while developing): - -- `$ pip3 install --prefix=$HOME/.local -e .` - -To install locally, for a fixed version: - -- `$ pip3 install --prefix=$HOME/.local` - -## Usage +# Usage - See examples directories for IPython notebooks. - Please refer to the [documentation](https://lasp.ascee.nl/) for features.