Skip to content

Commit 3ff03cb

Browse files
committed
Merge branch 'master' into json_output
2 parents 0d8261e + d657f74 commit 3ff03cb

File tree

127 files changed

+3955
-4566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3955
-4566
lines changed

.github/workflows/cmake.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
sudo apt update
3636
sudo apt install gcc-14 g++-14 -y
3737
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14 --slave /usr/bin/g++ g++ /usr/bin/g++-14
38-
sudo apt-get install libz-dev libbz2-dev liblzma-dev libboost-python-dev libflac-dev libnetcdf-dev libpython3-dev
39-
sudo pip install numpy scipy matplotlib astropy healpy sphinx --break-system-packages
38+
sudo apt-get install libz-dev libbz2-dev liblzma-dev libflac-dev libnetcdf-dev libpython3-dev
39+
sudo pip install numpy scipy matplotlib astropy healpy sphinx sphinx-rtd-theme --break-system-packages
4040
4141
- name: Setup python on macOS
4242
if: runner.environment == 'github-hosted' && runner.os == 'macOS'
@@ -47,8 +47,8 @@ jobs:
4747
- name: Install macOS Dependencies
4848
if: runner.environment == 'github-hosted' && runner.os == 'macOS'
4949
run: |
50-
brew install --overwrite bzip2 xz boost-python3 flac netcdf
51-
python3.13 -m pip install numpy scipy matplotlib astropy healpy sphinx --break-system-packages
50+
brew install --overwrite bzip2 xz flac netcdf
51+
python3.13 -m pip install numpy scipy matplotlib astropy healpy sphinx sphinx-rtd-theme --break-system-packages
5252
5353
- name: Create Build Environment
5454
# Some projects don't allow in-source building, so create a separate build directory

.github/workflows/wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ jobs:
8383
fetch-tags: true
8484

8585
- name: Build wheels
86-
uses: pypa/cibuildwheel@v2.23.2
86+
uses: pypa/cibuildwheel@v2.23.3
8787
env:
8888
CIBW_BUILD: ${{ matrix.build }}
8989
CIBW_BEFORE_ALL_LINUX: yum install -y zlib-devel bzip2-devel xz-devel netcdf-devel
9090
CIBW_BEFORE_ALL_MACOS: brew install netcdf
9191
CIBW_BEFORE_BUILD_MACOS: >
9292
ln -s $(dirname $(readlink -f $(which python3)))/python3-config $(dirname $(which python3))/python3-config &&
93-
pip install cmake && ./deps/install_flac.sh && ./deps/install_boost.sh
93+
pip install cmake && ./deps/install_flac.sh
9494
CIBW_BEFORE_BUILD_LINUX: >
95-
pip install cmake && ./deps/install_flac.sh && ./deps/install_boost.sh
95+
pip install cmake && ./deps/install_flac.sh
9696
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
9797
LD_LIBRARY_PATH=$PWD/deps/lib auditwheel repair -w {dest_dir} {wheel}
9898
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ install_manifest.txt
99
*.pyc
1010
__pycache__
1111
build
12-
doc/module-autodocs.rst
13-
doc/moddoc_*
1412
*.g3
1513
.DS_Store
16-
.idea/
14+
.idea/

CMakeLists.txt

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
cmake_minimum_required(VERSION 3.12)
2-
# Don't warn about removal of FindBoost in cmake 3.30+
3-
if(POLICY CMP0167)
4-
cmake_policy(SET CMP0167 NEW)
5-
endif()
62

73
project(spt3g)
84
enable_testing()
@@ -37,7 +33,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
3733

3834
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3935

40-
# Find all the Boost and Python libraries
36+
# Find all the Python libraries
4137
set(THREADS_PREFER_PTHREAD_FLAG ON)
4238
find_package(Threads REQUIRED)
4339

@@ -48,11 +44,28 @@ else()
4844
find_package(Python COMPONENTS Interpreter Development REQUIRED)
4945
endif()
5046

51-
set(Boost_USE_STATIC_LIBS OFF)
52-
set(Boost_USE_MULTITHREADED ON)
53-
set(Boost_USE_STATIC_RUNTIME OFF)
54-
set(Boost_PYTHON_VERSION ${Python_VERSION})
55-
find_package(Boost COMPONENTS python REQUIRED)
47+
# Find pybind11
48+
set(PYBIND11_FINDPYTHON ON)
49+
find_package(pybind11 2.13 QUIET)
50+
if (pybind11_FOUND)
51+
message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version \"${pybind11_VERSION}\")")
52+
else()
53+
if (NOT pybind11_DIR)
54+
# download if necessary
55+
include(FetchContent)
56+
FetchContent_Declare(
57+
pybind11
58+
GIT_REPOSITORY https://github.com/pybind/pybind11.git
59+
GIT_TAG v2.13.6
60+
)
61+
FetchContent_MakeAvailable(pybind11)
62+
else()
63+
find_package(pybind11 2.13 CONFIG REQUIRED)
64+
endif()
65+
endif()
66+
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
67+
add_compile_definitions(PYBIND11_DETAILED_ERROR_MESSAGES)
68+
endif()
5669

5770
# Interface library for flags and library dependencies
5871
add_library(spt3g INTERFACE)
@@ -65,27 +78,11 @@ if (SPT3G_VERSION)
6578
endif()
6679

6780
target_compile_features(spt3g INTERFACE cxx_std_17)
68-
target_include_directories(spt3g INTERFACE ${Boost_INCLUDE_DIR})
69-
target_link_libraries(spt3g INTERFACE Threads::Threads Boost::python)
81+
target_link_libraries(spt3g INTERFACE Threads::Threads)
7082
target_include_directories(spt3g INTERFACE $<INSTALL_INTERFACE:${SPT3G_INCLUDE_INSTALL_DIR}>)
7183

7284
# Python bindings
73-
if(TARGET Python::Module)
74-
target_link_libraries(spt3g INTERFACE Python::Module)
75-
else()
76-
target_include_directories(spt3g INTERFACE ${Python_INCLUDE_DIRS})
77-
if(APPLE)
78-
target_link_options(spt3g INTERFACE "LINKER:-undefined,dynamic_lookup")
79-
endif()
80-
endif()
81-
82-
# Work around yet more bugs in GCC 4.4, this time with C++ 11 support
83-
# Also increase maximum number of arguments in python bindings
84-
target_compile_definitions(spt3g INTERFACE -DBOOST_PYTHON_MAX_ARITY=20
85-
-DBOOST_ALLOW_DEPRECATED_HEADERS)
86-
if(Boost_VERSION VERSION_LESS 1.77)
87-
target_compile_definitions(spt3g INTERFACE -DBOOST_BIND_GLOBAL_PLACEHOLDERS)
88-
endif()
85+
target_link_libraries(spt3g INTERFACE pybind11::module)
8986

9087
# Shell script to set environment variables
9188
configure_file(${CMAKE_SOURCE_DIR}/cmake/env-shell.sh.in ${CMAKE_BINARY_DIR}/env-shell.sh @ONLY)
@@ -175,7 +172,7 @@ add_custom_target(tarball
175172
add_custom_target(docs
176173
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/gen_per_module_docs.cmake ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${Python_EXECUTABLE}
177174
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/docs
178-
COMMAND which sphinx-build && sphinx-build -b html ${CMAKE_SOURCE_DIR}/doc ${CMAKE_BINARY_DIR}/docs || echo "Error: sphinx-build not found. Could not generate HTML docs."
175+
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:$ENV{PYTHONPATH} LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH} sphinx-build -b html ${CMAKE_SOURCE_DIR}/doc ${CMAKE_BINARY_DIR}/docs
179176
COMMENT "Generate HTML documentation")
180177

181178
# Set up installation

README.rst

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,31 @@ The main documentation for the software is in the docs folder. After building th
2424
Dependencies
2525
------------
2626

27-
This depends on Boost and cmake, as well as the usual Python packages. Some additional packages (NetCDF, in particular) will activate optional components of the code if installed. You also need a C++11 compiler. This software is designed to run and work on a variety of operating systems (all Linuxes, Mac OS X, and FreeBSD) and architectures (at least 64-bit x86 and POWER).
27+
This depends on pybind11 and cmake, as well as the usual Python packages. Some additional packages (NetCDF, in particular) will activate optional components of the code if installed. You also need a C++11 compiler. This software is designed to run and work on a variety of operating systems (all Linuxes, Mac OS X, and FreeBSD) and architectures (at least 64-bit x86 and POWER).
2828

2929
Minimum versions:
3030

3131
- GCC >= 5.0 or clang >= 3.4
32-
- Boost >= 1.63
32+
- pybind11 >= 2.13
3333
- cmake >= 3.12
34-
- Python >= 2.7 (although pre-Python-3 support is best-effort)
34+
- Python >= 3.7 (although pre-Python-3.8 support is best-effort)
3535

3636
On Ubuntu/Debian, you can install the non-Python dependencies, including the optional ones, by doing:
3737

3838
.. code-block:: shell
3939
40-
apt-get install cmake libboost-python-dev libflac-dev libnetcdf-dev
40+
apt-get install cmake libz-dev libbz2-dev liblzma-dev libflac-dev libnetcdf-dev
4141
4242
On RHEL-type systems (SL, CentOS, etc.), do this:
4343

4444
.. code-block:: shell
4545
46-
yum install cmake netcdf-devel boost-devel flac-devel
46+
yum install cmake netcdf-devel zlib-devel bz2-devel xz-devel flac-devel
4747
4848
If your system defaults to Python 2, but you wish to use Python 3, please do the following:
4949

5050
1. Install Python 3 *from the system package manager*
51-
2. Make sure the python-3 version of the Boost library is installed (on Ubuntu, this is part of the standard boost-python package referenced above)
52-
3. When you run cmake below, pass ``-DPython_EXECUTABLE=`which python3```
51+
2. When you run cmake below, pass ``-DPython_EXECUTABLE=`which python3```
5352

5453
On any system, this software requires numpy and scipy (hard requirements), plus astropy and healpy (optional).
5554

@@ -124,7 +123,7 @@ For pre-built wheels hosted on `PyPI`_, available for most Linux x86_64, macOS x
124123
125124
pip install spt3g
126125
127-
The hosted wheels will include the necessary libraries (Boost, etc) bundled with the package. Otherwise, ensure that the dependency libraries are installed as explained above, and processed to one of the following steps.
126+
The hosted wheels will include the necessary libraries (flac, etc) bundled with the package. Otherwise, ensure that the dependency libraries are installed as explained above, and processed to one of the following steps.
128127

129128
To install the package from the github repo, run ``pip`` as usual (this may take a while, so consider setting the ``CMAKE_BUILD_PARALLEL_LEVEL`` environment variable):
130129

@@ -174,10 +173,7 @@ Use the ``git archive`` command or the Python ``build`` package to export the so
174173
Version Control Hygiene
175174
-----------------------
176175

177-
You can use two mechanisms to access the repository: git and SVN. The following is a brief overview of how to use these in a way that your collaborators will appreciate.
178-
179-
Git
180-
===
176+
The following is a brief overview of how to use git in a way that your collaborators will appreciate.
181177

182178
To initially check out the repository:
183179

@@ -199,26 +195,3 @@ To send your changes back:
199195
git commit files_to_commit
200196
git push
201197
202-
203-
SVN
204-
===
205-
206-
To initially check out the repository:
207-
208-
.. code-block:: shell
209-
210-
svn co https://user@github.com/CMB-S4/spt3g_software/trunk spt3g_software
211-
212-
To update your checkout:
213-
214-
.. code-block:: shell
215-
216-
svn up
217-
218-
To send your changes back:
219-
220-
.. code-block:: shell
221-
222-
svn diff files_to_commit <- Examine this
223-
svn ci files_to_commit
224-

calibration/python/build_cal_frames.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def ExplodeBolometerProperties(frame, bpmname='NominalBolometerProperties'):
268268
yoff = core.G3MapDouble()
269269
coupling = core.G3MapInt()
270270

271-
for bolo, p in bpm.iteritems():
271+
for bolo, p in bpm.items():
272272
polangle[bolo] = p.pol_angle
273273
poleff[bolo] = p.pol_efficiency
274274
bands[bolo] = p.band

calibration/src/BoloProperties.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ G3_SERIALIZABLE_CODE(BolometerProperties);
5858
G3_SERIALIZABLE_CODE(BolometerPropertiesMap);
5959

6060
PYBINDINGS("calibration", scope) {
61+
register_enum<BolometerProperties::CouplingType>(scope, "BolometerCouplingType",
62+
"Coupling type for BolometerProperties objects.")
63+
.value("Unknown", BolometerProperties::Unknown)
64+
.value("Optical", BolometerProperties::Optical)
65+
.value("DarkTermination", BolometerProperties::DarkTermination)
66+
.value("DarkCrossover", BolometerProperties::DarkCrossover)
67+
.value("Resistor", BolometerProperties::Resistor)
68+
.value("Loopback", BolometerProperties::Loopback)
69+
.value("OffResonance", BolometerProperties::OffResonance)
70+
;
71+
6172
register_frameobject<BolometerProperties>(scope, "BolometerProperties",
6273
"Physical bolometer properties, such as detector angular offsets. "
6374
"Does not include tuning-dependent properties of the detectors.")
@@ -90,17 +101,6 @@ PYBINDINGS("calibration", scope) {
90101
"Name of the pixel type of which this detector is a part")
91102
;
92103

93-
register_enum<BolometerProperties::CouplingType>(scope, "BolometerCouplingType",
94-
"Coupling type for BolometerProperties objects.")
95-
.value("Unknown", BolometerProperties::Unknown)
96-
.value("Optical", BolometerProperties::Optical)
97-
.value("DarkTermination", BolometerProperties::DarkTermination)
98-
.value("DarkCrossover", BolometerProperties::DarkCrossover)
99-
.value("Resistor", BolometerProperties::Resistor)
100-
.value("Loopback", BolometerProperties::Loopback)
101-
.value("OffResonance", BolometerProperties::OffResonance)
102-
;
103-
104104
register_g3map<BolometerPropertiesMap>(scope, "BolometerPropertiesMap",
105105
"Container for bolometer properties for focal plane, mapping "
106106
"logical bolometer IDs to their physical properties.");

cmake/FindFFTW.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# - Find FFTW
22
# Find the native FFTW includes and library
33
#
4-
# FFTW_INCLUDES - where to find fftw3.h
4+
# FFTW_INCLUDE_DIRS - where to find fftw3.h
55
# FFTW_LIBRARIES - List of libraries when using FFTW.
66
# FFTW_FOUND - True if FFTW found.
7-
if (FFTW_INCLUDES)
7+
if (FFTW_INCLUDE_DIRS)
88
# Already in cache, be silent
99
set (FFTW_FIND_QUIETLY TRUE)
10-
endif (FFTW_INCLUDES)
11-
find_path (FFTW_INCLUDES fftw3.h HINTS ENV FFTW_INC)
10+
endif (FFTW_INCLUDE_DIRS)
11+
find_path (FFTW_INCLUDE_DIRS fftw3.h HINTS ENV FFTW_INC)
1212
find_library (FFTW_LIBRARIES NAMES fftw3 HINTS ENV FFTW_DIR)
1313

1414

@@ -22,5 +22,5 @@ mark_as_advanced(FFTW_THREADS_LIBRARY)
2222

2323
# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
2424
# all listed variables are TRUE
25-
find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES)
26-
mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES)
25+
find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_DIRS)
26+
mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDE_DIRS)

cmake/FindGSL.cmake

Lines changed: 0 additions & 19 deletions
This file was deleted.

cmake/Spt3gConfig.cmake.in

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ else()
3838
find_dependency(Python COMPONENTS Interpreter Development REQUIRED)
3939
endif()
4040

41-
set(Boost_USE_STATIC_LIBS @Boost_USE_STATIC_LIBS@)
42-
set(Boost_USE_MULTITHREADED @Boost_USE_MULTITHREADED@)
43-
set(Boost_USE_STATIC_RUNTIME @Boost_USE_STATIC_RUNTIME@)
44-
set(Boost_PYTHON_VERSION @Boost_PYTHON_VERSION@)
45-
find_dependency(Boost COMPONENTS python REQUIRED)
41+
find_dependency(pybind11 CONFIG REQUIRED)
4642

4743
include(FindPackageHandleStandardArgs)
4844
find_package_handle_standard_args(Spt3g

0 commit comments

Comments
 (0)