n3fit.tests package

Subpackages

Submodules

n3fit.tests.conftest module

n3fit.tests.test_backend module

This module tests the mathematical functions in the n3fit backend and ensures they do the same thing as their numpy counterparts

n3fit.tests.test_backend.are_equal(result, reference, threshold=1e-06)[source]

checks the difference between array reference and tensor result is below threshold for all elements

n3fit.tests.test_backend.numpy_check(backend_op, python_op, mode='same')[source]

Receives a backend operation (backend_op) and a python operation python_op and asserts that, applied to two random arrays, the result is the same. The option mode selects the two arrays to be tested and accepts the following options:

  • same (default): two arrays of the same dimensionality

  • diff: first array has one extra dimension that second array

  • single: only one array enters the operation

  • (tensor, array): if passed a tuple (backend tensor, numpy array), uses these

    values as tensor and array inputs for the operations

n3fit.tests.test_backend.test_c_to_py_fun()[source]
n3fit.tests.test_backend.test_flatten()[source]
n3fit.tests.test_backend.test_op_log()[source]
n3fit.tests.test_backend.test_op_multiply()[source]
n3fit.tests.test_backend.test_sum()[source]
n3fit.tests.test_backend.test_tensor_product()[source]

n3fit.tests.test_checks module

n3fit.tests.test_evolven3fit module

n3fit.tests.test_fit module

n3fit.tests.test_hyperopt module

n3fit.tests.test_layers module

Tests for the layers of n3fit This module checks that the layers do what they would do with numpy

class n3fit.tests.test_layers.FakePhoton[source]

Bases: object

n3fit.tests.test_layers.generate_DIS(nfk=1)[source]
n3fit.tests.test_layers.generate_had(nfk=1)[source]
n3fit.tests.test_layers.generate_input_DIS(flavs=3, xsize=2, ndata=5, n_combinations=-1)[source]

Generates fake input (fktable and array of combinations) for the DIS convolution

Parameters
  • flavs (int) – number of flavours to consider

  • xsize (int) – size of the grid on x

  • ndata (int) – number of experimental datapoints

  • n_combinations (int) – number of combinations of flavours to take into account default: flavs (all)

n3fit.tests.test_layers.generate_input_had(flavs=3, xsize=2, ndata=4, n_combinations=None)[source]

Generates fake input (fktable and array of combinations) for the hadronic convolution

Parameters
  • flavs (int) – number of flavours to consider

  • xsize (int) – size of the grid on x

  • ndata (int) – number of experimental datapoints

  • n_combinations (int) – number of combinations of flavours to take into account default: flavs*flavs (all)

n3fit.tests.test_layers.test_DIS()[source]
n3fit.tests.test_layers.test_DIS_basis()[source]
n3fit.tests.test_layers.test_DY()[source]
n3fit.tests.test_layers.test_DY_basis()[source]
n3fit.tests.test_layers.test_addphoton_init()[source]

Test AddPhoton class.

n3fit.tests.test_layers.test_computation_bc()[source]

Test the computation of the boundary conditions.

n3fit.tests.test_layers.test_compute_photon()[source]
n3fit.tests.test_layers.test_mask()[source]

Test the mask layer

n3fit.tests.test_layers.test_rotation_evol()[source]
n3fit.tests.test_layers.test_rotation_flavour()[source]

n3fit.tests.test_losses module

Test the losses layers

n3fit.tests.test_losses.test_l_invcovmat()[source]
n3fit.tests.test_losses.test_l_positivity()[source]

n3fit.tests.test_modelgen module

n3fit.tests.test_msr module

n3fit.tests.test_multireplica module

n3fit.tests.test_multireplica.test_multimodel(seed=42, xlen=5)[source]

Check that we can run different models, with different settings, in one go.

This tests runs 3 replicas with 1, 2, and 3 layers respectively.

n3fit.tests.test_multireplica.test_replica_split()[source]

Check that multi replica pdf and concatenated single output pdfs agree

n3fit.tests.test_penalties module

Test the penalties for n3fit hyperopt

n3fit.tests.test_penalties.test_integrability_numbers()[source]

Check that the integrability penalty runs and returns a float

n3fit.tests.test_penalties.test_patience()[source]

Check that the patience penalty runs and returns a float

n3fit.tests.test_penalties.test_saturation()[source]

Check that the saturation penalty runs and returns a float

n3fit.tests.test_preprocessing module

n3fit.tests.test_preprocessing.setup_layer(replica_seeds)[source]

Setup a layer for testing

n3fit.tests.test_preprocessing.test_constraint()[source]

Test the constraint

n3fit.tests.test_preprocessing.test_preprocessing()[source]

Regression test

n3fit.tests.test_rotations module

n3fit.tests.test_rotations.test_fk()[source]

n3fit.tests.test_stopwatch module

Tests the stopwatch does what is supposed to do

n3fit.tests.test_stopwatch.test_register_ref()[source]
n3fit.tests.test_stopwatch.test_register_times()[source]
n3fit.tests.test_stopwatch.time_comparer(internal_dict, computed_dict, base_time)[source]

n3fit.tests.test_vpinterface module

n3fit.tests.test_xops module

Test the x operations

n3fit.tests.test_xops.test_xdivide_default()[source]

Check that the default xDivide works as expected

n3fit.tests.test_xops.test_xdivide_indices()[source]

Check that xDivide with custom indices works as expected

n3fit.tests.test_xops.test_xintegrator()[source]

Module contents