fix: robust Am-241 peak detection for energy calibration

- Search full spectrum (exclude pulser region) instead of just low-energy
- Include 59.54 keV line in known Am-241 energies
- Brute-force peak-to-energy matching with physical gain constraint
  (3-40 ch/keV) to reject spurious fits
- Fixed find_peaks parameters: height=100, distance=5 for accurate
  peak detection
- Calibration now correctly maps: ch 97→13 keV, ch 134→17.4 keV,
  ch 537→59.6 keV, giving Tc-99 endpoint at ch 2750→291.6 keV
- Add .rpiv/ to .gitignore
This commit is contained in:
2026-05-21 16:43:10 +03:00
parent 5ec6305e09
commit 8952d0f789
3 changed files with 72 additions and 40 deletions
+8 -3
View File
@@ -117,13 +117,15 @@
"ax.set_title('Raw Run Spectrum (counts vs channel)')\n",
"ax.set_xlabel('Channel')\n",
"ax.set_ylabel('Counts')\n",
"ax.set_xlim(0, min(200, len(raw_counts)))\n",
"ax.set_yscale('log')\n",
"ax.set_xlim(0, 600)\n",
"\n",
"ax = axes[0, 1]\n",
"ax.plot(raw_counts, 'b-', linewidth=0.5)\n",
"ax.set_title('Raw Run Spectrum (full range)')\n",
"ax.set_xlabel('Channel')\n",
"ax.set_ylabel('Counts')\n",
"ax.set_yscale('log')\n",
"\n",
"# --- Calibration spectrum ---\n",
"with open(CALIBRATION_FILE, 'rb') as f:\n",
@@ -135,13 +137,15 @@
"ax.set_title('Calibration Spectrum (counts vs channel)')\n",
"ax.set_xlabel('Channel')\n",
"ax.set_ylabel('Counts')\n",
"ax.set_xlim(0, min(200, len(cal_counts)))\n",
"ax.set_xlim(0, 600)\n",
"ax.set_yscale('log')\n",
"\n",
"ax = axes[1, 1]\n",
"ax.plot(cal_counts, 'r-', linewidth=0.5)\n",
"ax.set_title('Calibration Spectrum (full range)')\n",
"ax.set_xlabel('Channel')\n",
"ax.set_ylabel('Counts')\n",
"ax.set_yscale('log')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n",
@@ -155,7 +159,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Process Single Spectrum"
"# Process Single Spectrum"
]
},
{
@@ -197,6 +201,7 @@
"plt.plot(result.spectrum.energies, result.spectrum.counts, 'b-', label='Counts')\n",
"plt.xlabel('Energy (keV)')\n",
"plt.ylabel('Counts')\n",
"plt.yscale('log')\n",
"plt.title('Calibrated Beta Spectrum')\n",
"plt.legend()\n",
"plt.tight_layout()\n",