Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 25, 2025
1 parent 896c377 commit e8293ab
Show file tree
Hide file tree
Showing 165 changed files with 577 additions and 493 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@

.cache/
build/
test/
test/
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ find_package(Curses REQUIRED)

add_executable(lithium-next ${lithium_src_dir}/app.cpp)

target_link_libraries(lithium-next PRIVATE
target_link_libraries(lithium-next PRIVATE
pybind11::module
pybind11::lto
lithium_components
Expand Down Expand Up @@ -71,4 +71,4 @@ add_subdirectory(example)
add_subdirectory(tests)

# Enable folder grouping in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
2 changes: 1 addition & 1 deletion cmake/compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ if(CMAKE_BUILD_TYPE MATCHES "Release")
target_compile_options(${PROJECT_NAME} PRIVATE /GL)
target_link_options(${PROJECT_NAME} PRIVATE /LTCG)
endif()
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/policies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if(POLICY CMP0043)
endif()
if(POLICY CMP0148)
cmake_policy(SET CMP0148 NEW)
endif()
endif()
2 changes: 1 addition & 1 deletion config/package_managers.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@
"searchCommand": "winget search {name}"
}
]
}
}
2 changes: 1 addition & 1 deletion example/components/example1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ class LoggerComponent : public Component {

ATOM_MODULE(logger, [](auto& component) {
component.def("logMessage", &LoggerComponent::logMessage, "Log message");
})
})
2 changes: 1 addition & 1 deletion example/components/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ int main() {
}

return 0;
}
}
2 changes: 1 addition & 1 deletion example/config/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ int main() {
}

return 0;
}
}
2 changes: 1 addition & 1 deletion example/task/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ int main() {
}

return 0;
}
}
8 changes: 4 additions & 4 deletions modules/image/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project(lithium_image
project(lithium_image
VERSION 1.0.0
LANGUAGES C CXX
)
Expand All @@ -20,8 +20,8 @@ include_directories(src)

# 创建共享库
add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC
target_include_directories(${PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${OpenCV_INCLUDE_DIRS}
Expand All @@ -41,4 +41,4 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
)

add_subdirectory(examples)
add_subdirectory(examples)
1 change: 0 additions & 1 deletion modules/image/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ foreach(CPP_FILE ${CPP_FILES})
add_executable(${EXE_NAME} ${CPP_FILE})
target_link_libraries(${EXE_NAME} ${LIBRARIES_TO_LINK})
endforeach()

2 changes: 1 addition & 1 deletion modules/image/examples/thumbhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ int main() {
std::cerr << "Error occurred: " << e.what() << std::endl;
return -1;
}
}
}
2 changes: 1 addition & 1 deletion modules/image/src/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ auto base64Decode(std::string const& encoded_string) -> std::string {
}

return result;
}
}
2 changes: 1 addition & 1 deletion modules/image/src/base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ auto base64Encode(unsigned char const* bytes_to_encode,
*/
auto base64Decode(std::string const& encoded_string) -> std::string;

#endif // LITHIUM_IMAGE_BASE64_HPP
#endif // LITHIUM_IMAGE_BASE64_HPP
2 changes: 1 addition & 1 deletion modules/image/src/binning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,4 @@ template void process_mono_bin<uint16_t>(std::span<const uint8_t> srcData,
uint32_t camxbin, uint32_t camybin);
template void process_mono_bin<uint32_t>(std::span<const uint8_t> srcData,
cv::Mat& result, uint32_t srcStride,
uint32_t camxbin, uint32_t camybin);
uint32_t camxbin, uint32_t camybin);
2 changes: 1 addition & 1 deletion modules/image/src/binning.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ cv::Mat processWithBinning(std::span<const uint8_t> srcData, uint32_t width,
uint32_t newWidth, uint32_t newHeight,
uint32_t camxbin, uint32_t camybin, bool isColor);

#endif // LITHIUM_MODULE_IMAGE_BINNING_HPP
#endif // LITHIUM_MODULE_IMAGE_BINNING_HPP
2 changes: 1 addition & 1 deletion modules/image/src/hist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@ auto drawHistogram(const cv::Mat& hist, int histSize, int width,
LOG_F(INFO, "Histogram visualization completed in {}ms", duration.count());

return histImage;
}
}
2 changes: 1 addition & 1 deletion modules/image/src/hist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ auto drawHistogram(const cv::Mat& hist, int histSize = DEFAULT_HIST_SIZE,
int width = DEFAULT_WIDTH,
int height = DEFAULT_HEIGHT) -> cv::Mat;

#endif // HIST_HPP
#endif // HIST_HPP
2 changes: 1 addition & 1 deletion modules/image/src/imgio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,4 @@ int saveFitsAsPNG(const std::string& fitsFileName, bool isColor, int cameraBin,
LOG_F(INFO, "Image processing and saving completed successfully: {}",
fileName);
return 0;
}
}
2 changes: 1 addition & 1 deletion modules/image/src/imgio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ auto saveMatTo16BitPng(
auto saveMatToFits(const cv::Mat& image, const std::string& output_path =
"/dev/shm/MatToFITS.fits") -> bool;

#endif
#endif
2 changes: 1 addition & 1 deletion modules/image/src/imgutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ auto eightSymmetryCircleCheck(const cv::Mat& rect_contour,

auto fourSymmetryCircleCheck(const cv::Mat& rect_contour,
const cv::Point& center, float radius) -> int;
#endif // LITHIUM_IMAGE_UTILS_HPP
#endif // LITHIUM_IMAGE_UTILS_HPP
10 changes: 5 additions & 5 deletions modules/image/src/test_base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ TEST_F(Base64Test, EncodeStandardString) {
// RFC 4648 Test Vectors
TEST_F(Base64Test, EncodeRFCTestVectors) {
for (const auto& [input, expected] : testVectors) {
EXPECT_EQ(base64Encode(reinterpret_cast<const unsigned char*>(input.c_str()),
input.length()),
EXPECT_EQ(base64Encode(reinterpret_cast<const unsigned char*>(input.c_str()),
input.length()),
expected);
}
}
Expand Down Expand Up @@ -74,7 +74,7 @@ TEST_F(Base64Test, DecodeRFCTestVectors) {
}
}

// Padding Tests
// Padding Tests
TEST_F(Base64Test, HandlePadding) {
EXPECT_EQ(base64Decode("YQ=="), "a"); // 1 byte, 2 padding chars
EXPECT_EQ(base64Decode("YWI="), "ab"); // 2 bytes, 1 padding char
Expand Down Expand Up @@ -102,7 +102,7 @@ TEST_F(Base64Test, RoundtripStrings) {
TEST_F(Base64Test, RoundtripBinaryData) {
std::string encoded = base64Encode(binaryData.data(), binaryData.size());
std::string decoded = base64Decode(encoded);
EXPECT_EQ(std::vector<unsigned char>(decoded.begin(), decoded.end()),
EXPECT_EQ(std::vector<unsigned char>(decoded.begin(), decoded.end()),
binaryData);
}

Expand Down Expand Up @@ -130,4 +130,4 @@ TEST_F(Base64Test, HandleLongStrings) {

TEST_F(Base64Test, HandleWhitespace) {
EXPECT_EQ(base64Decode("SG Vs\nbG8="), "Hello");
}
}
6 changes: 3 additions & 3 deletions modules/image/src/test_binning.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BinningTest : public ::testing::Test {
smallImage = cv::Mat(100, 100, CV_8UC1, cv::Scalar(128));
largeImage = cv::Mat(3000, 3000, CV_8UC1, cv::Scalar(128));
colorImage = cv::Mat(100, 100, CV_8UC3, cv::Scalar(64, 128, 192));

// Create images with different bit depths
image8bit = cv::Mat(100, 100, CV_8UC1, cv::Scalar(128));
image16bit = cv::Mat(100, 100, CV_16UC1, cv::Scalar(32768));
Expand Down Expand Up @@ -98,7 +98,7 @@ TEST_F(BinningTest, BinningPreservesAverageIntensity) {
cv::Scalar originalMean = cv::mean(smallImage);
auto result = processMatWithBinAvg(smallImage, 2, 2, false, true);
cv::Scalar binnedMean = cv::mean(result);

EXPECT_NEAR(originalMean[0], binnedMean[0], 1.0);
}

Expand All @@ -122,4 +122,4 @@ TEST_F(BinningTest, LargeBinningFactors) {
EXPECT_GT(cv::mean(result)[0], 0);
}

} // namespace
} // namespace
2 changes: 1 addition & 1 deletion modules/image/src/test_imgio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ TEST_F(ImgIOTest, LoadMultipleImagesWithMixedValidity) {
"white.jpg"};
auto images = loadImages(testDir.string(), filenames);
ASSERT_EQ(images.size(), 2); // Only valid images should be loaded
}
}
2 changes: 1 addition & 1 deletion modules/image/src/test_imgutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ TEST_F(ImgUtilsTest, ExtremeDimensions) {

cv::Mat wideImg(10, 1000, CV_8UC3, cv::Scalar(128, 128, 128));
EXPECT_NO_THROW(autoWhiteBalance(wideImg));
}
}
2 changes: 1 addition & 1 deletion modules/image/src/test_thumbhash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ TEST_F(ThumbHashTest, HashValueRangeTest) {
ASSERT_FALSE(std::isinf(value));
}
}
} // namespace
} // namespace
2 changes: 1 addition & 1 deletion modules/image/src/thumbhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,4 @@ auto base64Decode(const std::string& encoded) -> std::vector<double> {
LOG_F(ERROR, "Exception in base64Decode: {}", e.what());
throw;
}
}
}
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function(add_subdirectories_recursively start_dir)
endif()
endforeach()
endfunction()
add_subdirectories_recursively(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectories_recursively(${CMAKE_CURRENT_SOURCE_DIR})
2 changes: 1 addition & 1 deletion src/client/astap/astap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,4 @@ ATOM_MODULE(solver_astap, [](Component& component) {
"Define a new solver instance.");

LOG_F(INFO, "Registered solver_astap module.");
});
});
20 changes: 10 additions & 10 deletions src/client/astrometry/astrometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
static auto astrometrySolver =
std::make_shared<AstrometrySolver>("solver.astrometry");

AstrometrySolver::AstrometrySolver(std::string name)
AstrometrySolver::AstrometrySolver(std::string name)
: AtomSolver(std::move(name)) {
DLOG_F(INFO, "Initializing Astrometry Solver...");
}
Expand Down Expand Up @@ -440,10 +440,10 @@ PlateSolveResult AstrometrySolver::solve(
const std::string& imageFilePath,
const std::optional<Coordinates>& initialCoordinates,
double fovW, double fovH, int imageWidth, int imageHeight) {

std::string command = buildCommand(imageFilePath, initialCoordinates, fovW, fovH);
std::string output;

try {
output = atom::system::executeCommand(command);
} catch (const std::exception& e) {
Expand All @@ -458,10 +458,10 @@ std::future<PlateSolveResult> AstrometrySolver::async_solve(
const std::string& imageFilePath,
const std::optional<Coordinates>& initialCoordinates,
double fovW, double fovH, int imageWidth, int imageHeight) {

return std::async(std::launch::async,
[this, imageFilePath, initialCoordinates, fovW, fovH, imageWidth, imageHeight]() {
return this->solve(imageFilePath, initialCoordinates,
return this->solve(imageFilePath, initialCoordinates,
fovW, fovH, imageWidth, imageHeight);
});
}
Expand Down Expand Up @@ -496,7 +496,7 @@ std::string AstrometrySolver::buildCommand(
const std::string& imageFilePath,
const std::optional<Coordinates>& coords,
double fovW, double fovH) {

std::ostringstream cmd;
cmd << "solve-field"
<< " --overwrite"
Expand All @@ -518,7 +518,7 @@ std::string AstrometrySolver::buildCommand(

PlateSolveResult AstrometrySolver::parseSolveOutput(const std::string& output) {
PlateSolveResult result;

// 使用wcsinfo来解析WCS文件
std::string wcsFile = getOutputPath(output);
if (!std::filesystem::exists(wcsFile)) {
Expand All @@ -527,10 +527,10 @@ PlateSolveResult AstrometrySolver::parseSolveOutput(const std::string& output) {
}

std::string wcsinfo = atom::system::executeCommand("wcsinfo " + wcsFile);

// 解析wcsinfo输出...
// 这里需要添加实际的解析逻辑来设置result的各个字段

result.success = true;
return result;
}
Expand Down Expand Up @@ -559,4 +559,4 @@ ATOM_MODULE(astrometry, [](Component &component) {
"Astap solver");

LOG_F(INFO, "Registered astrometry module.");
});
});
2 changes: 1 addition & 1 deletion src/client/astrometry/astrometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ class AstrometrySolver : public AtomSolver {
PlateSolveResult parseSolveOutput(const std::string& output);
};

#endif
#endif
Loading

0 comments on commit e8293ab

Please sign in to comment.