From 0bdb6e2cb536d24ff88738ce1a1a9de62800b112 Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Mon, 11 Nov 2019 17:38:29 +0100 Subject: [PATCH] add bools to control correction --- ...orrectionNotebook_NewDAQ_FastCCD_NBC.ipynb | 353 +++++++++++------- 1 file changed, 210 insertions(+), 143 deletions(-) diff --git a/notebooks/FastCCD/CorrectionNotebook_NewDAQ_FastCCD_NBC.ipynb b/notebooks/FastCCD/CorrectionNotebook_NewDAQ_FastCCD_NBC.ipynb index c80d17a47..7f3c35ece 100644 --- a/notebooks/FastCCD/CorrectionNotebook_NewDAQ_FastCCD_NBC.ipynb +++ b/notebooks/FastCCD/CorrectionNotebook_NewDAQ_FastCCD_NBC.ipynb @@ -18,13 +18,12 @@ "ExecuteTime": { "end_time": "2018-12-06T15:54:23.218849Z", "start_time": "2018-12-06T15:54:23.166497Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ "in_folder = \"/gpfs/exfel/exp/SCS/201802/p002170/raw/\" # input folder, required\n", - "out_folder = '/gpfs/exfel/data/scratch/xcal/test/' # output folder, required\n", + "out_folder = '/gpfs/exfel/data/scratch/ahmedk/test/fastccd' # output folder, required\n", "path_template = 'RAW-R{:04d}-{}-S{{:05d}}.h5' # path template in hdf5 file\n", "path_inset = 'DA05'\n", "run = 277 # run number\n", @@ -42,16 +41,23 @@ "sequences = [-1] # sequences to correct, set to -1 for all, range allowed\n", "chunk_size_idim = 1 # H5 chunking size of output data\n", "overwrite = True # overwrite existing files\n", - "do_pattern_classification = True # classify split events\n", "sequences_per_node = 1 # sequences to correct per node\n", "limit_images = 0 # limit images per file \n", - "correct_offset_drift = False # correct for offset drifts\n", "use_dir_creation_date = True # use dir creation data for calDB queries\n", "time_offset_days = 0 # offset in days for calibration parameters\n", "photon_energy_gain_map = 2. # energy in keV\n", "fix_temperature = 0. # fix temperature to this value, set to 0 to use slow control value\n", "flipped_between = [\"2019-02-01\", \"2019-04-02\"] # detector was flipped during this timespan\n", "temp_limits = 5 # limits within which temperature is considered the same\n", + "commonModeAxis = 1 # Axis along which common mode will be calculated (0: along rows, 1: along columns)\n", + "\n", + "# Correction Booleans\n", + "only_offset = False # Only apply offset correction\n", + "cti_corr = True # Apply CTI correction\n", + "relgain_corr = True # Apply relative gain correction\n", + "common_mode_corr = True # Apply commonMode correction\n", + "correct_offset_drift = False # correct for offset drifts\n", + "do_pattern_classification = True # classify split events\n", "\n", "def balance_sequences(in_folder, run, sequences, sequences_per_node):\n", " import glob\n", @@ -74,6 +80,38 @@ " return sequences" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Fill dictionaries comprising bools and arguments for correction and data analysis\n", + "\n", + "# Here the herarichy and dependability for correction booleans are defined \n", + "corr_bools = {}\n", + "\n", + "# offset is at the bottom of AGIPD correction pyramid.\n", + "corr_bools[\"only_offset\"] = only_offset\n", + "\n", + "# Dont apply any corrections if only_offset is requested \n", + "if not only_offset:\n", + " \n", + " # Apply relative gain correction, only if requested\n", + " if relgain_corr:\n", + " corr_bools[\"relgain\"] = relgain_corr\n", + " \n", + " # Apply CTI correction, only if requested\n", + " if cti_corr:\n", + " corr_bools[\"cti\"] = cti_corr\n", + " \n", + " corr_bools[\"common_mode\"] = common_mode_corr\n", + " corr_bools[\"offset_drift\"] = correct_offset_drift\n", + " corr_bools[\"pattern_class\"] = do_pattern_classification\n", + "# Here the herarichy and dependability for data analysis booleans and arguments are defined \n", + "data_analysis_parms = {}" + ] + }, { "cell_type": "code", "execution_count": null, @@ -187,7 +225,7 @@ "\n", "sensorSize = [x, y]\n", "chunkSize = 100 #Number of images to read per chunk\n", - "blockSize = [sensorSize[0]//2, sensorSize[1]//4] #Sensor area will be analysed according to blocksize\n", + "blockSize = [sensorSize[0]//2, sensorSize[1]] #Sensor area will be analysed according to blocksize\n", "xcal.defaultBlockSize = blockSize\n", "memoryCells = 1 #FastCCD has 1 memory cell\n", "#Specifies total number of images to proceed\n", @@ -227,8 +265,7 @@ "ExecuteTime": { "end_time": "2018-12-06T15:54:24.088948Z", "start_time": "2018-12-06T15:54:24.059925Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -448,104 +485,100 @@ "ExecuteTime": { "end_time": "2018-12-06T15:54:28.343869Z", "start_time": "2018-12-06T15:54:28.271344Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ "## relative gain\n", + "if corr_bools.get('relgain'):\n", + " metadata = ConstantMetaData()\n", + " relgain = Constants.CCD(DetectorTypes.fastCCD).RelativeGain()\n", + " metadata.calibration_constant = relgain\n", "\n", - "metadata = ConstantMetaData()\n", - "relgain = Constants.CCD(DetectorTypes.fastCCD).RelativeGain()\n", - "metadata.calibration_constant = relgain\n", - "\n", - "# set the operating condition\n", - "condition = Conditions.Illuminated.CCD(bias_voltage=bias_voltage,\n", - " integration_time=integration_time,\n", - " gain_setting=0,\n", - " temperature=temperature_k,\n", - " pixels_x=1934,\n", - " pixels_y=960, photon_energy=photon_energy_gain_map)\n", - "device = Detectors.fastCCD1\n", + " # set the operating condition\n", + " condition = Conditions.Illuminated.CCD(bias_voltage=bias_voltage,\n", + " integration_time=integration_time,\n", + " gain_setting=0,\n", + " temperature=temperature_k,\n", + " pixels_x=1934,\n", + " pixels_y=960, photon_energy=photon_energy_gain_map)\n", + " device = Detectors.fastCCD1\n", "\n", "\n", - "metadata.detector_condition = condition\n", + " metadata.detector_condition = condition\n", "\n", - "# specify the a version for this constant\n", - "metadata.calibration_constant_version = Versions.Now(device=device)\n", - "metadata.retrieve(cal_db_interface)\n", + " # specify the a version for this constant\n", + " metadata.calibration_constant_version = Versions.Now(device=device)\n", + " metadata.retrieve(cal_db_interface)\n", "\n", - "relGain = relgain.data[::-1,...]\n" + " relGain = relgain.data[::-1,...]\n" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ - "relGainCA = copy.copy(relGain)\n", - "relGainC = relGainCA[:relGainCA.shape[0]//2,...]\n", - "ctiA = np.ones(relGainCA.shape[:2])\n", - "cti = np.ones(relGainC.shape[:2])\n", - "i = 0\n", - "idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", - "mn1 = np.nanmean(relGainC[i, ~idx, 0])\n", - "\n", - "for i in range(1, relGainC.shape[0]):\n", + "if corr_bools.get('cti'):\n", + " relGainCA = copy.copy(relGain)\n", + " relGainC = relGainCA[:relGainCA.shape[0]//2,...]\n", + " ctiA = np.ones(relGainCA.shape[:2])\n", + " cti = np.ones(relGainC.shape[:2])\n", + " i = 0\n", " idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", - " mn2 = np.nanmean(relGainC[i, ~idx, 0])\n", - " cti[i,:] = mn2/mn1\n", - "ctiA[:relGainCA.shape[0]//2,...] = cti\n", + " mn1 = np.nanmean(relGainC[i, ~idx, 0])\n", "\n", - "relGainC = relGainCA[relGainCA.shape[0]//2:,...]\n", + " for i in range(1, relGainC.shape[0]):\n", + " idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", + " mn2 = np.nanmean(relGainC[i, ~idx, 0])\n", + " cti[i,:] = mn2/mn1\n", + " ctiA[:relGainCA.shape[0]//2,...] = cti\n", "\n", + " relGainC = relGainCA[relGainCA.shape[0]//2:,...]\n", "\n", - "cti = np.ones(relGainC.shape[:2])\n", - "i = -1\n", - "idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", - "mn1 = np.nanmean(relGainC[i, ~idx, 0])\n", "\n", - "for i in range(relGainC.shape[0]-1, 1, -1):\n", + " cti = np.ones(relGainC.shape[:2])\n", + " i = -1\n", " idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", - " mn2 = np.nanmean(relGainC[i, ~idx, 0])\n", - " cti[i,:] = mn2/mn1\n", - "\n", - "ctiA[relGainCA.shape[0]//2:,...] = cti\n", - "\n", - "relGainCA = copy.copy(relGain)\n", - "relGainC = relGainCA[:relGainCA.shape[0]//2,...]\n", - "for i in range(relGainC.shape[1]):\n", - " idx = (relGainC[:,i, 0] < 0.95) | (relGainC[:,i,0] > 1.05)\n", - " relGainC[idx,i,0] = np.nanmean(relGainC[~idx,i,0])\n", - " relGainC[idx,i,1] = np.nanmean(relGainC[~idx,i,1])\n", - " relGainC[idx,i,2] = np.nanmean(relGainC[~idx,i,2])\n", - "relGainCA[:relGainCA.shape[0]//2,...] = relGainC\n", - "relGainC = relGainCA[relGainCA.shape[0]//2:,...]\n", - "for i in range(relGainC.shape[1]):\n", - " idx = (relGainC[:,i, 0] < 0.95) | (relGainC[:,i,0] > 1.05)\n", - " relGainC[idx,i,0] = np.nanmean(relGainC[~idx,i,0])\n", - " relGainC[idx,i,1] = np.nanmean(relGainC[~idx,i,1])\n", - " relGainC[idx,i,2] = np.nanmean(relGainC[~idx,i,2])\n", - "relGainCA[relGainCA.shape[0]//2:,...] = relGainC\n", - "relGainC = relGainCA*ctiA[...,None]\n", - "\n", - "relGain = relGainC" + " mn1 = np.nanmean(relGainC[i, ~idx, 0])\n", + "\n", + " for i in range(relGainC.shape[0]-1, 1, -1):\n", + " idx = (relGainC[i, :, 0] < 0.9) | (relGainC[i,:,0] > 1.1)\n", + " mn2 = np.nanmean(relGainC[i, ~idx, 0])\n", + " cti[i,:] = mn2/mn1\n", + "\n", + " ctiA[relGainCA.shape[0]//2:,...] = cti\n", + "\n", + " relGainCA = copy.copy(relGain)\n", + " relGainC = relGainCA[:relGainCA.shape[0]//2,...]\n", + " for i in range(relGainC.shape[1]):\n", + " idx = (relGainC[:,i, 0] < 0.95) | (relGainC[:,i,0] > 1.05)\n", + " relGainC[idx,i,0] = np.nanmean(relGainC[~idx,i,0])\n", + " relGainC[idx,i,1] = np.nanmean(relGainC[~idx,i,1])\n", + " relGainC[idx,i,2] = np.nanmean(relGainC[~idx,i,2])\n", + " relGainCA[:relGainCA.shape[0]//2,...] = relGainC\n", + " relGainC = relGainCA[relGainCA.shape[0]//2:,...]\n", + " for i in range(relGainC.shape[1]):\n", + " idx = (relGainC[:,i, 0] < 0.95) | (relGainC[:,i,0] > 1.05)\n", + " relGainC[idx,i,0] = np.nanmean(relGainC[~idx,i,0])\n", + " relGainC[idx,i,1] = np.nanmean(relGainC[~idx,i,1])\n", + " relGainC[idx,i,2] = np.nanmean(relGainC[~idx,i,2])\n", + " relGainCA[relGainCA.shape[0]//2:,...] = relGainC\n", + " relGainC = relGainCA*ctiA[...,None]\n", + "\n", + " relGain = relGainC" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import dateutil.parser\n", "flipped_between = [dateutil.parser.parse(d) for d in flipped_between]\n", - "flip_rgain = creation_time >= flipped_between[0] and creation_time <= flipped_between[1]\n", + "flip_rgain = creation_time.replace(tzinfo=None) >= flipped_between[0] and creation_time.replace(tzinfo=None) <= flipped_between[1]\n", "flip_rgain &= (metadata.calibration_constant_version.begin_at.replace(tzinfo=None) >= flipped_between[0] \n", " and metadata.calibration_constant_version.begin_at.replace(tzinfo=None) <= flipped_between[1])\n", "print(\"Accounting for flipped detector: {}\".format(flip_rgain))\n" @@ -558,21 +591,20 @@ "ExecuteTime": { "end_time": "2018-12-06T15:54:28.771629Z", "start_time": "2018-12-06T15:54:28.346051Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ "#************************Calculators************************#\n", "\n", - "\n", - "cmCorrection = xcal.CommonModeCorrection([x, y], \n", - " commonModeBlockSize, \n", - " commonModeAxisR,\n", - " nCells = memoryCells, \n", - " noiseMap = noiseMap,\n", - " runParallel=True,\n", - " stats=True)\n", + "if corr_bools.get('common_mode'):\n", + " cmCorrection = xcal.CommonModeCorrection([x, y],\n", + " commonModeBlockSize, \n", + " commonModeAxis,\n", + " nCells = memoryCells,\n", + " stride=10,\n", + " runParallel=True,\n", + " stats=True, minFrac=0)\n", "\n", "patternClassifierLH = xcal.PatternClassifier([x//2, y], \n", " noiseMap[:x//2, :], \n", @@ -612,8 +644,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:08:51.886343Z", "start_time": "2018-12-06T16:08:51.842837Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -638,7 +669,15 @@ " range=[-50, 1000],\n", " nCells=memoryCells, \n", " cores=cpuCores,\n", - " blockSize=blockSize)" + " blockSize=blockSize)\n", + "\n", + "\n", + "histCalCommonModeCor = xcal.HistogramCalculator([x, y], \n", + " bins=500, \n", + " range=[-50, 1000],\n", + " nCells=memoryCells, \n", + " cores=cpuCores,\n", + " blockSize=blockSize)" ] }, { @@ -655,8 +694,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:08:52.441784Z", "start_time": "2018-12-06T16:08:52.437284Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -673,13 +711,13 @@ "ExecuteTime": { "end_time": "2018-12-06T16:08:53.042555Z", "start_time": "2018-12-06T16:08:53.034522Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ "histCalOffsetCor.debug()\n", - "histCalPcorr.debug()\n" + "histCalCommonModeCor.debug()\n", + "histCalPcorr.debug()" ] }, { @@ -689,8 +727,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:08:53.551111Z", "start_time": "2018-12-06T16:08:53.531064Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -721,8 +758,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:55.917179Z", "start_time": "2018-12-06T16:09:01.603633Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -735,7 +771,8 @@ "offsetMap = np.squeeze(offsetMap)\n", "noiseMap = np.squeeze(noiseMap)\n", "badPixelMap = np.squeeze(badPixelMap)\n", - "relGain = np.squeeze(relGain)\n", + "if corr_bools.get('relgain'):\n", + " relGain = np.squeeze(relGain)\n", "for k, f in enumerate(file_list):\n", " with h5py.File(f, 'r', driver='core') as infile:\n", " out_fileb = \"{}/{}\".format(out_folder, f.split(\"/\")[-1])\n", @@ -778,20 +815,31 @@ " if not flip_rgain: # rgain was taken during flipped orientation\n", " fstride = -1\n", " \n", - " data = np.bitwise_and(data, 0b0011111111111111).astype(np.float32) \n", - " omap = np.repeat(offsetMap[...,None,:], data.shape[2], axis=2)\n", - " rmap = np.repeat(relGain[:,::fstride,None,:], data.shape[2], axis=2)\n", + " data = np.bitwise_and(data, 0b0011111111111111).astype(np.float32)\n", + "\n", + " # creating maps for correction usage\n", + " omap = np.repeat(offsetMap[...,None,:], data.shape[2], axis=2) \n", " nmap = np.repeat(noiseMap[...,None,:], data.shape[2], axis=2)\n", " bmap = np.repeat(badPixelMap[...,None,:], data.shape[2], axis=2)\n", + "\n", + " # selecting element value related to the gain of the pixel.\n", " offset = np.choose(gain, (omap[...,0], omap[...,1], omap[...,2]))\n", - " rg = np.choose(gain, (rmap[...,0], rmap[...,1], rmap[...,2]))\n", " noise = np.choose(gain, (nmap[...,0], nmap[...,1], nmap[...,2]))\n", " bpix = np.choose(gain, (bmap[...,0], bmap[...,1], bmap[...,2]))\n", + "\n", + " # same for relative gain if correction is available\n", + " if corr_bools.get('relgain'):\n", + " rmap = np.repeat(relGain[:,::fstride,None,:], data.shape[2], axis=2)\n", + " rg = np.choose(gain, (rmap[...,0], rmap[...,1], rmap[...,2]))\n", " \n", + " # Apply offset correction\n", " data -= offset\n", - " data *= rg\n", + "\n", + " if corr_bools.get('relgain'):\n", + " # Apply relative gain correction\n", + " data *= rg\n", " \n", - " if correct_offset_drift:\n", + " if corr_bools.get(\"offset_drift\"):\n", " lhd = np.mean(data[x//2-10:x//2,y//2-5:y//2+5,:], axis=(0,1))\n", " data[:x//2, :, :] -= lhd\n", " drift_lh.append(lhd)\n", @@ -811,7 +859,7 @@ " mean_im = np.nanmean(data, axis=2)\n", " single_im = data[...,0]\n", " \n", - " if do_pattern_classification:\n", + " if corr_bools.get(\"pattern_class\"):\n", " \n", " ddsetcm = ofile.create_dataset(h5path+\"/pixels_cm\",\n", " oshape,\n", @@ -831,9 +879,16 @@ "\n", " patternClassifierLH._noisemap = noise[:x//2, :, :]\n", " patternClassifierUH._noisemap = noise[x//2:, :, :]\n", + " \n", + " # common mode correction\n", + " if corr_bools.get(\"common_mode\"):\n", + " cellTable = np.zeros(data.shape[2], np.int32) # Common mode correction\n", + " data = cmCorrection.correct(data.astype(np.float32), cellTable=cellTable, noiseMap=noise) \n", "\n", - " data = cmCorrection.correct(data) # correct for the row common mode\n", - " ddsetcm[...] = np.moveaxis(data, 2, 0)\n", + " # correct for the row common mode\n", + " ddsetcm[...] = np.moveaxis(data, 2, 0)\n", + "\n", + " histCalCommonModeCor.fill(data)\n", "\n", " dataLH = data[:x//2, :, :]\n", " dataUH = data[x//2:, :, :]\n", @@ -871,12 +926,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.094985Z", "start_time": "2018-12-06T16:10:55.918900Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if correct_offset_drift:\n", + "if corr_bools.get(\"offset_drift\"):\n", " lhds = np.concatenate(drift_lh)\n", " uhds = np.concatenate(drift_uh)\n", " fig = plt.figure(figsize=(10,5))\n", @@ -894,12 +948,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.126409Z", "start_time": "2018-12-06T16:10:56.096242Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " print(\"******************LOWER HEMISPHERE******************\\n\")\n", "\n", " patternStatsLH = patternClassifierLH.getPatternStats()\n", @@ -951,12 +1004,13 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.176160Z", "start_time": "2018-12-06T16:10:56.127853Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", + " print(\"******************UPPER HEMISPHERE******************\\n\")\n", + "\n", " patternStatsUH = patternClassifierUH.getPatternStats()\n", " fig = plt.figure(figsize=(15,15))\n", " ax = fig.add_subplot(4,4,1)\n", @@ -996,9 +1050,7 @@ " pmap = ax.imshow(patternStatsUH[m][j], interpolation=\"nearest\", vmax=np.median(patternStatsUH[m][j]))\n", " ax.set_title(m+\"(\"+str(j)+\")\")\n", " cb = fig.colorbar(pmap)\n", - " k+=1\n", - "\n", - " print(\"******************UPPER HEMISPHERE******************\\n\") " + " k+=1\n" ] }, { @@ -1008,12 +1060,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.190150Z", "start_time": "2018-12-06T16:10:56.177570Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " t0 = PrettyTable()\n", " t0.title = \"Total number of Counts after all corrections\"\n", " t0.field_names = [\"Hemisphere\",\"Singles\", \"First-singles\", \"Clusters\"]\n", @@ -1041,12 +1092,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.203219Z", "start_time": "2018-12-06T16:10:56.191509Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " doublesLH = patternStatsLH['doubles'][0] + patternStatsLH['doubles'][1] + patternStatsLH['doubles'][2] + patternStatsLH['doubles'][3]\n", " triplesLH = patternStatsLH['triples'][0] + patternStatsLH['triples'][1] + patternStatsLH['triples'][2] + patternStatsLH['triples'][3]\n", " quadsLH = patternStatsLH['quads'][0] + patternStatsLH['quads'][1] + patternStatsLH['quads'][2] + patternStatsLH['quads'][3]\n", @@ -1070,12 +1120,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:10:56.212586Z", "start_time": "2018-12-06T16:10:56.204731Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " fig = plt.figure(figsize=(10,5))\n", " ax = fig.add_subplot(1,2,1)\n", " labels = ['singles', 'doubles', 'triples', 'quads']\n", @@ -1097,8 +1146,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:13:12.889583Z", "start_time": "2018-12-06T16:13:11.122653Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -1115,7 +1163,17 @@ " },\n", " \n", " ]\n", - " \n", + "\n", + "if corr_bools.get(\"pattern_class\") and corr_bools.get(\"common_mode\"):\n", + " hcm,ecm,ccm,scm = histCalCommonModeCor.get()\n", + " d.append({'x': ccm,\n", + " 'y': hcm,\n", + " 'y_err': np.sqrt(hcm[:]),\n", + " 'drawstyle': 'steps-mid',\n", + " 'errorstyle': 'bars',\n", + " 'errorcoarsing': 2,\n", + " 'label': 'CommonMode corr.'\n", + " })\n", "\n", "fig = xana.simplePlot(d, aspect=1, x_label='Energy(ADU)', \n", " y_label='Number of occurrences', figsize='2col',\n", @@ -1130,12 +1188,11 @@ "ExecuteTime": { "end_time": "2018-12-06T16:12:57.289742Z", "start_time": "2018-12-06T16:12:45.529734Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " h1,e1L,c1L,s1L = histCalPcorr.get()\n", " h1s,e1Ls,c1Ls,s1Ls = histCalPcorrS.get()\n", "\n", @@ -1174,8 +1231,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:11:08.317130Z", "start_time": "2018-12-06T16:11:05.788655Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -1185,7 +1241,7 @@ " x_range=(0,y),\n", " y_range=(0,x), vmin=-50, vmax=500)\n", "\n", - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " fig = xana.heatmapPlot(mean_im_cc,\n", " x_label='Columns', y_label='Rows',\n", " lut_label='Signal (ADU)',\n", @@ -1209,8 +1265,7 @@ "ExecuteTime": { "end_time": "2018-12-06T16:11:10.908912Z", "start_time": "2018-12-06T16:11:08.318486Z" - }, - "collapsed": true + } }, "outputs": [], "source": [ @@ -1220,7 +1275,7 @@ " x_range=(0,y),\n", " y_range=(0,x), vmin=-50, vmax=500)\n", "\n", - "if do_pattern_classification:\n", + "if corr_bools.get(\"pattern_class\"):\n", " fig = xana.heatmapPlot(single_im_cc,\n", " x_label='Columns', y_label='Rows',\n", " lut_label='Signal (ADU)',\n", @@ -1231,9 +1286,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, "outputs": [], "source": [] } -- GitLab