Skip to content

Commit

Permalink
rename tool for calculate the pixel stats
Browse files Browse the repository at this point in the history
  • Loading branch information
TjarkMiener committed Jan 9, 2025
1 parent b6587ec commit 9f8268f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/ctapipe/resources/calculate_pixel_stats.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 5 additions & 5 deletions src/ctapipe/tools/calculate_pixel_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down Expand Up @@ -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",
),
}
Expand Down Expand Up @@ -186,7 +186,7 @@ def finish(self):

def main():
# Run the tool
tool = StatisticsCalculatorTool()
tool = PixelStatisticsCalculatorTool()
tool.run()


Expand Down
16 changes: 8 additions & 8 deletions src/ctapipe/tools/tests/test_calculate_pixel_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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",
Expand All @@ -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}",
Expand All @@ -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",
Expand All @@ -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}",
Expand All @@ -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}",
Expand All @@ -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",
],
Expand Down

0 comments on commit 9f8268f

Please sign in to comment.