Skip to content

First Threshold Measurement

Learn how to find the optimal threshold settings for your OSECHI detector. This page uses time-based measurement (--use-sec) to scan threshold values systematically.


Prerequisites

See First Measurement.


What is a threshold?

The threshold controls the detection sensitivity of each channel.

  • Low threshold: the detector is more sensitive — more events are detected, but noise (electrical interference) may also be counted.
  • High threshold: the detector is less sensitive — noise is suppressed, but only higher-energy cosmic rays are detected.

Finding the optimal threshold means finding the value where cosmic ray events are reliably detected while noise is rejected.

Each detector is different

The optimal threshold varies slightly from unit to unit and may shift with temperature or other environmental conditions.


Why time-based measurement?

Threshold scanning compares event counts at different threshold values. This requires a fixed measurement duration so that rates are comparable.

Count-based mode is not suitable here

If the threshold is set too high, no events are detected and the count never increments — the measurement would hang indefinitely. Always use --use-sec for threshold scans.


1. Start a threshold measurement

Add --use-sec to kazunoko measure to switch to time-based mode. The format is the same as before, but the second argument is duration in seconds instead of event count:

kazunoko measure [THRESHOLDS] [SECONDS] --use-sec

Quick test: 10 seconds per threshold

Let's measure for 10 seconds with channel 1 at threshold 300 and channels 2 and 3 at 1000 (effectively disabled):

kazunoko measure "1:300;2:1000;3:1000" 10 --use-sec

Events detected during the 10 seconds are printed to the terminal:

$ kazunoko measure "1:300;2:1000;3:1000" 10 --use-sec
{"type": "event", "status": "ok", "received_us": 1765586456.560016, ...}
{"type": "event", "status": "ok", "received_us": 1765586456.648044, ...}
... (events for 10 seconds)

Stop a measurement with Ctrl+C

Press Ctrl + C to interrupt at any time.

The measurement stops automatically after 10 seconds. Verify that it terminates even when the threshold is set very high (zero events).


2. Save results to a file

Redirect output to save events for later analysis:

kazunoko measure "1:300;2:1000;3:1000" 10 --use-sec > threshold_300.jsonl

Repeat for each threshold value you want to scan:

kazunoko measure "1:310;2:1000;3:1000" 10 --use-sec > threshold_310.jsonl
kazunoko measure "1:320;2:1000;3:1000" 10 --use-sec > threshold_320.jsonl
kazunoko measure "1:330;2:1000;3:1000" 10 --use-sec > threshold_330.jsonl
kazunoko measure "1:340;2:1000;3:1000" 10 --use-sec > threshold_340.jsonl

Redirect operators

  • > filename — overwrite file
  • >> filename — append to file

3. Watch the file while measuring

See First Measurement — Step 3.


4. Verify the results

See First Measurement — Step 4.


5. Available options

See First Measurement — Available options.


Next Steps

Automate the scan with get_thresholds.py

get_thresholds.py automates the full threshold scan — it steps through a range of threshold values and collects data at each step.

Fit the scan results

fit_thresholds.py fits the collected data to a complementary error function (erfc) and computes optimal threshold values at various sigma levels.

Visualize the fit

plot_thresholds.py plots the detector response curve alongside the measured data points and sigma level markers.

Monitor the scan in real time

monitor_thresholds.py displays live scatter plots (threshold vs hit count) for each channel as the scan progresses.