-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a43826
commit 9d8a465
Showing
1 changed file
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import sys, os\n", | ||
"import numpy as np\n", | ||
"import dask\n", | ||
"import h5py\n", | ||
"\n", | ||
"sys.path.append(\".../hextof-processor\")\n", | ||
"# sys.path.append('.../pah')\n", | ||
"from processor.DldFlashDataframeCreator import DldFlashProcessor, utils" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Binning parameter settings\n", | ||
"mb_start=100\n", | ||
"mb_end=399\n", | ||
"\n", | ||
"ToFfrom = 119.5\n", | ||
"ToFto = 124.5\n", | ||
"ToFstep=0.01\n", | ||
"\n", | ||
"delayFrom=-516.15\n", | ||
"delayTo=-512.3\n", | ||
"delayStep=0.02\n", | ||
"\n", | ||
"# dld parameters\n", | ||
"dldXFrom=30\n", | ||
"dldXTo=2700\n", | ||
"dldXStep=30\n", | ||
"\n", | ||
"# dld parameters\n", | ||
"dldYFrom=0\n", | ||
"dldYTo=2850\n", | ||
"dldYStep=30" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run no.22191\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22191\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"\n", | ||
"processor.resetBins()\n", | ||
"ToF = processor.addBinning('dldTime', ToFfrom,ToFto,ToFstep)\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd = processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd = processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd = processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd = processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100-0.01\n", | ||
"result_low1 = processor.computeBinnedData()\n", | ||
"\n", | ||
"\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22191\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"\n", | ||
"processor.resetBins()\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100-0.01\n", | ||
"processor.dd=processor.dd[((processor.dd['dldTime']<124.5)&(processor.dd['dldTime']>119.5))]\n", | ||
"hist_low1 = processor.computeBinnedData()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run no.22192\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22192\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"\n", | ||
"processor.resetBins()\n", | ||
"ToF = processor.addBinning('dldTime', ToFfrom,ToFto,ToFstep)\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100\n", | ||
"result_low2 = processor.computeBinnedData()\n", | ||
"\n", | ||
"\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22192\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"processor.resetBins()\n", | ||
"\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100\n", | ||
"processor.dd=processor.dd[((processor.dd['dldTime']<124.5)&(processor.dd['dldTime']>119.5))]\n", | ||
"hist_low2 = processor.computeBinnedData()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run no.22193\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22193\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"\n", | ||
"processor.resetBins()\n", | ||
"ToF = processor.addBinning('dldTime', ToFfrom,ToFto,ToFstep)\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100\n", | ||
"result_low3 = processor.computeBinnedData()\n", | ||
"\n", | ||
"\n", | ||
"processor = DldFlashProcessor()\n", | ||
"processor.runNumber = 22193\n", | ||
"processor.readDataframes(format='parquet')\n", | ||
"\n", | ||
"processor.resetBins()\n", | ||
"Delay = processor.addBinning('delayStage', delayFrom,delayTo,delayStep)\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosX']<1290)|(processor.dd['dldPosX']>1410))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldPosY']<1380)|(processor.dd['dldPosY']>1500))]\n", | ||
"processor.dd=processor.dd[((processor.dd['dldMicrobunchId']<=mb_end)&(processor.dd['dldMicrobunchId']>=mb_start))]\n", | ||
"processor.dd['delayStage'] = processor.dd['delayStage'] - processor.dd['bam']\n", | ||
"\n", | ||
"processor.shiftQuadrants()\n", | ||
"processor.filterCircleDLDPos()\n", | ||
"processor.correctSpaceCharge()\n", | ||
"processor.correctSpaceCharge2()\n", | ||
"processor.dd.dldTime=(1567*1567)/((processor.dd.dldTime-338.216)*(processor.dd.dldTime-338.216))+100\n", | ||
"processor.dd = processor.dd[((processor.dd['dldTime']<124.5)&(processor.dd['dldTime']>119.5))]\n", | ||
"hist_low3 = processor.computeBinnedData()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"a = hist_low1[50:150].mean()\n", | ||
"b = hist_low2[50:150].mean()\n", | ||
"c = hist_low3[50:150].mean()\n", | ||
"result_norm_low1 = []\n", | ||
"result_norm_low2 = []\n", | ||
"result_norm_low3 = []\n", | ||
"result_norm_low1 = (result_low1/hist_low1)*a\n", | ||
"result_norm_low2 = (result_low2/hist_low2)*b\n", | ||
"result_norm_low3 = (result_low3/hist_low3)*c" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.6.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |