Skip to content

Commit

Permalink
change print to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
MialLewis committed Dec 19, 2023
1 parent 7c79f19 commit c11b335
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions EVSVesuvio/vesuvio_analysis/ICHelpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from mantid.simpleapi import Load, LoadVesuvio, SaveNexus
from pathlib import Path
from EVSVesuvio.scripts import handle_config
from mantid.kernel import logger

experimentsPath = (
Path(handle_config.read_config_var("caching.location")) / "experiments"
@@ -139,29 +140,31 @@ def setOutputDirsForSample(IC, sampleName):

def wsHistoryMatchesInputs(runs, mode, ipfile, localPath):
if not (localPath.is_file()):
print("FILE NOT FOUND")
logger.notice("FILE NOT FOUND")
return False
print("FILE FOUND")
logger.notice("FILE FOUND")
local_ws = Load(Filename=str(localPath))
ws_history = local_ws.getHistory()
metadata = ws_history.getAlgorithmHistory(0)

saved_runs = metadata.getPropertyValue("Filename")
print(f"{saved_runs} v {runs}")
logger.notice(f"{saved_runs} v {runs}")
if saved_runs != runs:
print(f"Filename in saved workspace did not match: {saved_runs} and {runs}")
logger.notice(
f"Filename in saved workspace did not match: {saved_runs} and {runs}"
)
return False

saved_mode = metadata.getPropertyValue("Mode")
print(f"{saved_mode} v {mode}")
logger.notice(f"{saved_mode} v {mode}")
if saved_mode != mode:
print(f"Mode in saved workspace did not match: {saved_mode} and {mode}")
logger.notice(f"Mode in saved workspace did not match: {saved_mode} and {mode}")
return False

saved_ipfile_name = Path(metadata.getPropertyValue("InstrumentParFile")).name
print(f"{saved_ipfile_name} v {ipfile.name}")
logger.notice(f"{saved_ipfile_name} v {ipfile.name}")
if saved_ipfile_name != ipfile.name:
print(
logger.notice(
f"IP files in saved workspace did not match: {saved_ipfile_name} and {ipfile.name}"
)
return False

0 comments on commit c11b335

Please sign in to comment.