{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# DRS4 timelapse files " ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import tables\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from lstcam_calib.io import get_dataset_keys\n" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## HDF5 format" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "\n", "file = \"../../../test_data/real/service/PixelCalibration/Cat-A/drs4_timelapse/20200218/pro/drs4_timelapse.Run02005.0000.h5\"\n", "hdf5_f=tables.open_file(file, \"r\")\n", "hdf5_f" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "### Keys" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "key=get_dataset_keys(file)\n", "key " ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "### Data " ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "# The coefficients are estimated per DRS4 batch type\n", "# The pixel batch is reported in the array \"pixel_batch\"\n", "# LST-1 has all pixels from batch = 0\n", "# LST-2-4 have pixels from batch 0 and 1 \n", "\n", "drs4_data = hdf5_f.root.r0.service.timelapse_coefficients.tel_001[0]\n", "drs4_data[\"pixel_batch\"]" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "# for LST-1 only the batch = 0 coefficients are defined\n", "drs4_data[\"exponent\"]" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [ "# other way, with ctapipe\n", "from ctapipe.io import read_table\n", "# read the table\n", "table = read_table(file, key[0])\n", "table" ] }, { "cell_type": "markdown", "id": "10", "metadata": {}, "source": [ "### Meta-data " ] }, { "cell_type": "code", "execution_count": null, "id": "11", "metadata": {}, "outputs": [], "source": [ "hdf5_f.root._v_attrs " ] }, { "cell_type": "markdown", "id": "12", "metadata": {}, "source": [ "## Fits format " ] }, { "cell_type": "code", "execution_count": null, "id": "13", "metadata": {}, "outputs": [], "source": [ "from astropy.io import fits\n", "\n", "file = \"../../../test_data/real/service/PixelCalibration/Cat-A/drs4_timelapse/20200218/pro/drs4_timelapse.Run02005.0000.fits\"\n", "fits_f = fits.open(file)\n" ] }, { "cell_type": "markdown", "id": "14", "metadata": {}, "source": [ "### HDU" ] }, { "cell_type": "code", "execution_count": null, "id": "15", "metadata": {}, "outputs": [], "source": [ "fits_f.info()" ] }, { "cell_type": "markdown", "id": "16", "metadata": {}, "source": [ "### Data" ] }, { "cell_type": "code", "execution_count": null, "id": "17", "metadata": {}, "outputs": [], "source": [ "# The coefficients are estimated per DRS4 batch type\n", "# The pixel batch is reported in the array \"pixel_batch\"\n", "# LST-1 has all pixels from batch = 0\n", "# LST-2-4 have pixels from batch 0 and 1 \n", "\n", "fits_f[\"PIXEL_BATCH\"].data" ] }, { "cell_type": "code", "execution_count": null, "id": "18", "metadata": {}, "outputs": [], "source": [ "# for LST-1 only the batch = 0 coefficients are defined\n", "drs4_data[\"exponent\"]" ] }, { "cell_type": "markdown", "id": "19", "metadata": {}, "source": [ "### Meta-data " ] }, { "cell_type": "code", "execution_count": null, "id": "20", "metadata": {}, "outputs": [], "source": [ "fits_f[\"PRIMARY\"].header" ] }, { "cell_type": "code", "execution_count": null, "id": "21", "metadata": {}, "outputs": [], "source": [ "fits_f[\"SCALE\"].header" ] }, { "cell_type": "code", "execution_count": null, "id": "22", "metadata": {}, "outputs": [], "source": [] } ], "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 }