Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/src/vstarstack/library/fine_movement/libimagedeform/include",
"/usr/include/python3.11"
"/usr/include/python3.11",
"/usr/include/python3.13"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"new": "cpp",
"span": "cpp",
"stdexcept": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"imagegrid.h": "c"
},
"editor.tabSize": 4,
"editor.insertSpaces": true,
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ recursive=no

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down
42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = ["numpy", "py-build-cmake"]
build-backend = "py_build_cmake.build"

[project]
name = "vstarstack"
version = "0.3.7"
requires-python = ">=3.10"
authors = [{name="Vladislav Tsendrovskii", email="[email protected]"}]
description = 'Stacking astrophotos'
readme = "readme.md"
license = "GPL-3.0"
license-files = ["LICENSE.txt"]
dependencies = [
'numpy',
'astropy',
'rawpy',
'pillow',
'imageio',
'exifread',
'opencv-python',
'scikit-image',
'scipy >= 1.11.0',
'imutils',
'matplotlib',
'pytz',
'psutil',
'photutils',
]

[project.scripts]
vstarstack = "vstarstack.entry:main"

[tool.py-build-cmake.module]
directory = "src/"
name = "vstarstack"

[tool.py-build-cmake.cmake]
source_path = "src/c_modules"
install_components = [
"python_modules"
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
py_build_cmake
numpy
astropy
rawpy
Expand Down
111 changes: 0 additions & 111 deletions setup.py

This file was deleted.

21 changes: 21 additions & 0 deletions src/c_modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.10)
project(vstarstack)

find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)

message("Python: '${Python3_EXECUTABLE}'")
execute_process(COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/get_numpy_path.py"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
RESULT_VARIABLE NUMPY_NOT_FOUND
)
if(NUMPY_NOT_FOUND)
message(FATAL_ERROR "NumPy headers not found: ${NUMPY_NOT_FOUND}")
endif()


message("Numpy headers: '${NUMPY_INCLUDE_DIR}'")

add_subdirectory(projections)
add_subdirectory(movements)
add_subdirectory(fine_movement)
add_subdirectory(clusterization)
14 changes: 14 additions & 0 deletions src/c_modules/clusterization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.10)

add_subdirectory(lib)

Python3_add_library(clusterization MODULE
module.cc
WITH_SOABI)

target_include_directories(clusterization PUBLIC . lib)
target_link_libraries(clusterization PUBLIC clusters)

install(TARGETS clusterization
COMPONENT python_modules
DESTINATION "${PY_BUILD_CMAKE_IMPORT_NAME}/library/clusters")
9 changes: 2 additions & 7 deletions src/c_modules/clusterization/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.14)

project(clusters)

# Library sources
add_library(clusters STATIC src/clusters.cc)

Expand All @@ -14,12 +12,9 @@ set_target_properties(clusters PROPERTIES PUBLIC_HEADER "${HEADERS}")
if(MSVC)
target_compile_options(clusters PRIVATE /W4 /WX)
else()
target_compile_options(clusters PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_compile_options(clusters PRIVATE -Wall -Wextra -Wpedantic -Werror -fPIC)
endif()

install(TARGETS clusters
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libclusters)

# Tests
if (BUILD_TESTS)
set(INSTALL_GTEST OFF)
Expand Down Expand Up @@ -49,7 +44,7 @@ if (BUILD_TESTS)
gtest_discover_tests(clusters_test)

if (UNIX)
add_custom_target(memory_leak_test sh ${CMAKE_SOURCE_DIR}/run_valgrind_tests.sh ${CMAKE_BINARY_DIR}/clusters_test
add_custom_target(clusterization_memory_leak_test sh ${CMAKE_SOURCE_DIR}/run_valgrind_tests.sh ${CMAKE_BINARY_DIR}/clusters_test
DEPENDS clusters_test)
endif()
endif()
1 change: 0 additions & 1 deletion src/c_modules/clusterization/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#define BASENAME "vstarstack.library.clusters.clusterization"


static PyObject *build_clusters_from_matches(PyObject *_self,
PyObject *args,
PyObject *kwds)
Expand Down
20 changes: 20 additions & 0 deletions src/c_modules/fine_movement/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.10)

add_subdirectory(libimagedeform)

Python3_add_library(fine_movement MODULE
module/imagedeform_gc.c
module/imagedeform_lc.c
module/imagedeform_module.c
module/imagedeform.c
module/imagegrid.c
WITH_SOABI)

target_include_directories(fine_movement PUBLIC . lib "${NUMPY_INCLUDE_DIR}")
target_link_libraries(fine_movement PUBLIC imagedeform)

set_target_properties(fine_movement PROPERTIES OUTPUT_NAME "module")

install(TARGETS fine_movement
COMPONENT python_modules
DESTINATION "${PY_BUILD_CMAKE_IMPORT_NAME}/library/fine_movement")
7 changes: 1 addition & 6 deletions src/c_modules/fine_movement/libimagedeform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.14)

project(imagedeform)

# Library sources
add_library(imagedeform STATIC src/interpolation.c
src/image_grid.c
Expand All @@ -25,9 +23,6 @@ else()
target_compile_options(imagedeform PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()

install(TARGETS imagedeform
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libimagedeform)

# Tests
if (BUILD_TESTS)
set(INSTALL_GTEST OFF)
Expand Down Expand Up @@ -58,7 +53,7 @@ if (BUILD_TESTS)
gtest_discover_tests(deform_test)

if (UNIX)
add_custom_target(memory_leak_test sh ${CMAKE_SOURCE_DIR}/run_valgrind_tests.sh ${CMAKE_BINARY_DIR}/deform_test
add_custom_target(fine_movement_memory_leak_test sh ${CMAKE_SOURCE_DIR}/run_valgrind_tests.sh ${CMAKE_BINARY_DIR}/deform_test
DEPENDS deform_test)
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void image_deform_lc_find_constant(struct ImageDeformLocalCorrelator *self,
double best_x, best_y;
double best_corr;

// TODO: use them
(void)ref_pre_align;
(void)pre_align;

struct ImageGrid global_area;
image_grid_init(&global_area, img->w, img->h);
best_x = best_y = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/c_modules/get_numpy_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import numpy
print(numpy.get_include(), end='')
10 changes: 10 additions & 0 deletions src/c_modules/movements/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)

Python3_add_library(movements MODULE module.c lib/flat.c lib/sphere.c WITH_SOABI)

target_include_directories(movements PUBLIC . lib "${NUMPY_INCLUDE_DIR}")
target_link_libraries(movements PUBLIC proj projections_structs)

install(TARGETS movements
COMPONENT python_modules
DESTINATION ${PY_BUILD_CMAKE_IMPORT_NAME}/library/movement)
15 changes: 15 additions & 0 deletions src/c_modules/projections/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.10)

add_library(proj STATIC lib/equirectangular.c lib/orthographic.c lib/perspective.c)

add_library(projections_structs INTERFACE)
target_include_directories(projections_structs INTERFACE .)

Python3_add_library(projections MODULE module.c WITH_SOABI)

target_include_directories(projections PUBLIC lib "${NUMPY_INCLUDE_DIR}")
target_link_libraries(projections PUBLIC proj projections_structs)

install(TARGETS projections
COMPONENT python_modules
DESTINATION ${PY_BUILD_CMAKE_IMPORT_NAME}/library/projection)
2 changes: 1 addition & 1 deletion src/vstarstack/tool/image_processing/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def copy(project: vstarstack.tool.cfg.Project, argv: list):

files = vstarstack.tool.common.listfiles(orig, ".zip")
for name, fname in files:
logger.info("Copying {name} to {fixed} dir")
logger.info(f"Copying {name} to {fixed} dir")
fname_out = os.path.join(fixed, name + ".zip")
shutil.copyfile(fname, fname_out)

Expand Down