From 72de45ee1c18fc2564d3882631f0042efeb262bd Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Mon, 12 Feb 2024 17:18:04 +0000 Subject: [PATCH 01/14] Started first part of handling directories - Replaced cache and experiments by only one argument: inputs - CLI working as expected --- mvesuvio/__init__.py | 17 +++++------- mvesuvio/analysis_runner.py | 9 ++----- mvesuvio/config/analysis_inputs.py | 10 ++++++- mvesuvio/config/vesuvio.user.properties | 3 +-- mvesuvio/scripts/__init__.py | 35 +++++++++---------------- mvesuvio/scripts/handle_config.py | 15 ++++------- mvesuvio/vesuvio_analysis/ICHelpers.py | 27 ++++++++++--------- 7 files changed, 49 insertions(+), 67 deletions(-) diff --git a/mvesuvio/__init__.py b/mvesuvio/__init__.py index 2ffce353..46ff9f3d 100644 --- a/mvesuvio/__init__.py +++ b/mvesuvio/__init__.py @@ -21,19 +21,14 @@ def command(self): return self.__command class ConfigArgInputs(ArgInputs): - def __init__(self, set_cache, set_experiment, set_ipfolder): + def __init__(self, set_inputs, set_ipfolder): super().__init__("config") - self.__set_cache = set_cache - self.__set_experiment = set_experiment + self.__set_inputs = set_inputs self.__set_ipfolder = set_ipfolder @property - def set_cache(self): - return self.__set_cache - - @property - def set_experiment(self): - return self.__set_experiment + def set_inputs(self): + return self.__set_inputs @property def set_ipfolder(self): @@ -50,8 +45,8 @@ def yes(self): return self.__yes -def set_config(cache_directory="", experiment_id="", ip_folder=""): - config_args = ConfigArgInputs(cache_directory, experiment_id, ip_folder) +def set_config(inputs_file="", ip_folder=""): + config_args = ConfigArgInputs(inputs_file, ip_folder) main(config_args) def run(yes_to_all=False): diff --git a/mvesuvio/analysis_runner.py b/mvesuvio/analysis_runner.py index 00b58005..49183b67 100644 --- a/mvesuvio/analysis_runner.py +++ b/mvesuvio/analysis_runner.py @@ -7,13 +7,8 @@ def run(yes_to_all=False): - scriptName = handle_config.read_config_var("caching.experiment") - experimentsPath = ( - Path(handle_config.read_config_var("caching.location")) - / "experiments" - / scriptName - ) # Path to the repository - inputs_path = experimentsPath / "analysis_inputs.py" + inputs_path = Path(handle_config.read_config_var("caching.inputs")) + scriptName = inputs_path.name ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) ai = import_from_path(inputs_path, "analysis_inputs") diff --git a/mvesuvio/config/analysis_inputs.py b/mvesuvio/config/analysis_inputs.py index 8690a8ca..21d4036b 100644 --- a/mvesuvio/config/analysis_inputs.py +++ b/mvesuvio/config/analysis_inputs.py @@ -141,7 +141,7 @@ class YSpaceFitInitialConditions: showPlots = True symmetrisationFlag = True rebinParametersForYSpaceFit = "-25, 0.5, 25" # Needs to be symetric - fitModel = "Gaussian3D" # Options: 'SINGLE_GAUSSIAN', 'GC_C4', 'GC_C6', 'GC_C4_C6', 'DOUBLE_WELL', 'ANSIO_GAUSSIAN', 'Gaussian3D' + fitModel = "SINGLE_GAUSSIAN" # Options: 'SINGLE_GAUSSIAN', 'GC_C4', 'GC_C6', 'GC_C4_C6', 'DOUBLE_WELL', 'ANSIO_GAUSSIAN', 'Gaussian3D' runMinos = True globalFit = True # Performs global fit with Minuit by default nGlobalFitGroups = 4 # Number or string "ALL" @@ -160,3 +160,11 @@ class UserScriptControls: class BootstrapInitialConditions: runBootstrap = False + +#################### +### RUN ANALYSIS ### +#################### +import mvesuvio +from pathlib import Path +mvesuvio.set_config(inputs_file=Path(__file__)) +mvesuvio.run() diff --git a/mvesuvio/config/vesuvio.user.properties b/mvesuvio/config/vesuvio.user.properties index d232dbee..2462f326 100644 --- a/mvesuvio/config/vesuvio.user.properties +++ b/mvesuvio/config/vesuvio.user.properties @@ -1,4 +1,3 @@ # properties that suit your particular installation. -caching.location= -caching.experiment= +caching.inputs= caching.ipfolder= diff --git a/mvesuvio/scripts/__init__.py b/mvesuvio/scripts/__init__.py index 7615d88e..723ac21d 100644 --- a/mvesuvio/scripts/__init__.py +++ b/mvesuvio/scripts/__init__.py @@ -15,11 +15,13 @@ def main(manual_args=None): __setup_config(None) __run_analysis(args.yes) + def __setup_and_parse_args(): parser = __set_up_parser() args = parser.parse_args() return args + def __set_up_parser(): parser = argparse.ArgumentParser( description="Package to analyse Vesuvio instrument data" @@ -27,7 +29,7 @@ def __set_up_parser(): subparsers = parser.add_subparsers(dest="command", required=True) config_parser = subparsers.add_parser("config", help="set mvesuvio configuration") config_parser.add_argument( - "--set-cache", "-c", help="set the cache directory", default="", type=str + "--set-inputs", "-i", help="set the inputs python file", default="", type=str ) config_parser.add_argument( "--set-ipfolder", @@ -36,13 +38,6 @@ def __set_up_parser(): default="", type=str, ) - config_parser.add_argument( - "--set-experiment", - "-e", - help="set the current experiment", - default="", - type=str, - ) run_parser = subparsers.add_parser("run", help="run mvesuvio analysis") run_parser.add_argument( @@ -55,17 +50,13 @@ def __setup_config(args): config_dir = handle_config.VESUVIO_CONFIG_PATH handle_config.setup_config_dir(config_dir) ipfolder_dir = handle_config.VESUVIO_IPFOLDER_PATH + inputs = handle_config.VESUVIO_INPUTS_PATH if handle_config.config_set(): - cache_dir = ( - handle_config.read_config_var("caching.location") - if not args or not args.set_cache - else args.set_cache - ) - experiment = ( - handle_config.read_config_var("caching.experiment") - if not args or not args.set_experiment - else args.set_experiment + inputs = ( + handle_config.read_config_var("caching.inputs") + if not args or not args.set_inputs + else args.set_inputs ) ipfolder_dir = ( handle_config.read_config_var("caching.ipfolder") @@ -73,24 +64,22 @@ def __setup_config(args): else args.set_ipfolder ) else: - cache_dir = config_dir if not args or not args.set_cache else args.set_cache - experiment = ( - "default" if not args or not args.set_experiment else args.set_experiment + inputs = ( + inputs if not args or not args.set_inputs else args.set_inputs ) ipfolder_dir = ( ipfolder_dir if not args or not args.set_ipfolder else args.set_ipfolder ) handle_config.setup_default_ipfile_dir() + handle_config.setup_default_inputs() handle_config.set_config_vars( { - "caching.location": cache_dir, - "caching.experiment": experiment, + "caching.inputs": inputs, "caching.ipfolder": ipfolder_dir, } ) - handle_config.setup_expr_dir(cache_dir, experiment) handle_config.check_dir_exists("IP folder", ipfolder_dir) diff --git a/mvesuvio/scripts/handle_config.py b/mvesuvio/scripts/handle_config.py index 8fd7b28d..3b23dfda 100644 --- a/mvesuvio/scripts/handle_config.py +++ b/mvesuvio/scripts/handle_config.py @@ -15,6 +15,7 @@ def __parse_config_env_var(): ### PATH CONSTANTS ### VESUVIO_CONFIG_PATH, VESUVIO_CONFIG_FILE = __parse_config_env_var() VESUVIO_INPUTS_FILE = "analysis_inputs.py" +VESUVIO_INPUTS_PATH = os.path.join(VESUVIO_CONFIG_PATH, VESUVIO_INPUTS_FILE) VESUVIO_PACKAGE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) MANTID_CONFIG_FILE = "Mantid.user.properties" VESUVIO_IPFOLDER_PATH = os.path.join(VESUVIO_CONFIG_PATH, "ip_files") @@ -83,13 +84,11 @@ def setup_config_dir(config_dir): ) -def setup_expr_dir(cache_dir, experiment): - expr_path = os.path.join(cache_dir, "experiments", experiment) - success = __mk_dir("experiment", expr_path) - if success: +def setup_default_inputs(): + if not os.path.isfile(VESUVIO_INPUTS_PATH): copyfile( os.path.join(VESUVIO_PACKAGE_PATH, "config", VESUVIO_INPUTS_FILE), - input_file_path(cache_dir, experiment), + os.path.join(VESUVIO_INPUTS_PATH), ) @@ -114,16 +113,12 @@ def __mk_dir(type, path): def config_set(): - if read_config_var("caching.location", False): + if read_config_var("caching.inputs", False): return True else: return False -def input_file_path(cache_dir, experiment): - return os.path.join(cache_dir, "experiments", experiment, VESUVIO_INPUTS_FILE) - - def check_dir_exists(type, path): if not os.path.isdir(path): print(f"Directory of {type} could not be found at location: {path}") diff --git a/mvesuvio/vesuvio_analysis/ICHelpers.py b/mvesuvio/vesuvio_analysis/ICHelpers.py index 0f664350..318b0782 100644 --- a/mvesuvio/vesuvio_analysis/ICHelpers.py +++ b/mvesuvio/vesuvio_analysis/ICHelpers.py @@ -4,9 +4,10 @@ from mantid.kernel import logger import ntpath -experimentsPath = ( - Path(handle_config.read_config_var("caching.location")) / "experiments" +inputsPath = ( + Path(handle_config.read_config_var("caching.inputs")) ) +experimentPath = inputsPath.parent / inputsPath.name.strip(".py") def completeICFromInputs(IC, scriptName, wsIC): @@ -65,11 +66,6 @@ def completeICFromInputs(IC, scriptName, wsIC): # Default not running preliminary procedure to estimate HToMass0Ratio IC.runningPreliminary = False - # Set directories for figures - figSavePath = experimentsPath / scriptName / "figures" - figSavePath.mkdir(exist_ok=True) - IC.figSavePath = figSavePath - # Create default of not running original version with histogram data try: IC.runHistData @@ -86,7 +82,7 @@ def completeICFromInputs(IC, scriptName, wsIC): def setInputWSForSample(wsIC, sampleName): - inputWSPath = experimentsPath / sampleName / "input_ws" + inputWSPath = experimentPath / "input_ws" inputWSPath.mkdir(parents=True, exist_ok=True) runningMode = getRunningMode(wsIC) @@ -119,7 +115,7 @@ def getRunningMode(wsIC): def setOutputDirsForSample(IC, sampleName): - outputPath = experimentsPath / sampleName / "output_files" + outputPath = experimentPath / "output_files" outputPath.mkdir(parents=True, exist_ok=True) # Build Filename based on ic @@ -136,6 +132,11 @@ def setOutputDirsForSample(IC, sampleName): IC.resultsSavePath = outputPath / fileName IC.ySpaceFitSavePath = outputPath / fileNameYSpace + + # Set directories for figures + figSavePath = experimentPath / "figures" + figSavePath.mkdir(exist_ok=True) + IC.figSavePath = figSavePath return @@ -213,13 +214,13 @@ def setBootstrapDirs(bckwdIC, fwdIC, bootIC, yFitIC): sampleName = bckwdIC.scriptName # Name of sample currently running # Used to store running times required to estimate Bootstrap total run time. - bootIC.runTimesPath = experimentsPath / sampleName / "running_times.txt" + bootIC.runTimesPath = experimentPath / "running_times.txt" # Make bootstrap and jackknife data directories if bootIC.bootstrapType == "JACKKNIFE": - bootPath = experimentsPath / sampleName / "jackknife_data" + bootPath = experimentPath / "jackknife_data" else: - bootPath = experimentsPath / sampleName / "bootstrap_data" + bootPath = experimentPath / "bootstrap_data" bootPath.mkdir(exist_ok=True) # Folders for skipped and unskipped MS @@ -326,7 +327,7 @@ def buildFinalWSName(scriptName: str, procedure: str, IC): def completeYFitIC(yFitIC, sampleName): # Set directories for figures - figSavePath = experimentsPath / sampleName / "figures" + figSavePath = experimentPath / "figures" figSavePath.mkdir(exist_ok=True) yFitIC.figSavePath = figSavePath return From d4a8ec619dedb771f17e4372097ef92fd46b3c8b Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Tue, 13 Feb 2024 10:49:46 +0000 Subject: [PATCH 02/14] Fixed infinite recursion caused by import - Introduced modifyied __name__ == "__main__" statement - Also accounts for when the script is run from within the mantid editor --- mvesuvio/config/analysis_inputs.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mvesuvio/config/analysis_inputs.py b/mvesuvio/config/analysis_inputs.py index 21d4036b..b005d7a6 100644 --- a/mvesuvio/config/analysis_inputs.py +++ b/mvesuvio/config/analysis_inputs.py @@ -161,10 +161,13 @@ class UserScriptControls: class BootstrapInitialConditions: runBootstrap = False + #################### ### RUN ANALYSIS ### #################### -import mvesuvio -from pathlib import Path -mvesuvio.set_config(inputs_file=Path(__file__)) -mvesuvio.run() + +if (__name__ == "__main__") or (__name__ == "mantidqt.widgets.codeeditor.execution"): + import mvesuvio + from pathlib import Path + mvesuvio.set_config(inputs_file=Path(__file__)) + mvesuvio.run() From 600a8bbf264064a2c10a8973169ea667be1f4567 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Tue, 13 Feb 2024 11:38:24 +0000 Subject: [PATCH 03/14] Put assignment of experiment directory in a single place - Previously the path to the experiment directory was defined in terms of scriptName - scriptName was defined in two places, which is not ideal - Defined scriptName in a single place, ICHelpers.py --- mvesuvio/analysis_runner.py | 3 +-- mvesuvio/vesuvio_analysis/ICHelpers.py | 26 ++++++++++++------------- mvesuvio/vesuvio_analysis/run_script.py | 9 ++++----- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/mvesuvio/analysis_runner.py b/mvesuvio/analysis_runner.py index 49183b67..8e9b7c8b 100644 --- a/mvesuvio/analysis_runner.py +++ b/mvesuvio/analysis_runner.py @@ -8,8 +8,8 @@ def run(yes_to_all=False): inputs_path = Path(handle_config.read_config_var("caching.inputs")) - scriptName = inputs_path.name ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) + ai = import_from_path(inputs_path, "analysis_inputs") start_time = time.time() @@ -24,7 +24,6 @@ def run(yes_to_all=False): runScript( userCtr, - scriptName, wsBackIC, wsFrontIC, bckwdIC, diff --git a/mvesuvio/vesuvio_analysis/ICHelpers.py b/mvesuvio/vesuvio_analysis/ICHelpers.py index 318b0782..4b3d6139 100644 --- a/mvesuvio/vesuvio_analysis/ICHelpers.py +++ b/mvesuvio/vesuvio_analysis/ICHelpers.py @@ -4,13 +4,12 @@ from mantid.kernel import logger import ntpath -inputsPath = ( - Path(handle_config.read_config_var("caching.inputs")) -) -experimentPath = inputsPath.parent / inputsPath.name.strip(".py") +inputsPath = Path(handle_config.read_config_var("caching.inputs")) +scriptName = inputsPath.name.removesuffix(".py") +experimentPath = inputsPath.parent / scriptName -def completeICFromInputs(IC, scriptName, wsIC): +def completeICFromInputs(IC, wsIC): """Assigns new methods to the initial conditions class from the inputs of that class""" assert ( @@ -50,12 +49,12 @@ def completeICFromInputs(IC, scriptName, wsIC): IC.InstrParsPath = wsIC.ipfile # Sort out input and output paths - rawPath, emptyPath = setInputWSForSample(wsIC, scriptName) + rawPath, emptyPath = setInputWSForSample(wsIC) IC.userWsRawPath = rawPath IC.userWsEmptyPath = emptyPath - setOutputDirsForSample(IC, scriptName) + setOutputDirsForSample(IC) # Do not run bootstrap sample, by default IC.runningSampleWS = False @@ -81,14 +80,14 @@ def completeICFromInputs(IC, scriptName, wsIC): return -def setInputWSForSample(wsIC, sampleName): +def setInputWSForSample(wsIC): inputWSPath = experimentPath / "input_ws" inputWSPath.mkdir(parents=True, exist_ok=True) runningMode = getRunningMode(wsIC) - rawWSName = sampleName + "_" + "raw" + "_" + runningMode + ".nxs" - emptyWSName = sampleName + "_" + "empty" + "_" + runningMode + ".nxs" + rawWSName = scriptName + "_" + "raw" + "_" + runningMode + ".nxs" + emptyWSName = scriptName + "_" + "empty" + "_" + runningMode + ".nxs" rawPath = inputWSPath / rawWSName emptyPath = inputWSPath / emptyWSName @@ -114,7 +113,7 @@ def getRunningMode(wsIC): return runningMode -def setOutputDirsForSample(IC, sampleName): +def setOutputDirsForSample(IC): outputPath = experimentPath / "output_files" outputPath.mkdir(parents=True, exist_ok=True) @@ -318,15 +317,14 @@ def noOfHistsFromTOFBinning(IC): return int((end - start) / spacing) - 1 # To account for last column being ignored -def buildFinalWSName(scriptName: str, procedure: str, IC): +def buildFinalWSName(procedure: str, IC): # Format of corrected ws from last iteration name = scriptName + "_" + procedure + "_" + str(IC.noOfMSIterations) return name -def completeYFitIC(yFitIC, sampleName): +def completeYFitIC(yFitIC): # Set directories for figures - figSavePath = experimentPath / "figures" figSavePath.mkdir(exist_ok=True) yFitIC.figSavePath = figSavePath diff --git a/mvesuvio/vesuvio_analysis/run_script.py b/mvesuvio/vesuvio_analysis/run_script.py index 00ac7f9c..8cd4f10b 100644 --- a/mvesuvio/vesuvio_analysis/run_script.py +++ b/mvesuvio/vesuvio_analysis/run_script.py @@ -18,7 +18,6 @@ def runScript( userCtr, - scriptName, wsBackIC, wsFrontIC, bckwdIC, @@ -28,10 +27,10 @@ def runScript( yes_to_all=False, ): # Set extra attributes from user attributes - completeICFromInputs(fwdIC, scriptName, wsFrontIC) - completeICFromInputs(bckwdIC, scriptName, wsBackIC) + completeICFromInputs(fwdIC, wsFrontIC) + completeICFromInputs(bckwdIC, wsBackIC) completeBootIC(bootIC, bckwdIC, fwdIC, yFitIC) - completeYFitIC(yFitIC, scriptName) + completeYFitIC(yFitIC) checkInputs(userCtr) checkInputs(bootIC) @@ -73,7 +72,7 @@ def runProcedure(): ICs = [] for mode, IC in zip(["BACKWARD", "FORWARD"], [bckwdIC, fwdIC]): if (userCtr.fitInYSpace == mode) | (userCtr.fitInYSpace == "JOINT"): - wsNames.append(buildFinalWSName(scriptName, mode, IC)) + wsNames.append(buildFinalWSName(mode, IC)) ICs.append(IC) # If bootstrap is not None, run bootstrap procedure and finish From 5238de67417c5a8b43c1024684cada9c97222f32 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Tue, 13 Feb 2024 14:49:30 +0000 Subject: [PATCH 04/14] Do workaround for mantid editor bug Mantid editor caches variables in the module scope, leading to wrong behaviours The changes implemented in this commit fix this by calling the variables inside functions --- mvesuvio/vesuvio_analysis/ICHelpers.py | 29 +++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/mvesuvio/vesuvio_analysis/ICHelpers.py b/mvesuvio/vesuvio_analysis/ICHelpers.py index 4b3d6139..69d7012c 100644 --- a/mvesuvio/vesuvio_analysis/ICHelpers.py +++ b/mvesuvio/vesuvio_analysis/ICHelpers.py @@ -4,13 +4,27 @@ from mantid.kernel import logger import ntpath -inputsPath = Path(handle_config.read_config_var("caching.inputs")) -scriptName = inputsPath.name.removesuffix(".py") -experimentPath = inputsPath.parent / scriptName + +def _get_expr_path(): + inputsPath = Path(handle_config.read_config_var("caching.inputs")) + scriptName = _get_script_name() + experimentPath = inputsPath.parent / scriptName + return experimentPath + + +def _get_script_name(): + inputsPath = Path(handle_config.read_config_var("caching.inputs")) + scriptName = inputsPath.name.removesuffix(".py") + return scriptName + +# inputsPath = Path(handle_config.read_config_var("caching.inputs")) +# scriptName = inputsPath.name.removesuffix(".py") +# experimentPath = inputsPath.parent / scriptName def completeICFromInputs(IC, wsIC): """Assigns new methods to the initial conditions class from the inputs of that class""" + scriptName = _get_script_name() assert ( IC.lastSpec > IC.firstSpec @@ -81,6 +95,10 @@ def completeICFromInputs(IC, wsIC): def setInputWSForSample(wsIC): + experimentPath = _get_expr_path() + scriptName = _get_script_name() + print(scriptName.upper()) + inputWSPath = experimentPath / "input_ws" inputWSPath.mkdir(parents=True, exist_ok=True) @@ -114,6 +132,7 @@ def getRunningMode(wsIC): def setOutputDirsForSample(IC): + experimentPath = _get_expr_path() outputPath = experimentPath / "output_files" outputPath.mkdir(parents=True, exist_ok=True) @@ -208,6 +227,8 @@ def completeBootIC(bootIC, bckwdIC, fwdIC, yFitIC): def setBootstrapDirs(bckwdIC, fwdIC, bootIC, yFitIC): """Form bootstrap output data paths""" + experimentPath = _get_expr_path() + scriptName = _get_script_name() # Select script name and experiments path sampleName = bckwdIC.scriptName # Name of sample currently running @@ -318,12 +339,14 @@ def noOfHistsFromTOFBinning(IC): def buildFinalWSName(procedure: str, IC): + scriptName = _get_script_name() # Format of corrected ws from last iteration name = scriptName + "_" + procedure + "_" + str(IC.noOfMSIterations) return name def completeYFitIC(yFitIC): + experimentPath = _get_expr_path() # Set directories for figures figSavePath = experimentPath / "figures" figSavePath.mkdir(exist_ok=True) From 2ed83d72e1d03127b2eca30276ad596021a62511 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:37:30 +0000 Subject: [PATCH 05/14] Fixed system tests to use latest changes - Changed the way system tests are run by using new functunality - Now tests use inputs from the same file by setting the inputs in mvesuvio config - Bootstrap and Jacknife tests are still ignored, to be corrected in the future --- .gitignore | 1 + mvesuvio/scripts/handle_config.py | 6 +++ mvesuvio/system_tests/test_analysis.py | 6 ++- mvesuvio/system_tests/test_bootstrap.py | 8 ++-- mvesuvio/system_tests/test_config/__init__.py | 0 .../expr_for_tests.py} | 9 +++- .../expr_for_tests_empty_backward.nxs} | Bin .../expr_for_tests_empty_forward.nxs} | Bin .../input_ws/expr_for_tests_raw_backward.nxs} | Bin .../input_ws/expr_for_tests_raw_forward.nxs} | Bin mvesuvio/system_tests/test_jackknife.py | 7 ++- mvesuvio/system_tests/test_yspace_fit.py | 40 +++++++++++------ mvesuvio/system_tests/test_yspace_fit_GC.py | 42 ++++++++++++------ mvesuvio/vesuvio_analysis/ICHelpers.py | 21 +++------ 14 files changed, 89 insertions(+), 51 deletions(-) create mode 100644 mvesuvio/system_tests/test_config/__init__.py rename mvesuvio/system_tests/{analysis_inputs.py => test_config/expr_for_tests.py} (93%) rename mvesuvio/system_tests/test_config/{experiments/test_expr/input_ws/test_expr_empty_backward.nxs => expr_for_tests/input_ws/expr_for_tests_empty_backward.nxs} (100%) rename mvesuvio/system_tests/test_config/{experiments/test_expr/input_ws/test_expr_empty_forward.nxs => expr_for_tests/input_ws/expr_for_tests_empty_forward.nxs} (100%) rename mvesuvio/system_tests/test_config/{experiments/test_expr/input_ws/test_expr_raw_backward.nxs => expr_for_tests/input_ws/expr_for_tests_raw_backward.nxs} (100%) rename mvesuvio/system_tests/test_config/{experiments/test_expr/input_ws/test_expr_raw_forward.nxs => expr_for_tests/input_ws/expr_for_tests_raw_forward.nxs} (100%) diff --git a/.gitignore b/.gitignore index 6b62fef1..e2379958 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ output_npz_for_testing vesuvio_analysis/core_functions/bootstrap_ws/ running_times.txt figures/ +mvesuvio/system_tests/test_config/expr_for_tests/output_files diff --git a/mvesuvio/scripts/handle_config.py b/mvesuvio/scripts/handle_config.py index 3b23dfda..97bfc01a 100644 --- a/mvesuvio/scripts/handle_config.py +++ b/mvesuvio/scripts/handle_config.py @@ -71,6 +71,12 @@ def read_config_var(var, throw_on_not_found=True): return result +def get_script_name(): + filename = os.path.basename(read_config_var("caching.inputs")) + scriptName = filename.removesuffix(".py") + return scriptName + + def setup_config_dir(config_dir): success = __mk_dir("config", config_dir) if success: diff --git a/mvesuvio/system_tests/test_analysis.py b/mvesuvio/system_tests/test_analysis.py index 07cfc576..9fb558ca 100644 --- a/mvesuvio/system_tests/test_analysis.py +++ b/mvesuvio/system_tests/test_analysis.py @@ -4,7 +4,7 @@ import numpy.testing as nptest from pathlib import Path from mvesuvio.scripts import handle_config -from mvesuvio.system_tests.analysis_inputs import ( +from mvesuvio.system_tests.test_config.expr_for_tests import ( LoadVesuvioBackParameters, LoadVesuvioFrontParameters, BackwardInitialConditions, @@ -13,6 +13,9 @@ BootstrapInitialConditions, UserScriptControls, ) +import mvesuvio +mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) +mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) @@ -38,7 +41,6 @@ def get_current_result(cls): def _run(cls): scattRes, yfitRes = runScript( UserScriptControls(), - "test_expr", LoadVesuvioBackParameters(ipFilesPath), LoadVesuvioFrontParameters(ipFilesPath), BackwardInitialConditions(ipFilesPath), diff --git a/mvesuvio/system_tests/test_bootstrap.py b/mvesuvio/system_tests/test_bootstrap.py index d61f09bc..b0ba957d 100644 --- a/mvesuvio/system_tests/test_bootstrap.py +++ b/mvesuvio/system_tests/test_bootstrap.py @@ -1,10 +1,13 @@ + +# This file needs updating once the bootstrap functunality is properly +# implemented in the mvesuvio package + from mvesuvio.vesuvio_analysis.run_script import runScript import unittest import numpy as np import numpy.testing as nptest from pathlib import Path from mvesuvio.system_tests.tests_IC import ( - scriptName, wsBackIC, wsFrontIC, bckwdIC, @@ -12,7 +15,6 @@ yFitIC, ) - class BootstrapInitialConditions: runBootstrap = True @@ -45,7 +47,7 @@ def _run_analysis(cls): yFitIC.symmetrisationFlag = True bootRes, noneRes = runScript( - userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True + userCtr, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True ) # TODO: Figure out why doing the two tests simultaneously fails the testing diff --git a/mvesuvio/system_tests/test_config/__init__.py b/mvesuvio/system_tests/test_config/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mvesuvio/system_tests/analysis_inputs.py b/mvesuvio/system_tests/test_config/expr_for_tests.py similarity index 93% rename from mvesuvio/system_tests/analysis_inputs.py rename to mvesuvio/system_tests/test_config/expr_for_tests.py index 4673db95..4f9dd111 100644 --- a/mvesuvio/system_tests/analysis_inputs.py +++ b/mvesuvio/system_tests/test_config/expr_for_tests.py @@ -107,7 +107,14 @@ def __init__(self, ipFilesPath): class YSpaceFitInitialConditions: - anything = True + showPlots = False + symmetrisationFlag = True + rebinParametersForYSpaceFit = "-20, 0.5, 20" # Needs to be symetric + fitModel = "SINGLE_GAUSSIAN" + runMinos = True + globalFit = None + nGlobalFitGroups = 4 + maskTypeProcedure = None class UserScriptControls: diff --git a/mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_empty_backward.nxs b/mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_empty_backward.nxs similarity index 100% rename from mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_empty_backward.nxs rename to mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_empty_backward.nxs diff --git a/mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_empty_forward.nxs b/mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_empty_forward.nxs similarity index 100% rename from mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_empty_forward.nxs rename to mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_empty_forward.nxs diff --git a/mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_raw_backward.nxs b/mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_raw_backward.nxs similarity index 100% rename from mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_raw_backward.nxs rename to mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_raw_backward.nxs diff --git a/mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_raw_forward.nxs b/mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_raw_forward.nxs similarity index 100% rename from mvesuvio/system_tests/test_config/experiments/test_expr/input_ws/test_expr_raw_forward.nxs rename to mvesuvio/system_tests/test_config/expr_for_tests/input_ws/expr_for_tests_raw_forward.nxs diff --git a/mvesuvio/system_tests/test_jackknife.py b/mvesuvio/system_tests/test_jackknife.py index 06eb2a61..558d96ee 100644 --- a/mvesuvio/system_tests/test_jackknife.py +++ b/mvesuvio/system_tests/test_jackknife.py @@ -1,10 +1,13 @@ + +# This file needs updating once the bootstrap functunality is properly +# implemented in the mvesuvio package + from mvesuvio.vesuvio_analysis.run_script import runScript import unittest import numpy as np import numpy.testing as nptest from pathlib import Path from mvesuvio.system_tests.tests_IC import ( - scriptName, wsBackIC, wsFrontIC, bckwdIC, @@ -42,7 +45,7 @@ def _run_analysis(cls): userCtr = UserScriptControls bootRes, noneRes = runScript( - userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True + userCtr, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True ) cls._jackBackSamples = bootRes["bckwdScat"].bootSamples diff --git a/mvesuvio/system_tests/test_yspace_fit.py b/mvesuvio/system_tests/test_yspace_fit.py index dde35c1e..e1376a34 100644 --- a/mvesuvio/system_tests/test_yspace_fit.py +++ b/mvesuvio/system_tests/test_yspace_fit.py @@ -5,15 +5,17 @@ import numpy as np import unittest import numpy.testing as nptest -from mvesuvio.system_tests.tests_IC import ( - scriptName, - wsBackIC, - wsFrontIC, - bckwdIC, - fwdIC, - yFitIC, +from mvesuvio.scripts import handle_config +from mvesuvio.system_tests.test_config.expr_for_tests import ( + LoadVesuvioBackParameters, + LoadVesuvioFrontParameters, + BackwardInitialConditions, + ForwardInitialConditions, + YSpaceFitInitialConditions, ) - +import mvesuvio +mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) +mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) np.set_printoptions(suppress=True, precision=8, linewidth=150) @@ -27,6 +29,22 @@ class UserScriptControls: fitInYSpace = "FORWARD" +bootIC = BootstrapInitialConditions +userCtr = UserScriptControls +ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) +wsBackIC = LoadVesuvioBackParameters(ipFilesPath) +wsFrontIC = LoadVesuvioFrontParameters(ipFilesPath) +bckwdIC = BackwardInitialConditions(ipFilesPath) +fwdIC = ForwardInitialConditions(ipFilesPath) +yFitIC = YSpaceFitInitialConditions() +scriptName = handle_config.get_script_name() + +fwdIC.noOfMSIterations = 1 +fwdIC.firstSpec = 164 +fwdIC.lastSpec = 175 +yFitIC.fitModel = "SINGLE_GAUSSIAN" + + class AnalysisRunner: _benchmarkResults = None _currentResults = None @@ -67,14 +85,10 @@ def _load_workspaces(cls): @classmethod def _run(cls): - bootIC = BootstrapInitialConditions - userCtr = UserScriptControls - yFitIC.fitModel = "SINGLE_GAUSSIAN" - cls.load_workspaces() # Load data to skip run of routine scattRes, yfitRes = runScript( - userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True + userCtr, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True ) cls._currentResults = yfitRes diff --git a/mvesuvio/system_tests/test_yspace_fit_GC.py b/mvesuvio/system_tests/test_yspace_fit_GC.py index 3c9d1ab7..b1bc908a 100644 --- a/mvesuvio/system_tests/test_yspace_fit_GC.py +++ b/mvesuvio/system_tests/test_yspace_fit_GC.py @@ -5,15 +5,17 @@ import numpy as np import unittest import numpy.testing as nptest -from mvesuvio.system_tests.tests_IC import ( - scriptName, - wsBackIC, - wsFrontIC, - bckwdIC, - fwdIC, - yFitIC, +from mvesuvio.scripts import handle_config +from mvesuvio.system_tests.test_config.expr_for_tests import ( + LoadVesuvioBackParameters, + LoadVesuvioFrontParameters, + BackwardInitialConditions, + ForwardInitialConditions, + YSpaceFitInitialConditions, ) - +import mvesuvio +mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) +mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) np.set_printoptions(suppress=True, precision=8, linewidth=150) @@ -27,6 +29,23 @@ class UserScriptControls: fitInYSpace = "FORWARD" +bootIC = BootstrapInitialConditions +userCtr = UserScriptControls +ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) +wsBackIC = LoadVesuvioBackParameters(ipFilesPath) +wsFrontIC = LoadVesuvioFrontParameters(ipFilesPath) +bckwdIC = BackwardInitialConditions(ipFilesPath) +fwdIC = ForwardInitialConditions(ipFilesPath) +yFitIC = YSpaceFitInitialConditions() +scriptName = handle_config.get_script_name() + +fwdIC.noOfMSIterations = 1 +fwdIC.firstSpec = 164 +fwdIC.lastSpec = 175 +yFitIC.fitModel = "GC_C4_C6" +yFitIC.symmetrisationFlag = False + + class AnalysisRunner: _benchmarkResults = None _currentResults = None @@ -67,15 +86,10 @@ def _load_workspaces(cls): @classmethod def _run(cls): - bootIC = BootstrapInitialConditions - userCtr = UserScriptControls - yFitIC.fitModel = "GC_C4_C6" - yFitIC.symmetrisationFlag = False - cls.load_workspaces() scattRes, yfitRes = runScript( - userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True + userCtr, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC, True ) cls._currentResults = yfitRes diff --git a/mvesuvio/vesuvio_analysis/ICHelpers.py b/mvesuvio/vesuvio_analysis/ICHelpers.py index 69d7012c..3be984bb 100644 --- a/mvesuvio/vesuvio_analysis/ICHelpers.py +++ b/mvesuvio/vesuvio_analysis/ICHelpers.py @@ -7,24 +7,14 @@ def _get_expr_path(): inputsPath = Path(handle_config.read_config_var("caching.inputs")) - scriptName = _get_script_name() + scriptName = handle_config.get_script_name() experimentPath = inputsPath.parent / scriptName return experimentPath -def _get_script_name(): - inputsPath = Path(handle_config.read_config_var("caching.inputs")) - scriptName = inputsPath.name.removesuffix(".py") - return scriptName - -# inputsPath = Path(handle_config.read_config_var("caching.inputs")) -# scriptName = inputsPath.name.removesuffix(".py") -# experimentPath = inputsPath.parent / scriptName - - def completeICFromInputs(IC, wsIC): """Assigns new methods to the initial conditions class from the inputs of that class""" - scriptName = _get_script_name() + scriptName = handle_config.get_script_name() assert ( IC.lastSpec > IC.firstSpec @@ -96,8 +86,7 @@ def completeICFromInputs(IC, wsIC): def setInputWSForSample(wsIC): experimentPath = _get_expr_path() - scriptName = _get_script_name() - print(scriptName.upper()) + scriptName = handle_config.get_script_name() inputWSPath = experimentPath / "input_ws" inputWSPath.mkdir(parents=True, exist_ok=True) @@ -228,7 +217,7 @@ def completeBootIC(bootIC, bckwdIC, fwdIC, yFitIC): def setBootstrapDirs(bckwdIC, fwdIC, bootIC, yFitIC): """Form bootstrap output data paths""" experimentPath = _get_expr_path() - scriptName = _get_script_name() + scriptName = handle_config.get_script_name() # Select script name and experiments path sampleName = bckwdIC.scriptName # Name of sample currently running @@ -339,7 +328,7 @@ def noOfHistsFromTOFBinning(IC): def buildFinalWSName(procedure: str, IC): - scriptName = _get_script_name() + scriptName = handle_config.get_script_name() # Format of corrected ws from last iteration name = scriptName + "_" + procedure + "_" + str(IC.noOfMSIterations) return name From d4777f0df6b76e40d936c11d52f9d9d84ca9ea36 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:49:34 +0000 Subject: [PATCH 06/14] Changed the way version is stored - The previous approach of writing the version to __init__.py overwrites the file - Safer to write version to unique file named _version.py - Don't really know how the versioning works on github so I am still figuring that out --- mvesuvio/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mvesuvio/__init__.py b/mvesuvio/__init__.py index 46ff9f3d..e93fa026 100644 --- a/mvesuvio/__init__.py +++ b/mvesuvio/__init__.py @@ -6,8 +6,7 @@ nuclear kinetic energies and moment distributions. """ -version_info = (0, 0, 0) -__version__ = ".".join(map(str, version_info)) +from mvesuvio._version import __version__ __project_url__ = "https://github.com/mantidproject/vesuvio" from mvesuvio.scripts import main From 0f08320b582b13a8da1a0e59cc6d62cf7aa7a68c Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:50:02 +0000 Subject: [PATCH 07/14] Updated git ignore to ignore version file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e2379958..8a29faeb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ vesuvio_analysis/core_functions/bootstrap_ws/ running_times.txt figures/ mvesuvio/system_tests/test_config/expr_for_tests/output_files +mvesuvio/_version.py From 1eee86407466ede061d83d7ff7c39d8defef7288 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:54:37 +0000 Subject: [PATCH 08/14] Revert "Updated git ignore to ignore version file" This reverts commit 0f08320b582b13a8da1a0e59cc6d62cf7aa7a68c. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8a29faeb..e2379958 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ vesuvio_analysis/core_functions/bootstrap_ws/ running_times.txt figures/ mvesuvio/system_tests/test_config/expr_for_tests/output_files -mvesuvio/_version.py From 45e9d1c16f94680227122bf85854e7a38cd530be Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:54:53 +0000 Subject: [PATCH 09/14] Revert "Changed the way version is stored" This reverts commit d4777f0df6b76e40d936c11d52f9d9d84ca9ea36. --- mvesuvio/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mvesuvio/__init__.py b/mvesuvio/__init__.py index e93fa026..46ff9f3d 100644 --- a/mvesuvio/__init__.py +++ b/mvesuvio/__init__.py @@ -6,7 +6,8 @@ nuclear kinetic energies and moment distributions. """ -from mvesuvio._version import __version__ +version_info = (0, 0, 0) +__version__ = ".".join(map(str, version_info)) __project_url__ = "https://github.com/mantidproject/vesuvio" from mvesuvio.scripts import main From c0806206b37a4d869b1e987d8c8a4ddd89d11e58 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 6 Mar 2024 11:57:00 +0000 Subject: [PATCH 10/14] Corrected version file --- mvesuvio/__init__.py | 3 +-- mvesuvio/_version.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 mvesuvio/_version.py diff --git a/mvesuvio/__init__.py b/mvesuvio/__init__.py index 46ff9f3d..e93fa026 100644 --- a/mvesuvio/__init__.py +++ b/mvesuvio/__init__.py @@ -6,8 +6,7 @@ nuclear kinetic energies and moment distributions. """ -version_info = (0, 0, 0) -__version__ = ".".join(map(str, version_info)) +from mvesuvio._version import __version__ __project_url__ = "https://github.com/mantidproject/vesuvio" from mvesuvio.scripts import main diff --git a/mvesuvio/_version.py b/mvesuvio/_version.py new file mode 100644 index 00000000..6c8e6b97 --- /dev/null +++ b/mvesuvio/_version.py @@ -0,0 +1 @@ +__version__ = "0.0.0" From 945a98f6a4579ec4370ce8508899f69237e22d15 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 13 Mar 2024 13:19:06 +0000 Subject: [PATCH 11/14] Fix missing libtiff5 and update Ubuntu - New version of mantid caused libtiff5 to go missing again - Pinned mantid to 6.8 - Updated Ubuntu just because --- environment.yml | 2 +- runner/docker/runner.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 7a211b35..803de10b 100644 --- a/environment.yml +++ b/environment.yml @@ -10,7 +10,7 @@ dependencies: - conda-wrappers - pre-commit==2.15 #review this - coverage - - mantid>=6.7 + - mantid==6.8 - matplotlib - iminuit - h5py diff --git a/runner/docker/runner.Dockerfile b/runner/docker/runner.Dockerfile index c545a169..8783c78a 100644 --- a/runner/docker/runner.Dockerfile +++ b/runner/docker/runner.Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:jammy-20231211.1 +FROM ubuntu:jammy-20240227 RUN apt-get update && apt-get install -y \ curl \ From 9573244947f47980c9323d1a4879f62c7778974e Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 13 Mar 2024 13:46:38 +0000 Subject: [PATCH 12/14] Set config of mvesuvio in single call --- mvesuvio/system_tests/test_analysis.py | 7 ++++--- mvesuvio/system_tests/test_yspace_fit.py | 6 ++++-- mvesuvio/system_tests/test_yspace_fit_GC.py | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mvesuvio/system_tests/test_analysis.py b/mvesuvio/system_tests/test_analysis.py index 9fb558ca..c54eb395 100644 --- a/mvesuvio/system_tests/test_analysis.py +++ b/mvesuvio/system_tests/test_analysis.py @@ -14,9 +14,10 @@ UserScriptControls, ) import mvesuvio -mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) -mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) - +mvesuvio.set_config( + ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files")), + inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py")) +) ipFilesPath = Path(handle_config.read_config_var("caching.ipfolder")) diff --git a/mvesuvio/system_tests/test_yspace_fit.py b/mvesuvio/system_tests/test_yspace_fit.py index e1376a34..fdae0eca 100644 --- a/mvesuvio/system_tests/test_yspace_fit.py +++ b/mvesuvio/system_tests/test_yspace_fit.py @@ -14,8 +14,10 @@ YSpaceFitInitialConditions, ) import mvesuvio -mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) -mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) +mvesuvio.set_config( + ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files")), + inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py")) +) np.set_printoptions(suppress=True, precision=8, linewidth=150) diff --git a/mvesuvio/system_tests/test_yspace_fit_GC.py b/mvesuvio/system_tests/test_yspace_fit_GC.py index b1bc908a..804cd082 100644 --- a/mvesuvio/system_tests/test_yspace_fit_GC.py +++ b/mvesuvio/system_tests/test_yspace_fit_GC.py @@ -14,8 +14,10 @@ YSpaceFitInitialConditions, ) import mvesuvio -mvesuvio.set_config(ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files"))) -mvesuvio.set_config(inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py"))) +mvesuvio.set_config( + ip_folder=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("config", "ip_files")), + inputs_file=str(Path(handle_config.VESUVIO_PACKAGE_PATH).joinpath("system_tests", "test_config", "expr_for_tests.py")) +) np.set_printoptions(suppress=True, precision=8, linewidth=150) From c58a16803210a66261e71f73471c9e2833bd1cf8 Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 13 Mar 2024 13:52:24 +0000 Subject: [PATCH 13/14] Removed usage of VESUVIOPROPERTIES --- .github/workflows/pr_workflow.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr_workflow.yml b/.github/workflows/pr_workflow.yml index a15da777..97d90296 100644 --- a/.github/workflows/pr_workflow.yml +++ b/.github/workflows/pr_workflow.yml @@ -38,7 +38,6 @@ jobs: # Runs System tests - name: Run mvesuvio Analysis System Tests run: | - export VESUVIOPROPERTIES=$(pwd)/mvesuvio/system_tests/test_config/vesuvio.user.properties python -m unittest discover -s ./mvesuvio/system_tests - name: Run mvesuvio Calibration Unit Tests @@ -54,4 +53,4 @@ jobs: # Report coverage #- name: Report Coverage - # run: coverage report \ No newline at end of file + # run: coverage report From feeb473cd95b9b3f65e729a2afec756c26a0aa7a Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 13 Mar 2024 14:12:00 +0000 Subject: [PATCH 14/14] Finished removing VESUVIOPROPERTIES - Deleted file that was being used to set paths for testing --- .github/workflows/ci_tests_nightly.yml | 3 +-- mvesuvio/system_tests/test_config/vesuvio.user.properties | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 mvesuvio/system_tests/test_config/vesuvio.user.properties diff --git a/.github/workflows/ci_tests_nightly.yml b/.github/workflows/ci_tests_nightly.yml index 0203624f..c0c16f5e 100644 --- a/.github/workflows/ci_tests_nightly.yml +++ b/.github/workflows/ci_tests_nightly.yml @@ -33,5 +33,4 @@ jobs: # Runs System tests - name: Run mvesuvio analysis system tests run: | - export VESUVIOPROPERTIES=$(pwd)/mvesuvio/system_tests/test_config/vesuvio.user.properties - python -m unittest discover -s ./mvesuvio/system_tests \ No newline at end of file + python -m unittest discover -s ./mvesuvio/system_tests diff --git a/mvesuvio/system_tests/test_config/vesuvio.user.properties b/mvesuvio/system_tests/test_config/vesuvio.user.properties deleted file mode 100644 index 7bf33e58..00000000 --- a/mvesuvio/system_tests/test_config/vesuvio.user.properties +++ /dev/null @@ -1,4 +0,0 @@ -# properties to be used in CI testing. -caching.location=mvesuvio/system_tests/test_config -caching.experiment=test_expr -caching.ipfolder=mvesuvio/config/ip_files