Skip to content

Commit

Permalink
removed testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeigh committed Jun 7, 2024
1 parent 4abf242 commit 6c3139c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
19 changes: 4 additions & 15 deletions scripts/operations_tests/operations_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import numpy as np
import pandas as pd



try:
from plotly import graph_objs as go
from plotly.subplots import make_subplots
Expand All @@ -31,11 +29,10 @@
exit(1)

sys.path.append(str(Path(__file__).resolve().parent.parent.parent))
from mantidimaging.core.utility.data_containers import FILE_TYPES
from mantidimaging.core.io.filenames import FilenameGroup # noqa: E402
from mantidimaging.core.io.loader import loader # noqa: E402
from mantidimaging.core.operations.loader import load_filter_packages
from mantidimaging.core.io.instrument_log import InstrumentLog # noqa: E402
from mantidimaging.core.io.instrument_log import InstrumentLog # noqa: E402

script_dir = Path(__file__).resolve().parent
log_directory = script_dir / "logs"
Expand Down Expand Up @@ -150,7 +147,7 @@ def run_test(self, test_case):
elif test_case.pre_run_step == 'add_flats_and_darks':
self.add_flats_and_darks(test_case.params)
elif test_case.pre_run_step == 'load_monitor_log':
log_data = self.load_monitor_log(test_case.params)
log_data = self.load_monitor_log()
image_stack.log_file = log_data

test_case.duration, new_image_stack = self.time_operation(image_stack, test_case.op_func, test_case.params)
Expand All @@ -174,24 +171,16 @@ def run_test(self, test_case):

TEST_CASE_RESULTS.append(test_case)

def load_monitor_log(self, params):
def load_monitor_log(self):
filename_group = FilenameGroup.from_file(config_manager.load_sample)
filename_group.find_log_file()
log_file_path = filename_group.log_path

if log_file_path is None:
raise ValueError("Log file path could not be determined.")

log_file_type = params.get('log_file_type')

if not hasattr(FILE_TYPES, log_file_type):
raise ValueError(f"Unknown log file type: {log_file_type}")

print(f"Log file path: {log_file_path}")

with open(log_file_path, 'r') as file:
with open(log_file_path) as file:
log_lines = file.readlines()
print(f"Loaded monitor log from {log_file_path}")
return InstrumentLog(log_lines, Path(log_file_path))

def add_nan(self, image_stack, fraction=0.001):
Expand Down
20 changes: 0 additions & 20 deletions scripts/operations_tests/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -650,26 +650,6 @@
"test_name": "default_normalisation",
"pre_run_step": "load_monitor_log",
"params": {
"log_file_type": "SAMPLE_LOG"
}
},
{
"test_name": "no_log_file",
"pre_run_step": "none",
"params": {}
},
{
"test_name": "incorrect_log_values",
"pre_run_step": "load_monitor_log",
"params": {
"log_file_type": "FLAT_BEFORE_LOG"
}
},
{
"test_name": "different_exposure_times",
"pre_run_previous_step": "load_monitor_log",
"params": {
"log_file_type": "FLAT_AFTER_LOG"
}
}
]
Expand Down

0 comments on commit 6c3139c

Please sign in to comment.