From 3815a8f607b0988b57187f0e0ed945340771afb6 Mon Sep 17 00:00:00 2001 From: Tjark Miener Date: Thu, 9 Jan 2025 16:27:48 +0100 Subject: [PATCH] rename tool for calculate the pixel stats --- src/ctapipe/resources/calculate_pixel_stats.yaml | 4 ++-- src/ctapipe/tools/calculate_pixel_stats.py | 10 +++++----- .../tools/tests/test_calculate_pixel_stats.py | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ctapipe/resources/calculate_pixel_stats.yaml b/src/ctapipe/resources/calculate_pixel_stats.yaml index 48e262d3ab2..8573e4c0489 100644 --- a/src/ctapipe/resources/calculate_pixel_stats.yaml +++ b/src/ctapipe/resources/calculate_pixel_stats.yaml @@ -1,7 +1,7 @@ -StatisticsCalculatorTool: +PixelStatisticsCalculatorTool: allowed_tels: [1,2,3,4] input_column_name: image - output_column_name: statistics + output_table_name: statistics PixelStatisticsCalculator: stats_aggregator_type: diff --git a/src/ctapipe/tools/calculate_pixel_stats.py b/src/ctapipe/tools/calculate_pixel_stats.py index 0b9de78d6e0..d5e20192c95 100644 --- a/src/ctapipe/tools/calculate_pixel_stats.py +++ b/src/ctapipe/tools/calculate_pixel_stats.py @@ -23,12 +23,12 @@ from ctapipe.monitoring.calculator import PixelStatisticsCalculator -class StatisticsCalculatorTool(Tool): +class PixelStatisticsCalculatorTool(Tool): """ Perform statistics calculation for pixel-wise image data """ - name = "StatisticsCalculatorTool" + name = "ctapipe-calculate-pixel-statistics" description = "Perform statistics calculation for pixel-wise image data" examples = """ @@ -68,12 +68,12 @@ class StatisticsCalculatorTool(Tool): aliases = { ("i", "input_url"): "TableLoader.input_url", - ("o", "output_path"): "StatisticsCalculatorTool.output_path", + ("o", "output_path"): "PixelStatisticsCalculatorTool.output_path", } flags = { "overwrite": ( - {"StatisticsCalculatorTool": {"overwrite": True}}, + {"PixelStatisticsCalculatorTool": {"overwrite": True}}, "Overwrite existing files", ), } @@ -186,7 +186,7 @@ def finish(self): def main(): # Run the tool - tool = StatisticsCalculatorTool() + tool = PixelStatisticsCalculatorTool() tool.run() diff --git a/src/ctapipe/tools/tests/test_calculate_pixel_stats.py b/src/ctapipe/tools/tests/test_calculate_pixel_stats.py index bcd3af2a66d..1e0330fa40f 100644 --- a/src/ctapipe/tools/tests/test_calculate_pixel_stats.py +++ b/src/ctapipe/tools/tests/test_calculate_pixel_stats.py @@ -9,7 +9,7 @@ from ctapipe.core import run_tool from ctapipe.core.tool import ToolConfigurationError from ctapipe.io import read_table -from ctapipe.tools.calculate_pixel_stats import StatisticsCalculatorTool +from ctapipe.tools.calculate_pixel_stats import PixelStatisticsCalculatorTool def test_calculate_pixel_stats_tool(tmp_path, dl1_image_file): @@ -19,7 +19,7 @@ def test_calculate_pixel_stats_tool(tmp_path, dl1_image_file): tel_id = 3 config = Config( { - "StatisticsCalculatorTool": { + "PixelStatisticsCalculatorTool": { "allowed_tels": [tel_id], "input_column_name": "image", "output_table_name": "statistics", @@ -38,7 +38,7 @@ def test_calculate_pixel_stats_tool(tmp_path, dl1_image_file): monitoring_file = tmp_path / "monitoring.dl1.h5" # Run the tool with the configuration and the input file run_tool( - StatisticsCalculatorTool(config=config), + PixelStatisticsCalculatorTool(config=config), argv=[ f"--input_url={dl1_image_file}", f"--output_path={monitoring_file}", @@ -65,7 +65,7 @@ def test_tool_config_error(tmp_path, dl1_image_file): # Run the tool with the configuration and the input file config = Config( { - "StatisticsCalculatorTool": { + "PixelStatisticsCalculatorTool": { "allowed_tels": [3], "input_column_name": "image_charges", "output_table_name": "statistics", @@ -80,7 +80,7 @@ def test_tool_config_error(tmp_path, dl1_image_file): ToolConfigurationError, match="Column 'image_charges' not found" ): run_tool( - StatisticsCalculatorTool(config=config), + PixelStatisticsCalculatorTool(config=config), argv=[ f"--input_url={dl1_image_file}", f"--output_path={monitoring_file}", @@ -96,7 +96,7 @@ def test_tool_config_error(tmp_path, dl1_image_file): ToolConfigurationError, match="Input and output files are same." ): run_tool( - StatisticsCalculatorTool(), + PixelStatisticsCalculatorTool(), argv=[ f"--input_url={dl1_image_file}", f"--output_path={dl1_image_file}", @@ -111,11 +111,11 @@ def test_tool_config_error(tmp_path, dl1_image_file): ToolConfigurationError, match="Change --StatisticsAggregator.chunk_size" ): run_tool( - StatisticsCalculatorTool(), + PixelStatisticsCalculatorTool(), argv=[ f"--input_url={dl1_image_file}", f"--output_path={monitoring_file}", - "--StatisticsCalculatorTool.allowed_tels=3", + "--PixelStatisticsCalculatorTool.allowed_tels=3", "--StatisticsAggregator.chunk_size=2500", "--overwrite", ],