Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 17, 2024
1 parent 1d4c35d commit 0b26863
Show file tree
Hide file tree
Showing 86 changed files with 19,056 additions and 14,144 deletions.
219 changes: 93 additions & 126 deletions sed/develop/_modules/index.html

Large diffs are not rendered by default.

308 changes: 141 additions & 167 deletions sed/develop/_modules/sed/binning/binning.html

Large diffs are not rendered by default.

253 changes: 108 additions & 145 deletions sed/develop/_modules/sed/binning/numba_bin.html

Large diffs are not rendered by default.

264 changes: 115 additions & 149 deletions sed/develop/_modules/sed/binning/utils.html

Large diffs are not rendered by default.

468 changes: 196 additions & 272 deletions sed/develop/_modules/sed/calibrator/delay.html

Large diffs are not rendered by default.

1,044 changes: 439 additions & 605 deletions sed/develop/_modules/sed/calibrator/energy.html

Large diffs are not rendered by default.

851 changes: 334 additions & 517 deletions sed/develop/_modules/sed/calibrator/momentum.html

Large diffs are not rendered by default.

301 changes: 122 additions & 179 deletions sed/develop/_modules/sed/core/config.html

Large diffs are not rendered by default.

406 changes: 188 additions & 218 deletions sed/develop/_modules/sed/core/dfops.html

Large diffs are not rendered by default.

287 changes: 103 additions & 184 deletions sed/develop/_modules/sed/core/metadata.html

Large diffs are not rendered by default.

1,230 changes: 533 additions & 697 deletions sed/develop/_modules/sed/core/processor.html

Large diffs are not rendered by default.

266 changes: 105 additions & 161 deletions sed/develop/_modules/sed/dataset/dataset.html

Large diffs are not rendered by default.

276 changes: 111 additions & 165 deletions sed/develop/_modules/sed/diagnostics.html

Large diffs are not rendered by default.

235 changes: 98 additions & 137 deletions sed/develop/_modules/sed/io/hdf5.html

Large diffs are not rendered by default.

234 changes: 99 additions & 135 deletions sed/develop/_modules/sed/io/nexus.html

Large diffs are not rendered by default.

248 changes: 104 additions & 144 deletions sed/develop/_modules/sed/io/tiff.html

Large diffs are not rendered by default.

320 changes: 127 additions & 193 deletions sed/develop/_modules/sed/loader/base/loader.html

Large diffs are not rendered by default.

1,219 changes: 848 additions & 371 deletions sed/develop/_modules/sed/loader/flash/loader.html

Large diffs are not rendered by default.

258 changes: 107 additions & 151 deletions sed/develop/_modules/sed/loader/flash/metadata.html

Large diffs are not rendered by default.

284 changes: 118 additions & 166 deletions sed/develop/_modules/sed/loader/generic/loader.html

Large diffs are not rendered by default.

238 changes: 98 additions & 140 deletions sed/develop/_modules/sed/loader/loader_interface.html

Large diffs are not rendered by default.

281 changes: 107 additions & 174 deletions sed/develop/_modules/sed/loader/mirrorutil.html

Large diffs are not rendered by default.

849 changes: 338 additions & 511 deletions sed/develop/_modules/sed/loader/mpes/loader.html

Large diffs are not rendered by default.

464 changes: 166 additions & 298 deletions sed/develop/_modules/sed/loader/sxp/loader.html

Large diffs are not rendered by default.

370 changes: 125 additions & 245 deletions sed/develop/_modules/sed/loader/utils.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand All @@ -112,8 +112,8 @@
" \"core\": {\n",
" \"beamtime_id\": 11019101,\n",
" \"paths\": {\n",
" \"raw\": path,\n",
" \"processed\": buffer_path\n",
" \"data_raw_dir\": path,\n",
" \"data_parquet_dir\": buffer_path\n",
" },\n",
" },\n",
"}"
Expand All @@ -129,24 +129,26 @@
"energy_cal = {\n",
" \"energy\": {\n",
" \"calibration\": {\n",
" \"E0\": -132.47100427179566,\n",
" \"creation_date\": '2024-11-30T20:47:03.305244',\n",
" \"d\": 0.8096677238144319,\n",
" \"E0\": -53.96145014592986,\n",
" \"creation_date\": 1732056868.029444,\n",
" \"d\": 0.8096677233434938,\n",
" \"energy_scale\": \"kinetic\",\n",
" \"t0\": 4.0148196706891397e-07,\n",
" \"t0\": 4.0148196718030886e-07,\n",
" },\n",
" \"offsets\":{\n",
" \"constant\": 1,\n",
" \"creation_date\": '2024-11-30T21:17:07.762199',\n",
" \"columns\": {\n",
" \"monochromatorPhotonEnergy\": {\n",
" \"preserve_mean\": True,\n",
" \"weight\": -1,\n",
" },\n",
" \"tofVoltage\": {\n",
" \"preserve_mean\": True,\n",
" \"weight\": -1,\n",
" },\n",
" \"constant\": -77.5,\n",
" \"creation_date\": 1732056874.060922,\n",
" \"monochromatorPhotonEnergy\": {\n",
" \"preserve_mean\": True,\n",
" \"weight\": -1,\n",
" },\n",
" \"sampleBias\": {\n",
" \"preserve_mean\": False,\n",
" \"weight\": 1,\n",
" },\n",
" \"tofVoltage\": {\n",
" \"preserve_mean\": True,\n",
" \"weight\": -1,\n",
" },\n",
" },\n",
" },\n",
Expand Down Expand Up @@ -228,7 +230,7 @@
"axes = ['energy', 'delayStage']\n",
"ranges = [[-37.5,-27.5], [1446.75,1449.15]]\n",
"bins = [200,40]\n",
"res = sp_44498.compute(bins=bins, axes=axes, ranges=ranges)"
"res = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")"
]
},
{
Expand Down Expand Up @@ -394,7 +396,7 @@
"axes = ['energy', 'delayStage']\n",
"ranges = [[-37.5,-27.5], [-1.5,1.5]]\n",
"bins = [200,60]\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges)"
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")"
]
},
{
Expand Down Expand Up @@ -533,19 +535,11 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2e6e852",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "sed-processor-7Jy-bAA8-py3.9",
"display_name": "python3",
"language": "python",
"name": "python3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"outputs": [],
"source": [
"# pick the default configuration file for hextof@FLASH\n",
"config_file = Path('../config/flash_example_config.yaml')\n",
"config_file = Path('../sed/config/flash_example_config.yaml')\n",
"assert config_file.exists()"
]
},
Expand All @@ -113,8 +113,8 @@
" \"core\": {\n",
" \"beamtime_id\": 11019101,\n",
" \"paths\": {\n",
" \"raw\": path,\n",
" \"processed\": buffer_path\n",
" \"data_raw_dir\": path,\n",
" \"data_parquet_dir\": buffer_path\n",
" },\n",
" },\n",
"}"
Expand Down Expand Up @@ -175,6 +175,14 @@
"sp_44455.find_bias_peaks(ranges=ranges, ref_id=ref_id, apply=True)"
]
},
{
"cell_type": "markdown",
"id": "d3e4f30d",
"metadata": {},
"source": [
"We offset the reference energy by the different in bias voltages between this run and run 44498"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -183,12 +191,14 @@
"outputs": [],
"source": [
"sp_44455.calibrate_energy_axis(\n",
" ref_energy=-31.4,\n",
" ref_id=0,\n",
" ref_energy=-34.9,\n",
" method=\"lmfit\",\n",
" energy_scale='kinetic',\n",
" d={'value':1.0,'min': .7, 'max':1.0, 'vary':True},\n",
" t0={'value':5e-7, 'min': 1e-7, 'max': 1e-6, 'vary':True},\n",
" E0={'value': 0., 'min': -200, 'max': 100, 'vary': True},\n",
" verbose=True,\n",
")"
]
},
Expand All @@ -215,8 +225,7 @@
"id": "98266c62-ab48-4746-96c8-2d47cf92c0e9",
"metadata": {},
"source": [
"### Now we can use those parameters and load our trXPS data using the additional config file\n",
"To obtain a correct energy axis, we offset the energy axis by the difference of photon energy between this run and the energy calibration runs"
"### Now we can use those parameters and load our trXPS data using the additional config file"
]
},
{
Expand All @@ -229,13 +238,7 @@
"run_number = 44498\n",
"sp_44498 = SedProcessor(runs=[run_number], config=config_override, folder_config=\"reference_calib.yaml\", system_config=config_file, verbose=True)\n",
"sp_44498.add_jitter()\n",
"sp_44498.append_energy_axis()\n",
"sp_44498.add_energy_offset(\n",
" constant=1,\n",
" columns=['monochromatorPhotonEnergy','tofVoltage'],\n",
" weights=[-1,-1],\n",
" preserve_mean=[True, True],\n",
")"
"sp_44498.append_energy_axis()"
]
},
{
Expand Down Expand Up @@ -325,14 +328,14 @@
"axes = ['dldTimeSteps', 'delayStage']\n",
"ranges = [[3900,4200], [-1.5,1.5]]\n",
"bins = [100,60]\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges)\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")\n",
"\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(ax=ax[0], cmap='terrain')\n",
"res_corr.plot(robust=True, ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
"bg = res_corr.sel(delayStage=slice(-1.3,-1.0)).mean('delayStage')\n",
"(res_corr-bg).plot(ax=ax[1])\n",
"(res_corr-bg).plot(robust=True, ax=ax[1])\n",
"ax[1].set_title('difference')"
]
},
Expand Down Expand Up @@ -392,27 +395,29 @@
"outputs": [],
"source": [
"### Kinetic energy of w4f peaks and their SB\n",
"ref_energy = -30.2\n",
"ref_energy = -31.4\n",
"ref_id = 1\n",
"sp_44498.ec.biases = -1*np.array([-30.2,-31.4,-32.6,-33.6,-34.8])\n",
"sp_44498.ec.peaks = np.expand_dims(data[peaks]['dldTimeSteps'].data,1)\n",
"sp_44498.ec.tof = res_corr.dldTimeSteps.data\n",
"\n",
"sp_44498.calibrate_energy_axis(\n",
" ref_id=ref_id,\n",
" ref_energy=ref_energy,\n",
" method=\"lmfit\",\n",
" d={'value':1.0,'min': .8, 'max':1.0, 'vary':True},\n",
" t0={'value':5e-7, 'min': 1e-7, 'max': 1e-6, 'vary':True},\n",
" E0={'value': -100., 'min': -200, 'max': 15, 'vary': True},\n",
")"
" labels=\"\",\n",
" verbose=True)"
]
},
{
"cell_type": "markdown",
"id": "4052d629-1178-4248-a945-d60a6ff34bf3",
"metadata": {},
"source": [
"### Append energy axis into a data frame, bin and visualize data in the calibrated energy and corrected delay axis\n",
"To get a correct energy axis, we undo the shifts imposed by the calibration function"
"### Append energy axis into a data frame, bin and visualize data in the calibrated energy and corrected delay axis "
]
},
{
Expand All @@ -422,13 +427,7 @@
"metadata": {},
"outputs": [],
"source": [
"sp_44498.append_energy_axis()\n",
"sp_44498.add_energy_offset(\n",
" constant=30.2,\n",
" columns=['monochromatorPhotonEnergy','tofVoltage','sampleBias'],\n",
" weights=[-1,-1,-1],\n",
" preserve_mean=[True, True,False],\n",
")"
"sp_44498.append_energy_axis()"
]
},
{
Expand All @@ -441,14 +440,14 @@
"axes = ['energy', 'delayStage']\n",
"ranges = [[-37.5,-27.5], [-1.5,1.5]]\n",
"bins = [200,60]\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges)\n",
"res_corr = sp_44498.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")\n",
"\n",
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
"fig.suptitle(f\"Run {run_number}: W 4f, side bands\")\n",
"res_corr.plot(ax=ax[0], cmap='terrain')\n",
"res_corr.plot(robust=True, ax=ax[0], cmap='terrain')\n",
"ax[0].set_title('raw')\n",
"bg = res_corr.sel(delayStage=slice(-1.3,-1.0)).mean('delayStage')\n",
"(res_corr-bg).plot(ax=ax[1])\n",
"(res_corr-bg).plot(robust=True, ax=ax[1])\n",
"ax[1].set_title('difference')"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file:\n",
"sp = sed.SedProcessor(folder=scandir, config=\"../config/mpes_example_config.yaml\", system_config={}, verbose=True)"
"sp = sed.SedProcessor(folder=scandir, config=\"../sed/config/mpes_example_config.yaml\", verbose=True)"
]
},
{
Expand Down Expand Up @@ -466,9 +466,9 @@
"metadata": {},
"source": [
"#### 3. Step:\n",
"Next, the detected peak positions and bias voltages are used to determine the calibration function. Essentially, the functional Energy(TOF) is being determined by either least-squares fitting of the functional form d^2/(t-t0)^2 via lmfit (``method``: \"lmfit\"), or by analytically obtaining a polynomial approximation (``method``: \"lstsq\" or \"lsqr\"). The parameter ``ref_energy`` is used to define the absolute energy position of the feature used for calibration in the calibrated energy scale. ``energy_scale`` can be either \"kinetic\" (decreasing energy with increasing TOF), or \"binding\" (increasing energy with increasing TOF).\n",
"Next, the detected peak positions and bias voltages are used to determine the calibration function. This can be either done by fitting the functional form d^2/(t-t0)^2 via lmfit (\"lmfit\"), or using a polynomial approximation (\"lstsq\" or \"lsqr\"). Here, one can also define a reference id, and a reference energy. Those define the absolute energy position of the feature used for calibration in the \"reference\" trace, at the bias voltage where the final measurement has been performed. The energy scale can be either \"kinetic\" (decreasing energy with increasing TOF), or \"binding\" (increasing energy with increasing TOF).\n",
"\n",
"After calculating the calibration, all traces corrected with the calibration are plotted ontop of each other, and the calibration function (Energy(TOF)) together with the extracted features is being plotted."
"After calculating the calibration, all traces corrected with the calibration are plotted ontop of each other, the calibration function together with the extracted features is plotted."
]
},
{
Expand All @@ -478,17 +478,21 @@
"metadata": {},
"outputs": [],
"source": [
"# Eref can be used to set the absolute energy (kinetic energy, E-EF, etc.) of the feature used for energy calibration (if known)\n",
"Eref=-1.3\n",
"# use the refid of the bias that the measurement was taken at\n",
"# Eref can be used to set the absolute energy (kinetic energy, E-EF) of the feature used for energy calibration (if known)\n",
"refid=4\n",
"Eref=-0.5\n",
"# the lmfit method uses a fit of (d/(t-t0))**2 to determine the energy calibration\n",
"# limits and starting values for the fitting parameters can be provided as dictionaries\n",
"sp.calibrate_energy_axis(\n",
" ref_id=refid,\n",
" ref_energy=Eref,\n",
" method=\"lmfit\",\n",
" energy_scale='kinetic',\n",
" d={'value':1.0,'min': .7, 'max':1.2, 'vary':True},\n",
" t0={'value':8e-7, 'min': 1e-7, 'max': 1e-6, 'vary':True},\n",
" E0={'value': 0., 'min': -100, 'max': 0, 'vary': True},\n",
" verbose=True,\n",
")"
]
},
Expand Down Expand Up @@ -519,7 +523,7 @@
"metadata": {},
"source": [
"#### 4. Step:\n",
"Finally, the the energy axis is added to the dataframe. Here, the applied bias voltages of the measurement is taken into account to provide the correct energy offset. If the bias cannot be read from the file, it can be provided manually."
"Finally, the the energy axis is added to the dataframe."
]
},
{
Expand All @@ -529,7 +533,7 @@
"metadata": {},
"outputs": [],
"source": [
"sp.append_energy_axis(bias_voltage=16.8)"
"sp.append_energy_axis()"
]
},
{
Expand All @@ -542,16 +546,6 @@
"The delay axis is calculated from the ADC input column based on the provided delay range. ALternatively, the delay scan range can also be extracted from attributes inside a source file, if present."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1619cbc6",
"metadata": {},
"outputs": [],
"source": [
"sp.dataframe.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -657,6 +651,9 @@
}
],
"metadata": {
"interpreter": {
"hash": "728003ee06929e5fa5ff815d1b96bf487266025e4b7440930c6bf4536d02d243"
},
"kernelspec": {
"display_name": "python3",
"language": "python",
Expand All @@ -672,7 +669,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.8.12"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"outputs": [],
"source": [
"# create sed processor using the config file, and collect the meta data from the files:\n",
"sp = sed.SedProcessor(folder=scandir, config=\"../config/mpes_example_config.yaml\", system_config={}, metadata=metadata, collect_metadata=True)"
"sp = sed.SedProcessor(folder=scandir, config=\"../sed/config/mpes_example_config.yaml\", metadata=metadata, collect_metadata=True)"
]
},
{
Expand Down Expand Up @@ -220,7 +220,7 @@
"outputs": [],
"source": [
"# Apply stored config energy calibration\n",
"sp.append_energy_axis(bias_voltage=16.8)"
"sp.append_energy_axis()"
]
},
{
Expand Down Expand Up @@ -290,6 +290,9 @@
}
],
"metadata": {
"interpreter": {
"hash": "728003ee06929e5fa5ff815d1b96bf487266025e4b7440930c6bf4536d02d243"
},
"kernelspec": {
"display_name": "python3",
"language": "python",
Expand All @@ -305,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.8.12"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 0b26863

Please sign in to comment.