Skip to content

Commit

Permalink
move kodak data and morie tests for datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclifford1 committed Oct 9, 2024
1 parent b68a9f0 commit 28a89d1
Show file tree
Hide file tree
Showing 38 changed files with 83 additions and 180 deletions.
9 changes: 9 additions & 0 deletions IQM_Vis/examples/KODAK_dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os
import glob

dir = os.path.dirname(os.path.abspath(__file__))

KODAK_IMAGES = glob.glob(os.path.join(dir, '*'))
# remove and folders
KODAK_IMAGES = [f for f in KODAK_IMAGES if os.path.isfile(f)]
KODAK_IMAGES.sort()
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 1 addition & 5 deletions IQM_Vis/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
from IQM_Vis.examples.multiple import run
from IQM_Vis.examples.simple import run
from IQM_Vis.examples.dataset import run
from IQM_Vis.examples.all import run
from IQM_Vis.examples.kodak import run
import IQM_Vis.examples.images
import IQM_Vis.examples.kodak
7 changes: 4 additions & 3 deletions IQM_Vis/examples/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def run():

# make dataset list of images
file_path = os.path.dirname(os.path.abspath(__file__))
dataset = [os.path.join(file_path, 'images', 'waves1.jpeg'),
os.path.join(file_path, 'images', 'waves2.jpeg'),
os.path.join(file_path, 'images', 'waves3.jpeg')]
dataset = [IQM_Vis.examples.images.IMAGE1,
IQM_Vis.examples.images.IMAGE2,
IQM_Vis.examples.images.IMAGE3]

data = IQM_Vis.dataset_holder(dataset,
metric,
metric_images,
Expand Down
51 changes: 0 additions & 51 deletions IQM_Vis/examples/experiment.py

This file was deleted.

12 changes: 2 additions & 10 deletions IQM_Vis/examples/kodak.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
# Author: Matt Clifford <[email protected]>
# License: BSD 3-Clause License

import os
import glob
import IQM_Vis
from IQM_Vis.examples.KODAK_dataset import KODAK_IMAGES

def run():
file_path = os.path.dirname(os.path.abspath(__file__))
dir = os.path.join(file_path, 'KODAK-dataset')
image_list = glob.glob(os.path.join(dir, '*'))
# remove and folders
image_list = [f for f in image_list if os.path.isfile(f)]
image_list.sort()

metrs = IQM_Vis.metrics.get_all_metrics()
if '1-MS_SSIM' in metrs:
metrs.pop('1-MS_SSIM')
data = IQM_Vis.dataset_holder(image_list,
data = IQM_Vis.dataset_holder(KODAK_IMAGES,
metrs,
# IQM_Vis.metrics.get_all_metric_images()
)
Expand Down
42 changes: 0 additions & 42 deletions IQM_Vis/examples/multiple.py

This file was deleted.

34 changes: 0 additions & 34 deletions IQM_Vis/examples/new_api.py

This file was deleted.

27 changes: 0 additions & 27 deletions IQM_Vis/examples/simple.py

This file was deleted.

1 change: 1 addition & 0 deletions IQM_Vis/ui_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
except ImportError:
warnings.warn('Cannot load PyQt6 library - running IQM_Vis package in headless mode')


class make_UI:
def __init__(self,
data_store=None,
Expand Down
22 changes: 22 additions & 0 deletions tests/UI/test_check_args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Author: Matt Clifford <[email protected]>
# License: BSD 3-Clause License

from tests.QtBot_utils import BotTester
import IQM_Vis

import sys
import os
sys.path.append(os.path.abspath('..'))


def get_UI():
app = IQM_Vis.make_UI(test=True, debug=True)
return app


build_IQM_Vis = BotTester(get_UI=get_UI).build_IQM_Vis


def test_dev_true(build_IQM_Vis):
test_window, _ = build_IQM_Vis
assert test_window.showing == True
46 changes: 41 additions & 5 deletions tests/UI/test_sliders.py → tests/UI/test_dataset_scrolling.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Author: Matt Clifford <[email protected]>
# License: BSD 3-Clause License
from PyQt6 import QtTest, QtCore

import IQM_Vis
import sys
import os
sys.path.append(os.path.abspath('..'))
import IQM_Vis.examples.KODAK_dataset
from tests.QtBot_utils import BotTester


def get_UI():
image1 = IQM_Vis.examples.images.IMAGE1
image2 = IQM_Vis.examples.images.IMAGE2
images = [image1, image2]
images = IQM_Vis.examples.KODAK_dataset.KODAK_IMAGES

MAE = IQM_Vis.metrics.MAE()
MSE = IQM_Vis.metrics.MSE()
Expand Down Expand Up @@ -44,14 +45,49 @@ def get_UI():
test_app = IQM_Vis.make_UI(transformations=transformations,
image_list=images,
metrics=metrics,
metric_images=metric_images,
# metric_images=metric_images,
test=True)
return test_app


build_IQM_Vis = BotTester(get_UI=get_UI, wait_time=1000,
final_wait=True).build_IQM_Vis

def test_sliders(build_IQM_Vis):
def test_dataset_scrolling(build_IQM_Vis):
test_window, qtbotbis = build_IQM_Vis
assert test_window.showing == True

QtTest.QTest.qWait(500)

# cycle the dataset backwards
for _ in range(2):
button = test_window.window.widget_controls['button']['prev_data']
qtbotbis.mouseClick(button, QtCore.Qt.MouseButton.LeftButton)
QtTest.QTest.qWait(500)
# check not crashed
assert test_window.showing == True

# click on an image to change the image
for i in range(1,5):
image = test_window.window.widget_controls['images'][i]
qtbotbis.mouseClick(image, QtCore.Qt.MouseButton.LeftButton)
QtTest.QTest.qWait(500)

# cycle the dataset forwards
for _ in range(3):
button = test_window.window.widget_controls['button']['prev_data']
qtbotbis.mouseClick(button, QtCore.Qt.MouseButton.LeftButton)
QtTest.QTest.qWait(500)
# check not crashed
assert test_window.showing == True

# click on an image to change the image
for i in range(1,5):
image = test_window.window.widget_controls['images'][i]
qtbotbis.mouseClick(image, QtCore.Qt.MouseButton.LeftButton)
QtTest.QTest.qWait(500)
# check not crashed
assert test_window.showing == True



2 changes: 1 addition & 1 deletion tests/reports/coverage_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/reports/junit/junit.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="13" time="27.636" timestamp="2024-10-09T16:14:46.626846" hostname="Dell-5320"><testcase classname="tests.test_metrics" name="test_all_metrics_initialise" time="0.247" /><testcase classname="tests.test_metrics" name="test_all_metrics_images_initialise" time="0.252" /><testcase classname="tests.test_metrics" name="test_all_metrics_process_image" time="2.069" /><testcase classname="tests.test_metrics" name="test_all_metric_images_process_image" time="0.280" /><testcase classname="tests.test_transforms" name="test_all_transforms_init_value_no_change_image" time="0.259" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_max_specified" time="0.256" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_change_image" time="0.301" /><testcase classname="tests.test_transforms" name="test_all_transforms_max_change_image" time="0.359" /><testcase classname="tests.UI.test_sliders" name="test_sliders" time="3.176" /><testcase classname="tests.notebook_examples.test_1_making_the_UI" name="test_build_1" time="3.073" /><testcase classname="tests.notebook_examples.test_2_simple_customisation" name="test_build_1" time="3.203" /><testcase classname="tests.notebook_examples.test_3_customisation_details" name="test_build_3" time="3.173" /><testcase classname="tests.notebook_examples.test_4_experiment" name="test_experiment_runs" time="8.071" /></testsuite></testsuites>
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="14" time="37.058" timestamp="2024-10-09T16:59:53.362008" hostname="Dell-5320"><testcase classname="tests.test_metrics" name="test_all_metrics_initialise" time="0.215" /><testcase classname="tests.test_metrics" name="test_all_metrics_images_initialise" time="0.208" /><testcase classname="tests.test_metrics" name="test_all_metrics_process_image" time="1.927" /><testcase classname="tests.test_metrics" name="test_all_metric_images_process_image" time="0.238" /><testcase classname="tests.test_transforms" name="test_all_transforms_init_value_no_change_image" time="0.235" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_max_specified" time="0.233" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_change_image" time="0.253" /><testcase classname="tests.test_transforms" name="test_all_transforms_max_change_image" time="0.295" /><testcase classname="tests.UI.test_check_args" name="test_dev_true" time="2.859" /><testcase classname="tests.UI.test_dataset_scrolling" name="test_dataset_scrolling" time="11.077" /><testcase classname="tests.notebook_examples.test_1_making_the_UI" name="test_build_1" time="2.855" /><testcase classname="tests.notebook_examples.test_2_simple_customisation" name="test_build_1" time="2.980" /><testcase classname="tests.notebook_examples.test_3_customisation_details" name="test_build_3" time="2.903" /><testcase classname="tests.notebook_examples.test_4_experiment" name="test_experiment_runs" time="7.946" /></testsuite></testsuites>
2 changes: 1 addition & 1 deletion tests/reports/tests_badge.svg

0 comments on commit 28a89d1

Please sign in to comment.