diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb index 93a53fddc8f7499c0dc15f9e2017525e6dc1116a..819065b38658ae829d80b800a9c6089b461e2f21 100644 --- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb +++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb @@ -72,25 +72,24 @@ "local_output = True # output constants locally\n", "db_output = True # output constants to database\n", "bias_voltage = 250 # detector bias voltage\n", - "cal_db_interface = \"tcp://max-exfl016:8017\" # the database interface to use\n", + "cal_db_interface = \"tcp://max-exfl016:8015#8025\" # the database interface to use\n", + "cal_db_timeout = 300000 # timeout on caldb requests\"\n", "\n", "thresholds_offset_sigma = 3. # bad pixel relative threshold in terms of n sigma offset\n", "thresholds_offset_hard = [400, 1500] # bad pixel hard threshold\n", "thresholds_noise_sigma = 7. # bad pixel relative threshold in terms of n sigma noise\n", "thresholds_noise_hard = [1, 35] # bad pixel hard threshold\n", "skip_first_ntrains = 10 # Number of first trains to skip\n", - "use_dir_creation_date = False # use the creation date of the directory for database time derivation\n", + "not_use_dir_creation_date = False # do not use the creation date of the directory for database time derivation\n", "instrument = \"FXE\" # instrument name\n", - "ntrains = 10 # number of trains to use\n", + "ntrains = 300 # number of trains to use\n", "high_res_badpix_3d = False # plot bad-pixel summary in high resolution" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "from collections import OrderedDict\n", @@ -165,15 +164,18 @@ "DET_FILE_INSET = \"LPD\"\n", "\n", "creation_time = None\n", - "if use_dir_creation_date:\n", + "if not not_use_dir_creation_date:\n", " creation_time = get_dir_creation_date(in_folder, run_high)\n", " print(\"Using {} as creation time\".format(creation_time))\n", "\n", "run, prop, seq = run_prop_seq_from_path(in_folder)\n", "logger = InfluxLogger(detector=\"LPD\", instrument=instrument, mem_cells=mem_cells,\n", " notebook=get_notebook_name(), proposal=prop)\n", - " \n", + "\n", + "cal_db_interface = get_random_db_interface(cal_db_interface)\n", + "\n", "display(Markdown('## Evaluated parameters'))\n", + "print('CalDB Interface {}'.format(cal_db_interface))\n", "print(\"Proposal: {}\".format(prop))\n", "print(\"Memory cells: {}/{}\".format(mem_cells, max_cells))\n", "print(\"Runs: {}, {}, {}\".format(run_high, run_med, run_low))\n", @@ -187,9 +189,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# set everything up filewise\n", @@ -210,9 +210,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# the actual characterization - to not eded this without consultation\n", @@ -360,9 +358,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# save everything to file.\n", @@ -386,16 +382,14 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Retrieve existing constants for comparison\n", "clist = [\"Offset\", \"Noise\", \"BadPixelsDark\"]\n", "old_const = {}\n", "old_mdata = {}\n", - "creation_time = dateutil.parser.parse(\"2019-02-14\")\n", + "\n", "print('Retrieve pre-existing constants for comparison.')\n", "for cap in capacitor_settings:\n", " for qm in offset_g[cap].keys():\n", @@ -409,7 +403,7 @@ " condition,\n", " None,\n", " cal_db_interface, creation_time=creation_time,\n", - " verbosity=2, timeout=30000)\n", + " verbosity=2, timeout=cal_db_timeout)\n", "\n", " old_const[const] = data\n", "\n", @@ -423,9 +417,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "res = OrderedDict()\n", @@ -443,9 +435,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Save constants in the calibration DB\n", @@ -474,7 +464,7 @@ " else:\n", " metadata.calibration_constant_version = Versions.Timespan(device=device,\n", " start=creation_time)\n", - " metadata.send(cal_db_interface)\n", + " metadata.send(cal_db_interface, timeout=cal_db_timeout)\n", " msg = 'Const {} for module {} was injected to the calibration DB. Begin at: {}'\n", " print(msg.format(const, qm,\n", " metadata.calibration_constant_version.begin_at))" @@ -483,9 +473,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "qm = \"Q{}M{}\".format(modules[0]//4+1, modules[0] % 4+1)\n", @@ -557,9 +545,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "fig, grid = plt.subplots(3, 1, sharex=\"col\", sharey=\"row\", figsize=(10, 7))\n", @@ -648,9 +634,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Loop over capacitor settings, modules, constants\n", @@ -723,7 +707,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [], @@ -828,9 +811,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "cols = {BadPixels.NOISE_OUT_OF_THRESHOLD.value: (BadPixels.NOISE_OUT_OF_THRESHOLD.name, '#FF000080'),\n", @@ -872,9 +853,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "display(Markdown('The following pre-existing constants are used for comparison: \\n'))\n", @@ -885,9 +864,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Loop over capacitor settings, modules, constants\n", @@ -983,9 +960,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Loop over capacitor settings, modules, constants\n", @@ -1018,9 +993,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Loop over capacitor settings, modules, constants\n", @@ -1074,9 +1047,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Loop over capacitor settings, modules, constants\n", @@ -1166,9 +1137,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "table = []\n", @@ -1222,9 +1191,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "\n", @@ -1280,7 +1247,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3" + "version": "3.6.7" } }, "nbformat": 4,