{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "0", "metadata": {}, "outputs": [], "source": [ "import tables\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "# DRS4 time sampling files " ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## HDF5 format" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "file = \"../../../test_data/real/service/PixelCalibration/Cat-A/drs4_time_sampling_from_FF/20191124/pro/time_calibration.Run01625.0000.h5\"\n", "hdf5_f=tables.open_file(file, \"r\")\n", "hdf5_f" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "### data " ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "# Data used for calibration are:\n", "# - fan : baseline to be subtracted per channel/pixel/capacitor (2, 1855, 4096)\n", "# - fbn : spike to be subtracted, per channel/pixel/spike-type (2, 1855, 3)\n", "\n", "fan = hdf5_f.root.fan\n", "fbn = hdf5_f.root.fbn\n", "print(fan.shape)\n", "np.array(fan)" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "\n", "_=plt.hist(np.median(fan,axis=2)[0],bins=50,alpha=0.5,range=[-0.13,0.13], label=\"fan HG\")\n", "_=plt.hist(np.median(fbn,axis=2)[0],bins=50,alpha=0.5,range=[-0.13,0.13], label=\"fbn LG\")\n", "\n", "plt.yscale('log')\n", "plt.legend()" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "### meta-data " ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "hdf5_f.root._v_attrs " ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "## Fits format " ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "from astropy.io import fits\n", "\n", "file = \"../../../test_data/real/service/PixelCalibration/Cat-A/drs4_time_sampling_from_FF/20191124/pro/time_calibration.Run01625.0000.fits.gz\"\n", "fits_f = fits.open(file)\n" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "### HDU" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "fits_f.info()" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "### data" ] }, { "cell_type": "code", "execution_count": null, "id": "14", "metadata": {}, "outputs": [], "source": [ "fits_f[\"FAN\"].data" ] }, { "cell_type": "markdown", "id": "15", "metadata": {}, "source": [ "### meta-data " ] }, { "cell_type": "code", "execution_count": null, "id": "16", "metadata": {}, "outputs": [], "source": [ "fits_f[\"PRIMARY\"].header" ] }, { "cell_type": "code", "execution_count": null, "id": "17", "metadata": {}, "outputs": [], "source": [ "fits_f[\"FAN\"].header" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.10" } }, "nbformat": 4, "nbformat_minor": 5 }