Skip to content

Commit

Permalink
update with pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume.grolleron committed Jan 19, 2024
1 parent a233bb9 commit bda2d74
Show file tree
Hide file tree
Showing 40 changed files with 2,359 additions and 1,565 deletions.
43 changes: 24 additions & 19 deletions notebooks/tool_implementation/tuto_SPE.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
"import os\n",
"import pathlib\n",
"\n",
"logging.basicConfig(format=\"%(asctime)s %(name)s %(levelname)s %(message)s\",level=logging.INFO)\n",
"logging.basicConfig(\n",
" format=\"%(asctime)s %(name)s %(levelname)s %(message)s\", level=logging.INFO\n",
")\n",
"log = logging.getLogger(__name__)\n",
"log.handlers = logging.getLogger(\"__main__\").handlers\n",
"\n",
"from nectarchain.makers.calibration import FlatFieldSPEHHVStdNectarCAMCalibrationTool,FlatFieldSPENominalStdNectarCAMCalibrationTool"
"from nectarchain.makers.calibration import (\n",
" FlatFieldSPEHHVStdNectarCAMCalibrationTool,\n",
" FlatFieldSPENominalStdNectarCAMCalibrationTool,\n",
")"
]
},
{
Expand All @@ -23,7 +28,7 @@
"metadata": {},
"outputs": [],
"source": [
"run_number = 3936\n"
"run_number = 3936"
]
},
{
Expand Down Expand Up @@ -224,22 +229,22 @@
}
],
"source": [
"\n",
"tool = FlatFieldSPENominalStdNectarCAMCalibrationTool(\n",
" progress_bar = True,\n",
" method = 'LocalPeakWindowSum',\n",
" extractor_kwargs = {\"window_width\": 12, \"window_shift\": 4},\n",
" multiproc = True,\n",
" nproc = 10,\n",
" run_number = run_number,\n",
" max_events = 10000,\n",
" log_level = 20,\n",
" reload_events = True,\n",
" #events_per_slice = 200,\n",
" asked_pixels_id = [52,48],\n",
" output_path = pathlib.Path(os.environ.get(\"NECTARCAMDATA\",\"/tmp\")) / \"tutorials/\" / f\"SPEfit_{run_number}.h5\"\n",
" )\n",
"\n"
" progress_bar=True,\n",
" method=\"LocalPeakWindowSum\",\n",
" extractor_kwargs={\"window_width\": 12, \"window_shift\": 4},\n",
" multiproc=True,\n",
" nproc=10,\n",
" run_number=run_number,\n",
" max_events=10000,\n",
" log_level=20,\n",
" reload_events=True,\n",
" # events_per_slice = 200,\n",
" asked_pixels_id=[52, 48],\n",
" output_path=pathlib.Path(os.environ.get(\"NECTARCAMDATA\", \"/tmp\"))\n",
" / \"tutorials/\"\n",
" / f\"SPEfit_{run_number}.h5\",\n",
")"
]
},
{
Expand Down Expand Up @@ -550,7 +555,7 @@
}
],
"source": [
"output = tool.finish(return_output_component = True, display=True,figpath = os.getcwd())\n",
"output = tool.finish(return_output_component=True, display=True, figpath=os.getcwd())\n",
"output"
]
},
Expand Down
75 changes: 75 additions & 0 deletions notebooks/tool_implementation/tuto_SPE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.14.6
# kernelspec:
# display_name: nectarchain
# language: python
# name: python3
# ---

# %%
import logging
import os
import pathlib

logging.basicConfig(
format="%(asctime)s %(name)s %(levelname)s %(message)s", level=logging.INFO
)
log = logging.getLogger(__name__)
log.handlers = logging.getLogger("__main__").handlers

from nectarchain.makers.calibration import (
FlatFieldSPEHHVStdNectarCAMCalibrationTool,
FlatFieldSPENominalStdNectarCAMCalibrationTool,
)

# %%
run_number = 3936

# %%

# !ls -lh $NECTARCAMDATA/runs/*

# %%
tool = FlatFieldSPENominalStdNectarCAMCalibrationTool(
progress_bar=True,
method="LocalPeakWindowSum",
extractor_kwargs={"window_width": 12, "window_shift": 4},
multiproc=True,
nproc=10,
run_number=run_number,
max_events=10000,
log_level=20,
reload_events=True,
# events_per_slice = 200,
asked_pixels_id=[52, 48],
output_path=pathlib.Path(os.environ.get("NECTARCAMDATA", "/tmp"))
/ "tutorials/"
/ f"SPEfit_{run_number}.h5",
)

# %%
tool

# %%
tool.initialize()

# %%
tool.setup()

# %%
tool.start()

# %%
output = tool.finish(return_output_component=True, display=True, figpath=os.getcwd())
output

# %%
output[0].resolution

# %%
Loading

0 comments on commit bda2d74

Please sign in to comment.