Skip to content

Commit

Permalink
add description for fit limits to energy calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Mar 22, 2024
1 parent cd94d7d commit fd90984
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sed/calibrator/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def calibrate(
binning = kwds.pop("binning", self.binning)

if method == "lmfit":
self.calibration = fit_energy_calibation(
self.calibration = fit_energy_calibration(
landmarks,
sign * biases,
binwidth,
Expand Down Expand Up @@ -2085,7 +2085,7 @@ def peakdetect1d(
return (np.asarray(max_peaks), np.asarray(min_peaks))


def fit_energy_calibation(
def fit_energy_calibration(
pos: Union[List[float], np.ndarray],
vals: Union[List[float], np.ndarray],
binwidth: float,
Expand Down
2 changes: 0 additions & 2 deletions sed/calibrator/momentum.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import Any
from typing import Dict
from typing import List
from typing import Sequence
from typing import Tuple
from typing import Union

Expand Down Expand Up @@ -399,7 +398,6 @@ def feature_extract(
direction: str = "ccw",
feature_type: str = "points",
rotsym: int = 6,
ascale: Union[float, np.ndarray] = None,
symscores: bool = True,
**kwds,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"# The Scan directory\n",
"fdir = data_path + '/Scan049_1'\n",
"# create sed processor using the config file:\n",
"sp = sed.SedProcessor(folder=fdir, config=\"../sed/config/mpes_example_config.yaml\")"
"sp = sed.SedProcessor(folder=fdir, config=\"../sed/config/mpes_example_config.yaml\", verbose=True)"
]
},
{
Expand Down Expand Up @@ -463,7 +463,7 @@
"metadata": {},
"source": [
"#### 3. Step:\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 approxiamtion (\"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 \"kientic\" (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 approxiamtion (\"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, the calibration function together with the extracted features is plotted."
]
Expand All @@ -480,7 +480,17 @@
"refid=4\n",
"Eref=-0.5\n",
"# the lmfit method uses a fit of (d/(t-t0))**2 to determine the energy calibration\n",
"sp.calibrate_energy_axis(ref_energy=Eref, ref_id=refid, energy_scale=\"kinetic\", method=\"lmfit\")"
"# 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

0 comments on commit fd90984

Please sign in to comment.