tests package

Subpackages

Submodules

tests.test_contextual_images module

class TestContextualImages[source]

Bases: object

CUSTOM_CONFIG_PATH: str = 'tests/resources/configs/contextual-images.yml'
INVALID_IMAGE_PATH: str = '/home/max/xrf-explorer/documentation/sphinx/tests/resources/contextual_images/painting/invalid.png'
NONEXISTENT_IMAGE_PATH: str = '/home/max/xrf-explorer/documentation/sphinx/tests/resources/contextual_images/painting/nonexistent.png'
RESOURCES_PATH: str = 'tests/resources'
TEST_IMAGE_PATH: str = '/home/max/xrf-explorer/documentation/sphinx/tests/resources/contextual_images/painting/test.png'
TEST_RECIPE_PATH: str = '/home/max/xrf-explorer/documentation/sphinx/tests/resources/contextual_images/painting/recipe.csv'
test_get_contextual_image_image()[source]
test_get_contextual_image_image_invalid(caplog)[source]
test_get_contextual_image_image_nonexistent(caplog)[source]
test_get_contextual_image_invalid_size()[source]
test_get_contextual_image_nonexistent_size()[source]
test_get_contextual_image_path_base(caplog)[source]
test_get_contextual_image_path_contextual(caplog)[source]
test_get_contextual_image_path_invalid_config(caplog)[source]
test_get_contextual_image_path_invalid_painting(caplog)[source]
test_get_contextual_image_path_nonexistent(caplog)[source]
test_get_contextual_image_recipe_path_base(caplog)[source]
test_get_contextual_image_recipe_path_contextual(caplog)[source]
test_get_contextual_image_recipe_path_nonexistent(caplog)[source]
test_get_contextual_image_size()[source]
test_get_path_to_base_image()[source]

tests.test_dim_reduction module

class TestDimReduction[source]

Bases: object

CUSTOM_CONFIG_PATH: str = 'tests/resources/configs/dim-reduction.yml'
CUSTOM_CONFIG_PATH_EMBEDDING_PRESENT: str = 'tests/resources/configs/dim-reduction-embedding-present.yml'
CUSTOM_CONFIG_PATH_NO_EMBEDDING: str = 'tests/resources/configs/dim-reduction-no-embedding.yml'
NO_CUBE_DATA_SOURCE: str = 'no_cube_data_source'
PATH_GENERATED_FOLDER: str = 'tests/resources/dim_reduction/test_data_source/generated/from_dim_reduction'
PATH_TEST_CUBE: str = 'tests/resources/dim_reduction/test_data_source/test_cube.dms'
TEST_DATA_SOURCE: str = 'test_data_source'
do_test_embedding(caplog, threshold: int = 100, expected_result: str = 'success')[source]
do_test_invalid_embedding_image(caplog, overlay_type: str, expected_caplog: str = '', folder_name: str = 'embedding_present', config: str = 'tests/resources/configs/dim-reduction-embedding-present.yml')[source]
do_test_valid_image(caplog, overlay_type: str)[source]
test_config_not_found(caplog)[source]
test_high_threshold(caplog)[source]
test_invalid_contextual_image_type(caplog)[source]
test_invalid_create_image_of_indices_invalid_data_source()[source]
test_invalid_create_image_of_indices_no_cube()[source]
test_invalid_create_image_of_indices_no_files()[source]
test_invalid_element_creating_image(caplog)[source]
test_invalid_element_generating(caplog)[source]
test_invalid_getting_image_of_indices_invalid_data_source()[source]
test_invalid_getting_image_of_indices_no_image(caplog)[source]
test_invalid_image_type(caplog)[source]
test_invalid_umap(caplog)[source]
test_nan_embedding(caplog)[source]
test_no_cube_for_embedding(caplog)[source]
test_no_embedding(caplog)[source]
test_valid_contextual_image(caplog)[source]
test_valid_create_embedding_image(caplog)[source]
test_valid_elemental_image(caplog)[source]
test_valid_embedding(caplog)[source]
test_valid_embedding_downsampled(caplog)[source]

tests.test_image_registration module

class TestImageRegistration[source]

Bases: object

CONFIG_PATH: str = 'tests/resources/configs/image-registration.yml'
DATA_SOURCE: str = 'data_source'
IMAGE_NAME: str = 'RGB'
PATH_CONTROL_POINTS: str = 'tests/resources/image_registration/data_source/control_points.csv'
PATH_CUBE: str = 'tests/resources/image_registration/data_source/cube.dms'
PATH_IMAGE_REFERENCE: str = 'tests/resources/image_registration/data_source/image.png'
PATH_IMAGE_REGISTER: str = 'tests/resources/image_registration/data_source/image.png'
PATH_RESULT: str = 'tests/resources/image_registration/result.tif'
setup_environment()[source]
test_register_image_to_cube_data_cube_not_found(caplog)[source]
test_register_image_to_cube_image_register_not_found(caplog)[source]
test_register_image_to_cube_success(caplog)[source]
test_register_image_to_image_csv_not_found(caplog)[source]
test_register_image_to_image_destination_not_found(caplog)[source]
test_register_image_to_image_reference_not_found(caplog)[source]
test_register_image_to_image_register_not_found(caplog)[source]
test_register_image_to_image_success(caplog)[source]

tests.test_image_to_cube_selection module

class TestImageToCubeSelection[source]

Bases: object

CUSTOM_CONFIG_PATH: str = 'tests/resources/configs/image_to_cube_selection.yml'
DATA_SOURCE_FOLDER_NAME: str = 'Data_source'
SAMPLE_BASE_IMAGE_PATH: str = 'tests/resources/image_to_cube_selection/rgb.tif'
SAMPLE_CUBE_IMG_PATH: str = 'tests/resources/image_to_cube_selection/cube.tif'
SAMPLE_CUBE_RECIPE_PATH: str = 'tests/resources/image_to_cube_selection/recipe_cube.csv'
WORKSPACE_BASE_IMAGE_PATH: str = 'tests/resources/image_to_cube_selection/data/Data_source/image.png'
is_deregistration_correct(base_img_coord: tuple[int, int], cube_coord_expected: tuple[int, int], tolerance_pixels: int) bool[source]
setup_environment()[source]
test_deregister_coord()[source]
test_get_cube_coordinates()[source]
test_get_selected_data_cube_dir_found()[source]
test_get_selected_data_cube_dir_not_found(caplog)[source]
test_get_selected_data_cube_invalid_cubetype(caplog)[source]
test_get_selected_data_cube_invalid_polygon(caplog)[source]
test_get_selected_data_cube_invalid_rectangle(caplog)[source]
test_get_selected_data_cube_output_size()[source]
test_negative_coordinates()[source]
test_ribbon_selection()[source]
test_selection_raw_cube()[source]
test_selections_equivalent()[source]
imread(filename[, flags]) retval

. @brief Loads an image from a file. . . @anchor imread . . The function imread loads an image from the specified file and returns it. If the image cannot be . read (because of missing file, improper permissions, unsupported or invalid format), the function . returns an empty matrix ( Mat::data==NULL ). . . Currently, the following file formats are supported: . . - Windows bitmaps - *.bmp, *.dib (always supported) . - JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section) . - JPEG 2000 files - *.jp2 (see the Note section) . - Portable Network Graphics - *.png (see the Note section) . - WebP - *.webp (see the Note section) . - AVIF - *.avif (see the Note section) . - Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported) . - PFM files - *.pfm (see the Note section) . - Sun rasters - *.sr, *.ras (always supported) . - TIFF files - *.tiff, *.tif (see the Note section) . - OpenEXR Image files - *.exr (see the Note section) . - Radiance HDR - *.hdr, *.pic (always supported) . - Raster and Vector geospatial data supported by GDAL (see the Note section) . . @note . - The function determines the type of an image by the content, not by the file extension. . - In the case of color images, the decoded images will have the channels stored in B G R order. . - When using IMREAD_GRAYSCALE, the codec’s internal grayscale conversion will be used, if available. . Results may differ to the output of cvtColor() . - On Microsoft Windows* OS and MacOSX*, the codecs shipped with an OpenCV image (libjpeg, . libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, . and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware . that currently these native image loaders give images with different pixel values because of . the color management embedded into MacOSX. . - On Linux*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for . codecs supplied with an OS image. Install the relevant packages (do not forget the development . files, for example, “libjpeg-dev”, in Debian* and Ubuntu*) to get the codec support or turn . on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake. . - In the case you set WITH_GDAL flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, . then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting . the following formats: [Raster](http://www.gdal.org/formats_list.html), . [Vector](http://www.gdal.org/ogr_formats.html). . - If EXIF information is embedded in the image file, the EXIF orientation will be taken into account . and thus the image will be rotated accordingly except if the flags @ref IMREAD_IGNORE_ORIENTATION . or @ref IMREAD_UNCHANGED are passed. . - Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image. . - By default number of pixels must be less than 2^30. Limit can be set using system . variable OPENCV_IO_MAX_IMAGE_PIXELS . . @param filename Name of file to be loaded. . @param flags Flag that can take values of cv::ImreadModes

tests.test_routes module

tests.test_spectra module

class TestSpectra[source]

Bases: object

CUSTOM_CONFIG_PATH: str = 'tests/resources/configs/spectra.yml'
DATA_SOURCE_FOLDER_NAME: str = 'spectra_source'
RESOURCES_PATH: Path = PosixPath('tests/resources')
TEST_RAW_DATA: ndarray = array([[[3, 4],         [1, 2],         [1, 2]],         [[2, 2],         [2, 0],         [2, 2]],         [[2, 2],         [2, 0],         [2, 2]]], dtype=uint16)
TEST_RAW_PATH: str = 'tests/resources/spectra/data/spectra_source/data.raw'
setup_environment()[source]
test_get_average_global()[source]
test_get_average_selection(caplog)[source]
test_get_average_selection_config_none(caplog)[source]
test_get_raw_data()[source]
test_get_theoretical_data()[source]
test_get_theoretical_data_invalid_element(caplog)[source]
test_mipmap_create()[source]
test_mipmap_data()[source]
test_mipmap_inexistent_data_source()[source]
test_mipmap_low_level()[source]
test_mipmap_not_exist()[source]

Module contents