umami.tests.unit.preprocessing package#
Submodules#
umami.tests.unit.preprocessing.test_preprocessing module#
Unit test if preprocessing.
- class umami.tests.unit.preprocessing.test_preprocessing.PreprocessingTestGetScaleDict(methodName='runTest')#
Bases:
TestCase
Test the implementation of the GetScaleDict function.
- config_file = '/builds/atlas-flavor-tagging-tools/algorithms/umami/umami/tests/unit/preprocessing/test_preprocess_config.yaml'#
- setUp()#
Hook method for setting up the test fixture before exercising it.
- class umami.tests.unit.preprocessing.test_preprocessing.PreprocessingTestParser(methodName='runTest')#
Bases:
TestCase
Test the implementation of the Prerocessing command line parser.
- config_file = '/builds/atlas-flavor-tagging-tools/algorithms/umami/umami/tests/unit/preprocessing/test_preprocess_config.yaml'#
- setUp()#
Hook method for setting up the test fixture before exercising it.
- test_parser(mock_args)#
Test parser
- Parameters:
mock_args (mock_args) – passed arguments from command line via mock
umami.tests.unit.preprocessing.test_preprocessing_tools module#
Unit tests for preprocessing_tools.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.BinariseJetLabelsTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the binarise_jet_labels function.
- setUp()#
Create a default dataset for testing.
- test_2_classes_correct_output()#
Testing correct behaviour.
- test_correct_output()#
Testing correct behaviour.
- test_missing_internal_label()#
Test wrong input type case.
- test_shape_2_classes()#
Test 2 classes
- test_shape_array()#
Test shape for array input.
- test_shape_data_frame()#
Test shape for DataFrame input.
- test_wrong_type()#
Test wrong input type case.
- test_zero_length()#
Test zero case.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.CreateSamplesTestCase(methodName='runTest')#
Bases:
TestCase
Testing the creation of the samples for the preprocessing config.
- setUp() None #
Setting up needed paths.
- test_create_samples_dict()#
Test nominal behaviour.
- Raises:
AssertionError – If the process returns an error.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.GetDictTestCase(methodName='runTest')#
Bases:
TestCase
Testing the get_scale_dict and the get_variable_dict functions.
- setUp() None #
Setting up needed paths.
- test_get_scale_dict()#
Testing default behaviour of get_scale_dict.
- test_get_variable_dict()#
Testing default behaviour of get_variable_dict.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.GetVariableDictTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of GetVariableDict function.
- setUp()#
Hook method for setting up the test fixture before exercising it.
- test_defaults_vars()#
Test defaults variables.
- test_label_reading()#
Test label reading.
- test_nested_structure()#
Test nested structure.
- test_train_variables()#
Test train variables.
- test_trk_train_variables()#
Test track training variables.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.PrepareSamplesTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the PrepareSamples class.
- class CArgs#
Bases:
object
Helper class replacing command line arguments.
- setUp()#
Hook method for setting up the test fixture before exercising it.
- test_get_batches_per_file()#
Test batches per file.
- test_jets_generator_fullcuts()#
Test jet generator including tracks with full cuts.
- test_jets_generator_fullcuts_wotracks()#
Test jet generator without tracks.
- test_jets_generator_lightcut()#
Test jet generator including tracks with cut on light jets.
- test_no_sample_provided()#
Test no provided sample.
- test_run()#
Test the run function.
- test_wrong_category_provided()#
Test wrong category provided.
- test_wrong_sample_provided()#
Test wrong sample provided.
- class umami.tests.unit.preprocessing.test_preprocessing_tools.TTbarMergeTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the TTbarMerge class
- classmethod setUpClass()#
Hook method for setting up class fixture before running tests in the class.
- classmethod tearDownClass()#
Hook method for deconstructing the class fixture after running all tests in the class.
- test_event_indices()#
Test event_indices function.
- test_event_list()#
Test event_list function.
- test_get_indices()#
Test get_indices function.
- test_get_input_files()#
Test get_input_files function.
- test_load_events_generator()#
Test load_events_generator function.
umami.tests.unit.preprocessing.test_preprocessing_tools_configuration module#
Unit tests for configuration of preprocessing_tools.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_configuration.PreparationTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the Preparation class.
- setUp() None #
Hook method for setting up the test fixture before exercising it.
- test_default_batch_size()#
Testing if batch size is correctly initialised if none is given.
- test_double_output_name()#
Testing if wrong sample name is given to raise KeyError.
- test_failed_get_sample()#
Testing if wrong sample name is given to raise KeyError.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_configuration.PreprocessConfigurationTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the Configuration class.
- setUp()#
Set a example config file.
- test_genera_settings_class_plot_options_as_dict()#
Test return of all class attributes as dict.
- test_general_settings_class_as_dict()#
Test return of all class attributes as dict.
- test_get_file_name_no_input()#
Test filename without input.
- test_get_file_name_no_iterations()#
Test no iterations
- test_get_file_name_no_iterations_no_input()#
Test no iterations and no input.
- test_missing_key_error()#
Test missing key error.
- test_sampling_class_as_dict()#
Test return of all class attributes as dict.
- test_sampling_options_class_as_dict()#
Test return of all class attributes as dict.
umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5 module#
Unit tests for merge_large_h5 in preprocessing tools.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5.AddDataTestCase(methodName='runTest')#
Bases:
TestCase
Test the add_data function.
- setUp()#
Create a default dataset for testing.
- test_add_data()#
Test adding data.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5.CheckKeysTestCase(methodName='runTest')#
Bases:
TestCase
Test the check_keys function.
- setUp()#
Create default datasets for testing.
- test_different_keys_case()#
Test scenario with different keys.
- test_equal_keys_case()#
Test scenario if equal keys.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5.CheckShapesTestCase(methodName='runTest')#
Bases:
TestCase
Test the check_shapes function.
- setUp()#
Create default datasets for testing.
- test_different_keys_case()#
Test scenario with different keys.
- test_equal_keys_case()#
Test equal key case.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5.CheckSizeTestCase(methodName='runTest')#
Bases:
TestCase
Test the check_size function.
- setUp()#
Create a default dataset for testing.
- test_different_size_case()#
Test different dataset sizes.
- test_equal_size_case()#
Test equal size.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_merge_large_h5.CreateDatasetsTestCase(methodName='runTest')#
Bases:
TestCase
Test the create_datasets function.
- setUp()#
Create a default dataset for testing.
- test_create_from_dataset()#
Test creation from dataset.
- test_create_from_dict()#
Test creation from dictionary.
umami.tests.unit.preprocessing.test_preprocessing_tools_resampling module#
Unit tests for Resampling in the preprocessing tools.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.CalculateBinningTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the CalculateBinning function.
- static test_nested_list_case()#
Test nested lists.
- test_non_list_case()#
Test no list case.
- static test_single_list_case()#
Test single list case.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.CorrectFractionsTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the CorrectFractions function.
- test_different_input_length_class_names()#
Test different input length class names.
- test_different_input_lengths()#
Test different input lengths.
- test_input_correct_fractions()#
Test input correct fractions.
- test_not_fraction_sum_one()#
Test not fraction sum one.
- test_scaling_down_largest()#
Test scaling down largest.
- test_scaling_down_small()#
Test scaling down small.
- test_twice_same_fractions()#
Test twice same fractions.
- test_zero_length()#
Tests zero length.
- test_zero_n_jets()#
Test zero n_jets.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.PDFResamplingTestCase(methodName='runTest')#
Bases:
ResamplingTestCaseComplexDistr
Test the run method. and ensure the deterministic sampling for a seed. Most of the major code changes would brake this test.
- setUp()#
Create a default dataset for testing.
- test_no_samples_defined()#
Test no samples defined.
- test_run()#
Test equal fractions.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.ResamplingTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the Resampling base class.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.ResamplingTestCaseComplexDistr(methodName='runTest')#
Bases:
TestCase
Class that handle creation of a somewhat coplex dataset of test data useful to be inherited by other test classes
- generate_test_data()#
Generates a relatively complex dataset of test data
- setUp()#
Create a default dataset for testing.
- tearDown()#
Delete the workspace folder after the test.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.ResamplingTestCaseEasyDistr(methodName='runTest')#
Bases:
TestCase
Class that handle creation of a somewhat simple dataset of test data useful to be inherited by other test classes
- generate_test_data()#
Generates a relatively simple dataset of test data
- setUp()#
Create a default dataset for testing.
- tearDown()#
Delete the workspace folder after the test.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.SamplingGeneratorTestCase(methodName='runTest')#
Bases:
TestCase
Test the implementation of the SamplingGenerator function.
- setUp() None #
Hook method for setting up the test fixture before exercising it.
- test_duplicate_error()#
Test duplicate TypeError.
- test_no_duplicate()#
Testing with tracks yield with no duplicates.
- test_no_duplicate_no_tracks()#
Testing no tracks yield with no duplicates.
- test_no_tracks()#
Testing no tracks yield
- test_tracks()#
Testing with tracks yield
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.UnderSamplingNoReplaceTestCase(methodName='runTest')#
Bases:
ResamplingTestCaseComplexDistr
Test the implementation of the UnderSamplingNoReplace class.
- setUp()#
Create a default dataset for testing.
- test_different_samples_per_category()#
Test different samples per category.
- test_equal_fractions()#
Test equal fractions.
- test_no_samples_defined()#
Test no samples defined.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.UnderSamplingTestCase(methodName='runTest')#
Bases:
ResamplingTestCaseComplexDistr
Test the implementation of the UnderSampling class.
- test_count_no_samples_defined()#
Test no samples defined.
- test_different_samples_per_category()#
Test different samples per category.
- test_equal_length_smalln()#
Test equal fractions.
- test_run()#
Test the run method. and ensure the deterministic sampling for a seed. Most of the major code changes would brake this test.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_resampling.UnderSamplingTestCaseEasyDistr(methodName='runTest')#
Bases:
ResamplingTestCaseEasyDistr
Test the implementation of the UnderSampling class, using a simple example.
- test_equal_length()#
Test equal fractions.
umami.tests.unit.preprocessing.test_preprocessing_tools_scaling module#
Unit test for preprocessing tools Scaling.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_scaling.ApplyScalingJetsTestCase(methodName='runTest')#
Bases:
TestCase
Test class for apply_scaling_jets function.
- setUp() None #
Hook method for setting up the test fixture before exercising it.
- test_key_error_scale_dict()#
Test error raise if variable not in scale dict.
- test_scaling_jets()#
Testing the default behaviour.
- test_scaling_structured_array_jets()#
Testing default behaviour for structured numpy array.
- test_value_error_scale_value()#
Test error raise if variable not in scale dict.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_scaling.ApplyScalingTrksTestCase(methodName='runTest')#
Bases:
TestCase
Test class for apply_scaling_trks function.
- setUp()#
Hook method for setting up the test fixture before exercising it.
- test_apply_scaling_trks()#
Test apply scaling fot tracks.
- class umami.tests.unit.preprocessing.test_preprocessing_tools_scaling.ScalingTestCase(methodName='runTest')#
Bases:
TestCase
Unit test the functions inside the Scaling class.
- setUp()#
Hook method for setting up the test fixture before exercising it.
- test_get_scaling()#
Test retrieving scaling.
- test_get_scaling_tracks()#
Test scaling of tracks.
- test_join_scale_dicts()#
Test joining scale dicts of jets.
- test_join_scale_dicts_trks()#
Test joining of track scale dicts.