mjolnir.calibration#
This module defines classes that handle calibration of parameters.
Classes
|
Learns the values of noisy functions at given points. |
|
Base class for calibration handlers. |
|
Calibration handler for the CCD. |
|
Handles calibration of a variable neutral density filter. |
|
Calibration handler for the ND filter. |
|
Calibration handler for the excitation rejection feedback. |
- class mjolnir.calibration.AverageSequenceLearner1D(function, sequence, min_samples=50, max_samples=9223372036854775807, min_error=0)[source]#
Bases:
AverageLearner1DLearns the values of noisy functions at given points.
- Parameters:
- class mjolnir.calibration.CalibrationHandler(logical_station)[source]#
Bases:
ABC,_HandlerBase class for calibration handlers.
- Parameters:
logical_station (Station)
- class mjolnir.calibration.CcdCalibrationHandler(logical_station, exposure_time=0.1, number_accumulations=2, n_pts=9, folder='C:/Data/Triton/calibration/ccd')[source]#
Bases:
CcdCalibrationHandler,CcdCalibrationHandler,CalibrationHandler,ABC,_Handler,objectCalibration handler for the CCD.
- Parameters:
exposure_time (float) – The duration of exposure for CCD data.
number_accumulations (int) – The number of accumulations to perform for each CCD data.
n_pts (int) – The number of calibration points (wavelenghts).
folder (str | pathlib.Path) – The folder where to store calibration data.
logical_station (Station)
- property folder#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- class mjolnir.calibration.PowerCalibration(wavelength, timestamp, angle, power, error, log=False)[source]#
Bases:
objectHandles calibration of a variable neutral density filter.
- Parameters:
wavelength (float) – The laser wavelength
timestamp (float) – The timestamp of the calibration.
angle (numpy.ndarray[tuple[Any, ...], numpy.dtype[float]]) – The
numpy.ndarrayof angle samples.power (numpy.ndarray[tuple[Any, ...], numpy.dtype[float]]) – The
numpy.ndarrayof power samples.error (numpy.ndarray[tuple[Any, ...], numpy.dtype[float]]) – The
numpy.ndarrayof errors of each sample.log (bool) – Log-spaced samples.
- property angle_to_power#
- property angle_to_power_deriv#
The calibration function’s derivative.
- property power_to_angle#
The inverted calibration function.
- rescaled(wavelength, angle_callback, power_callback, target_power=None, target_angle=None, n_samples=50)[source]#
The calibration function rescaled by a global factor.
- Parameters:
wavelength (float) – The wavelength at which to rescale.
angle_callback (Parameter) – The callback to set and get the angle.
power_callback (Parameter) – The callback to get the power.
target_power (float | None) – The power to reach at a given angle. Takes precedence over target_angle.
target_angle (float | None) – The angle at which to rescale for the given wavelength.
n_samples (int) – The number of power samples to average over.
- class mjolnir.calibration.PowerCalibrationHandler(logical_station, sampling=None, loss=0.1, dtheta=0.5, duration=300.0, min_samples=25, nsamples=None, npoints=None, ntasks=1, wait=0.0, folder='C:/Data/Triton/calibration/nd_filter', learner_kwargs=<factory>)[source]#
Bases:
PowerCalibrationHandler,PowerCalibrationHandler,CalibrationHandler,ABC,_Handler,objectCalibration handler for the ND filter.
- Parameters:
sampling (Literal['sequential', 'adaptive'] | None) – Use a naive sequential or adaptive sampling. Defaults to the value of
power_calibration_strategy.loss (float | None) – The maximum sampling loss. If None, it is not used for the goal.
dtheta (float | None) – The maximum spacing between adjacent sample points. Ignored if npoints is given or sampling is ‘adaptive’.
duration (float | None) – The maximum duration.
min_samples (int | None) – The minimum number of samples taken for each average. If None, it is not used for the goal.
nsamples (int | None) – The minimum number of total samples. If None, it is not used for the goal.
npoints (int | None) – The minimum number of points to be sampled. If None, it is not used for the goal.
ntasks (int) – The number of points the executor visits per batch.
wait (float) – Sleep for this amount of time before taking a power measurement.
folder (str | pathlib.Path) – The folder to save learners in.
learner_kwargs (dict) – Additional kwargs for the adaptive learner.
logical_station (Station)
- property folder#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- class mjolnir.calibration.RejectionFeedbackHandler(logical_station, slit_width=1000, fs=14.0, t_avg_max=15, alpha=0.05, redfactor=3.0, deltainit=0.1, deltatol=0.01, feps=10, mask=(False, True, True))[source]#
Bases:
_HandlerCalibration handler for the excitation rejection feedback.
- Parameters:
slit_width (float) – The spectrometer exit slit width.
fs (float) – The Time Tagger digitization rate.
t_avg_max (float) – Maximum averaging duration.
alpha (float) – Relative error to achieve when sampling.
redfactor (float) – Optimization parameter.
deltatol (float) – Optimization parameter.
deltainit (float) – Optimization parameter.
feps (float) – Optimization parameter.
mask (tuple[int, int, int]) – A boolean mask defining the rotator axes to optimize.
logical_station (Station)