ariane.app.tas.server

class ariane.app.tas.server.TASServer(*, version, method, config, random_seed=None, port=11657)[source]

Base class for servers in TAS application.

It implements processing actions with corresponding data and accordingly calls template methods of derived classes.

abstract property method_initializable

Indicate if the method can be initialized.

Returns

method_initializable : bool

abstract property method_initialized

Indicate if the method is initialized.

Returns

method_initialized : bool

abstract property param_optim_stopped

Indicate if optimization of kernel hyperparameters is stopped.

Returns

param_optim_stopped : bool

process(action: str, data: dict)[source]

Process action with corresponding data and accordingly call template methods of derived classes.

abstract save_state(id=None)[source]

Save the current state of the server to a file. If id is not None, it is included in the filename.

class ariane.app.tas.server._server_gpr.server.GPRTASServer(gpr_acq, *, config, random_seed=None, port=11657)[source]

Class implementing template methods from TASServer based on log-Gaussian processes.

property method_initializable

Indicate if the method can be initialized.

Returns

method_initializable : bool

property method_initialized

Indicate if the method is initialized.

Returns

method_initialized : bool

property param_optim_stopped

Indicate if optimization of kernel hyperparameters is stopped.

Returns

param_optim_stopped : bool

save_state(id=None)[source]

Save the current state of the server to a file. If id is not None, it is included in the filename.

ariane.app.tas.server._server_gpr.server.compute_heuris_experi_param(intens, level_backgr_diffs_rel_max, level_backgr_diffs_abs_min, level_backgr_decile_max, thresh_intens_fact, level_backgr=None)[source]

Compute heuristic for experimental parameters like the background level and intensity threshold with intensities in intens.

ariane.app.tas.server._server_gpr.server.maximize_obj_fct(obj_fct, limits, *, random_state=None)[source]
ariane.app.tas.server._server_gpr.server.difference_hyperparameters(param1, param2)[source]

Compute the difference of two arrays of kernel hyperparameters.

Parameters

param1, param2array_like

Both arrays have to be of the same length.

Returns

difference_hyperparameters : float

ariane.app.tas.server._server_gpr.server.criterion_kernel_optims_stop(num_kernel_optims, num_kernel_optims_min, num_kernel_optims_max, diffs_kernel, kernel_optims_stop_num_last, kernel_optims_stop_eps)[source]

Boolean criterion for stopping optimization of kernel hyperparameters.

If True, the optimization is supposed to be stopped for performance reasons.

ariane.app.tas.server._server_gpr.server.normalize_det_cts(det_cts, mon_cts, mon_cts0)[source]

Normalize detector counts to reference value mon_cts0.

ariane.app.tas.server._server_gpr.server.process_det_cts_to_training_data(det_cts, mon_cts, mon_cts0, level_backgr, thresh_intens)[source]

Process detector counts before using it for training.

Normalize detector counts by monitor counts with a reference value and adjust them by truncating to a intensity threshold and subtracting a background level.

Parameters

det_ctsarray_like

Detector counts.

mon_ctsarray_like

Monitor counts.

mon_cts0float

Reference value for monitor counts.

level_backgrfloat

Background level.

thresh_intensfloat

Intensity threshold.

Returns

intens_trainndarray of float

Intensities for training

error_trainndarray of float

Errors (noise) for training. The array has the same length as intens_train.

ariane.app.tas.server._server_gpr.server.run(*, config=None, random_seed=None, port=None)[source]
class ariane.app.tas.server._server_gpr.gpr.TASGaussianProcessRegressorBase(limits)[source]

Base class for TAS-related Gaussian process regressors.

class ariane.app.tas.server._server_gpr.gpr.TASLogGaussianProcessRegressor(*, limits, kernel_num_restarts_optim, kernel_bounds_variance, kernel_bounds_length_scales, random_state=None)[source]

Class for TAS-related log-Gaussian process regressors.

class ariane.app.tas.server._server_gpr.gpr.PotentialRotationDecorator(tas_gpr: TASGaussianProcessRegressorBase, rotation_matrix, length_scales_min_fact=0.001, length_scales_max_fact=1.0)[source]

Decorator class for TAS-related Gaussian process regressors.

It rotates the coordinate system if a criterion involving length scales of the Gaussian process is fulfilled.

add_data(x_new, y_new, noise)[source]

Add new data y_new measured at training locations x_new to the Gaussian process and update the posterior distribution. noise is again the standard deviation of the noise.

Parameters

x_newarray_like

2-D array with new training locations.

y_newarray_like

1-D array with new training data observed at x_new. The length has to be the same as with x_new.

fit(x, y, noise)[source]

Fit the Gaussian process to data y observed at training locations x with noise standard deviations noise.

Parameters

xarray_like

2-D array with training locations.

yarray_like

1-D array with training data observed at x. The length has to be the same as with x.

noisefloat or array_like

Standard deviations of observational noise. If array_like, the length has to be the same as with y.

property kernel

Kernel optimized using training data.

Returns

kernel : instance of a kernel class (depending on the underlying GPR implementation)

property kernel_hyperparameters

Hyperparameters of kernel.

Returns

kernel_hyperparameters : ndarray of float

property kernel_length_scales

Length scales of kernel.

Returns

kernel_length_scales : ndarray of float

property noise

Standard deviations of observational noise.

Returns

noise : ndarray of float

stop_optimization()[source]

Stop the optimization of kernel hyperparameters. The current kernel is now fixed.

property x_train

Training locations used.

Returns

x_train : ndarray of float

property y_train

Training data used.

Returns

y_train : ndarray of float