diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb index c97abbb92ac04152700614ac0f28affca9a53fca..481c8dfb440b1cdb1599a4c9b097f50d43feb36e 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb @@ -25,15 +25,15 @@ "outputs": [], "source": [ "cluster_profile = \"noDB\" # The ipcluster profile to use\n", - "in_folder = \"/gpfs/exfel/d/raw/SPB/202030/p900138\" # path to input data, required\n", - "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/AGIPDbad_sep64\" # path to output to, required\n", + "in_folder = \"/gpfs/exfel/d/raw/DETLAB/202031/p900172/\" # path to input data, required\n", + "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/miniHalfAGIPD\" # path to output to, required\n", "sequences = [0] # sequence files to evaluate.\n", "modules = [-1] # list of modules to evaluate, RANGE ALLOWED\n", - "run_high = 167 # run number in which high gain data was recorded, required\n", - "run_med = 168 # run number in which medium gain data was recorded, required\n", - "run_low = 169 # run number in which low gain data was recorded, required\n", + "run_high = 84 # run number in which high gain data was recorded, required\n", + "run_med = 87 # run number in which medium gain data was recorded, required\n", + "run_low = 88 # run number in which low gain data was recorded, required\n", "\n", - "karabo_id = \"SPB_DET_AGIPD1M-1\" # karabo karabo_id\n", + "karabo_id = \"DETLAB_DET_AGIPD500K2G\" # karabo karabo_id\n", "karabo_da = ['-1'] # a list of data aggregators names, Default [-1] for selecting all data aggregators\n", "receiver_id = \"{}CH0\" # inset for receiver devices\n", "path_template = 'RAW-R{:04d}-{}-S{:05d}.h5' # the template to use to access data\n", @@ -51,8 +51,8 @@ "\n", "mem_cells = 0 # number of memory cells used, set to 0 to automatically infer\n", "bias_voltage = 300 # detector bias voltage\n", - "gain_setting = 0.1 # the gain setting, use 0.1 to try to auto-determine\n", - "acq_rate = 0. # the detector acquisition rate, use 0 to try to auto-determine\n", + "gain_setting = 0.0 # the gain setting, use 0.1 to try to auto-determine\n", + "acq_rate = 1.1 # the detector acquisition rate, use 0 to try to auto-determine\n", "interlaced = False # assume interlaced data format, for data prior to Dec. 2017\n", "rawversion = 2 # RAW file format version\n", "\n", @@ -143,13 +143,19 @@ "cal_db_interface = get_random_db_interface(cal_db_interface)\n", "print(f'Calibration database interface: {cal_db_interface}')\n", "\n", - "loc = None\n", "instrument = karabo_id.split(\"_\")[0]\n", + "\n", "if instrument == \"SPB\":\n", " dinstance = \"AGIPD1M1\"\n", - "else:\n", + " nmods = 16\n", + "elif instrument == \"MID\":\n", " dinstance = \"AGIPD1M2\"\n", - " \n", + " nmods = 16\n", + "# TODO: Remove DETLAB\n", + "elif instrument == \"HED\" or instrument == \"DETLAB\":\n", + " dinstance = \"AGIPD500K\"\n", + " nmods = 8\n", + "\n", "control_names = ['{}/r{:04d}/RAW-R{:04d}-{}-S00000.h5'.format(in_folder, r, r, karabo_da_control)\n", " for r in (run_high, run_med, run_low)] \n", "\n", @@ -167,7 +173,6 @@ "metadata": {}, "outputs": [], "source": [ - "gain_names = ['High', 'Medium', 'Low']\n", "runs = [run_high, run_med, run_low]\n", "\n", "if \"{\" in h5path_ctrl:\n", @@ -210,7 +215,7 @@ "source": [ "if karabo_da[0] == '-1':\n", " if modules[0] == -1:\n", - " modules = list(range(16))\n", + " modules = list(range(nmods))\n", " karabo_da = [\"AGIPD{:02d}\".format(i) for i in modules]\n", "else:\n", " modules = [int(x[-2:]) for x in karabo_da]\n", @@ -286,6 +291,8 @@ " acq_rate: float,\n", " h5path: str,\n", " h5path_idx: str,\n", + " control_names: List[str],\n", + " karabo_id_control: str,\n", " inp: Tuple[str, int, int]) -> Tuple[np.array, np.array, np.array, np.array, int, np.array, int, float]:\n", " import numpy as np\n", " import copy\n", @@ -418,7 +425,8 @@ "p = partial(characterize_module, IL_MODE, max_cells,\n", " (thresholds_offset_hard, thresholds_offset_sigma,\n", " thresholds_noise_hard, thresholds_noise_sigma),\n", - " rawversion, karabo_id, acq_rate, h5path, h5path_idx)\n", + " rawversion, karabo_id, acq_rate, h5path, h5path_idx,\n", + " control_names, karabo_id_control)\n", "\n", "# Don't remove. Used for Debugging.\n", "#results = list(map(p, inp))\n", @@ -622,12 +630,14 @@ }, "outputs": [], "source": [ - "mnames=[]\n", - "for i in modules:\n", - " qm = f\"Q{i//4+1}M{i % 4+1}\"\n", - " mnames.append(qm)\n", - " display(Markdown(f'## Position of the module {qm} and it\\'s ASICs##'))\n", - "show_processed_modules(dinstance, constants=None, mnames=mnames, mode=\"position\")" + "# TODO: add show_processed_modules diagram for Mini-Half AGIPD\n", + "if dinstance != \"AGIPD500K\":\n", + " mnames=[]\n", + " for i in modules:\n", + " qm = f\"Q{i//4+1}M{i % 4+1}\"\n", + " mnames.append(qm)\n", + " display(Markdown(f'## Position of the module {qm} and it\\'s ASICs##'))\n", + " show_processed_modules(dinstance, constants=None, mnames=mnames, mode=\"position\")" ] }, { diff --git a/notebooks/generic/overallmodules_Darks_Summary_NBC.ipynb b/notebooks/generic/overallmodules_Darks_Summary_NBC.ipynb index bacf630eaf9b0c4b61d0773ddd8c33d0d7310150..a40e1281c649d3625d1d65da961f0c2b0e00efdd 100644 --- a/notebooks/generic/overallmodules_Darks_Summary_NBC.ipynb +++ b/notebooks/generic/overallmodules_Darks_Summary_NBC.ipynb @@ -9,9 +9,8 @@ "#Author: K. Ahmed, M. Karnevsky, Version: 0.1\n", "#The following is a summary for the processing of dark images and calibration constants production.\n", "\n", - "cluster_profile = \"noDB\" # The ipcluster profile to use\n", - "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/agipd-test-report\" # path to output to, required\n", - "karabo_id = \"SPB_DET_AGIPDM-1\" # detector instance\n", + "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/miniHalfAGIPD\" # path to output to, required\n", + "karabo_id = \"DETLAB_DET_AGIPD500K2G\" # detector instance\n", "gain_names = ['High gain', 'Medium gain', 'Low gain'] # a list of gain names to be used in plotting\n", "threshold_names = ['HG-MG threshold', 'MG_LG threshold'] # a list of gain names to be used in plotting" ] @@ -54,12 +53,17 @@ "metadata": {}, "outputs": [], "source": [ - "SHOW=True\n", "if \"AGIPD\" in karabo_id:\n", " if \"SPB\" in karabo_id:\n", " dinstance = \"AGIPD1M1\"\n", + " nmod = 16\n", + " qm = f\"Q{i//4+1}M{i%4+1}\"\n", " elif \"MID\" in karabo_id:\n", " dinstance = \"AGIPD1M2\"\n", + " nmod = 16\n", + " elif \"HED\" in karabo_id or \"DETLAB\" in karabo_id :\n", + " dinstance = \"AGIPD500K\"\n", + " nmod = 8\n", " display(Markdown(\"\"\"\n", " \n", "# Summary of AGIPD dark characterization #\n", @@ -112,6 +116,7 @@ " \n", "elif \"LPD\" in karabo_id:\n", " dinstance = \"LPD1M1\"\n", + " nmod = 16\n", " display(Markdown(\"\"\"\n", " \n", "# Summary of LPD dark characterization #\n", @@ -154,6 +159,7 @@ "\"\"\"))\n", "elif \"DSSC\" in karabo_id:\n", " dinstance = \"DSSC1M1\"\n", + " nmod = 16\n", " display(Markdown(\"\"\"\n", " \n", "# Summary of DSSC dark characterization #\n", @@ -180,7 +186,7 @@ "old_cons = OrderedDict()\n", "mod_names = []\n", "# Loop over modules\n", - "for i in range(16):\n", + "for i in range(nmod):\n", " qm = f\"Q{i//4+1}M{i%4+1}\"\n", " # loop over constants\n", " detinst = getattr(Detectors, dinstance)\n", @@ -247,8 +253,10 @@ }, "outputs": [], "source": [ - "display(Markdown('## Processed modules ##'))\n", - "show_processed_modules(dinstance, constants, mod_names, mode=\"processed\")" + "# TODO: add show_processed_modules diagram for Mini-Half AGIPD\n", + "if dinstance != \"AGIPD500K\":\n", + " display(Markdown('## Processed modules ##'))\n", + " show_processed_modules(dinstance, constants, mod_names, mode=\"processed\")" ] }, { @@ -297,6 +305,14 @@ "gainstages = 1\n", "\n", "for const_name, const in constants.items():\n", + " \n", + " \n", + " #TODO: add a Summary figure across modules\n", + " if dinstance == \"AGIPD500K\":\n", + " display(Markdown(f'WARNING: No summary figures are available for AGIPD mini-half at the moment.'))\n", + " break\n", + " \n", + " \n", " if const_name == 'BadPixelsDark':\n", " continue\n", " # Check if constant gain available in constant e.g. AGIPD, LPD\n", @@ -317,8 +333,8 @@ " glabel = threshold_names\n", " else:\n", " glabel = gain_names\n", - " for i in range(16):\n", - " qm = f\"Q{i//4+1}M{i%4+1}\"\n", + " for i in range(nmods):\n", + " qm = qm.format(i)\n", " if qm in mod_names:\n", " m_idx = mod_names.index(qm)\n", " # Check if constant shape of 5 indices e.g. AGIPD, LPD\n", @@ -550,6 +566,20 @@ " md = display(Latex(tabulate.tabulate(\n", " table, tablefmt='latex', headers=header)))" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {