-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add interface to load pre-binned bias series into the processor and a…
…dd example notebook to use the energy calibrator workflow with FLASH data
- Loading branch information
Showing
4 changed files
with
357 additions
and
12 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
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
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,206 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "39b2e62a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"\n", | ||
"from sed import SedProcessor\n", | ||
"import sed\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"# %matplotlib inline\n", | ||
"%matplotlib widget\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4d78d236", | ||
"metadata": {}, | ||
"source": [ | ||
"# Try to calibrate energy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a62f084f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Spin-integrated branch, E_TOF=10eV\n", | ||
"single scan, move sample bias manually every 2000 pulses." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7dabbe92", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sp = SedProcessor(runs=[44638], config=\"config_flash_energy_calib.yaml\", system_config={})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "248a41a7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sp.add_jitter()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2b867e40", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"axes = ['sampleBias', 'dldTime']\n", | ||
"bins = [6, 500]\n", | ||
"ranges = [[0,6], [40000, 55000]]\n", | ||
"res = sp.compute(bins=bins, axes=axes, ranges=ranges)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "62081458", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sp.load_bias_series(binned_data=res)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "424af94e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ranges=(44500, 46000)\n", | ||
"ref_id=3\n", | ||
"sp.find_bias_peaks(ranges=ranges, ref_id=ref_id)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "034eff42", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ref_id=3\n", | ||
"ref_energy=-.3\n", | ||
"sp.calibrate_energy_axis(ref_id=ref_id, ref_energy=ref_energy, method=\"lstsq\", order=3)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "bbbfe992", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ref_id=3\n", | ||
"ref_energy=-.3\n", | ||
"sp.calibrate_energy_axis(ref_id=ref_id, ref_energy=ref_energy, method=\"lmfit\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e14d6cef", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sp.append_energy_axis(preview=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "59c83544", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"axes = ['sampleBias', 'energy']\n", | ||
"bins = [6, 1000]\n", | ||
"ranges = [[0,6], [-5, 5]]\n", | ||
"res = sp.compute(bins=bins, axes=axes, ranges=ranges)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "addba4cb", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"plt.figure()\n", | ||
"res[3,:].plot()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1676ec57", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"axes = ['sampleBias', 'energy', 'dldPosX']\n", | ||
"bins = [6, 100, 480]\n", | ||
"ranges = [[0,6], [-2, 1], [420,900]]\n", | ||
"res = sp.compute(bins=bins, axes=axes, ranges=ranges)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ad199c40", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"plt.figure()\n", | ||
"res[3, :, :].plot()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3a4ae88c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".pyenv", | ||
"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.8.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.