tests package¶
Subpackages¶
- tests.color_segmentation package
- Submodules
- tests.color_segmentation.manual_testing_color_seg module
- tests.color_segmentation.test_color_seg module
TestColorSegmentationTestColorSegmentation.BITMASK_PATHTestColorSegmentation.BW_IMAGE_PATHTestColorSegmentation.CUSTOM_CONFIG_PATHTestColorSegmentation.DATA_CUBE_PATHTestColorSegmentation.DATA_SOURCETestColorSegmentation.IMAGE_NAMETestColorSegmentation.PATH_DATA_SOURCETestColorSegmentation.REG_TEST_IMAGE_PATHTestColorSegmentation.TEST_IMAGE_PATHTestColorSegmentation.WRONG_CONFIG_PATHTestColorSegmentation.elem_thresholdTestColorSegmentation.kTestColorSegmentation.num_attemptsTestColorSegmentation.setup_get_elemental_clusters()TestColorSegmentation.test_combined_bitmasks()TestColorSegmentation.test_combined_empty_bitmasks()TestColorSegmentation.test_convert_to_hex()TestColorSegmentation.test_get_clusters_using_k_means_colors()TestColorSegmentation.test_get_clusters_using_k_means_colors_register_fail()TestColorSegmentation.test_get_elem_clusters_using_k_means()TestColorSegmentation.test_get_elem_clusters_using_k_means_elemental_not_found()TestColorSegmentation.test_get_elem_clusters_using_k_means_empty_mask()TestColorSegmentation.test_get_elem_clusters_using_k_means_register_fail()TestColorSegmentation.test_get_path_to_cs_folder()TestColorSegmentation.test_get_path_to_cs_folder_wrong_datasource()TestColorSegmentation.test_image_to_rgb_and_lab()TestColorSegmentation.test_merge_similar_colors()TestColorSegmentation.test_merge_similar_colors_empty()TestColorSegmentation.test_rgb_to_lab()TestColorSegmentation.test_save_bitmask()TestColorSegmentation.test_save_bitmask_invalid_bitmask()TestColorSegmentation.test_save_bitmask_wrong_path()
empty_array()
- Module contents
- tests.file_system package
- Submodules
- tests.file_system.test_element_data module
TestElementalDataTestElementalData.CUSTOM_CONFIG_PATHTestElementalData.DATA_CUBE_CSVTestElementalData.DATA_CUBE_DMSTestElementalData.ELEMENTSTestElementalData.NAME_CUBE_FROM_CSVTestElementalData.NON_EXISTING_CUBETestElementalData.PATH_TO_TEST_FOLDERTestElementalData.RAW_ELEMENTAL_CUBETestElementalData.SOURCE_FOLDER_CSVTestElementalData.SOURCE_FOLDER_DMSTestElementalData.do_test_get_element_names()TestElementalData.do_test_get_elemental_cube()TestElementalData.do_test_get_elemental_map()TestElementalData.setup_environment()TestElementalData.test_csv_to_dms()TestElementalData.test_csv_to_dms_directly()TestElementalData.test_get_element_averages()TestElementalData.test_get_element_averages_invalid_data_source()TestElementalData.test_get_element_averages_selection()TestElementalData.test_get_element_names()TestElementalData.test_get_element_names_invalid_data_source()TestElementalData.test_get_elemental_cube()TestElementalData.test_get_elemental_map()TestElementalData.test_get_elemental_map_invalid_type()TestElementalData.test_get_short_element_names_invalid_data_source()TestElementalData.test_to_dms_cube_name_includes_file_extension()TestElementalData.test_to_dms_invalid_folder_path()
- tests.file_system.test_file_upload module
TestUploadFileToServerTestUploadFileToServer.CUSTOM_CONFIG_PATHTestUploadFileToServer.CUSTOM_CONFIG_PATH_NO_SOURCESTestUploadFileToServer.UPLOAD_FILE_PATHTestUploadFileToServer.get_filestorage_object()TestUploadFileToServer.test_get_data_source_files()TestUploadFileToServer.test_get_data_source_files_invalid_config()TestUploadFileToServer.test_get_data_source_files_invalid_path()TestUploadFileToServer.test_get_data_source_names_invalid_config()TestUploadFileToServer.test_get_file_names()TestUploadFileToServer.test_no_file_names()
- tests.file_system.test_spectral module
TestSpectralTestSpectral.CUSTOM_CONFIG_PATHTestSpectral.DATA_SOURCE_FOLDER_NAMETestSpectral.EMPTY_SOURCE_NAMETestSpectral.NO_OFFSET_NAMETestSpectral.NO_RAW_SOURCE_NAMETestSpectral.NO_WORKSPACE_NAMETestSpectral.RESOURCES_PATHTestSpectral.TEST_RAW_PATHTestSpectral.WRONG_SIZE_NAMETestSpectral.numpy_to_raw()TestSpectral.setup_environment()TestSpectral.test_bin_data_()TestSpectral.test_bin_data_default_params()TestSpectral.test_bin_data_empty_rpl()TestSpectral.test_bin_data_identity()TestSpectral.test_bin_data_no_raw()TestSpectral.test_bin_data_wrong_size()TestSpectral.test_get_spectra_params()TestSpectral.test_get_spectra_params_file_not_found()TestSpectral.test_parse_rpl()TestSpectral.test_parse_rpl_empty_file()TestSpectral.test_parse_rpl_file_not_found()TestSpectral.test_update_bin_params()TestSpectral.test_update_bin_params_default()TestSpectral.test_update_bin_params_no_offset()
- tests.file_system.test_workspace_handler module
TestWorkspaceHandlerTestWorkspaceHandler.CUSTOM_CONFIG_PATHTestWorkspaceHandler.CUSTOM_DATA_FOLDERTestWorkspaceHandler.DATASOURCE_NAMETestWorkspaceHandler.DATASOURCE_NAME_NO_WORKSPACETestWorkspaceHandler.ELEMENTAL_CUBE_NAMETestWorkspaceHandler.test_config_not_found_get_workspace()TestWorkspaceHandler.test_config_not_found_update_workspace()TestWorkspaceHandler.test_datasource_not_found_get_workspace()TestWorkspaceHandler.test_datasource_not_found_update_workspace()TestWorkspaceHandler.test_get_base_image_name()TestWorkspaceHandler.test_get_base_image_name_no_config()TestWorkspaceHandler.test_get_base_image_name_no_workspace()TestWorkspaceHandler.test_get_base_image_path_no_config()TestWorkspaceHandler.test_get_base_image_path_no_filepath()TestWorkspaceHandler.test_get_elemental_cube_path_from_name_invalid_name()TestWorkspaceHandler.test_get_elemental_cube_path_from_name_no_config()TestWorkspaceHandler.test_get_elemental_cube_path_from_name_no_workspace()TestWorkspaceHandler.test_get_get_workspace_dict_no_config()TestWorkspaceHandler.test_get_spectral_cube_recipe_path_no_config()TestWorkspaceHandler.test_get_spectral_cube_recipe_path_no_workspace()TestWorkspaceHandler.test_update_workspace()TestWorkspaceHandler.test_workspace_found()
- Module contents
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'¶
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'¶
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'¶
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'¶
- 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'¶