Loading .gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ after_script: build-image: stage: build variables: TAG: "0.1" TAG: "0.2" FORCE_TAGS: "false" when: manual script: Loading src/ReduceDictionary.py +62 −39 Original line number Diff line number Diff line Loading @@ -13,12 +13,15 @@ # individual run numbers, or ranges specified with a colon separator. # # shlex splits line space while ignoring spaces within quotes. May 2018 import os import shlex def LoadDictionary(filename): params_dictionary = {} run_nums = [] file = open(filename) add_all_runs_from_data_directory = False for line in file: line = line.strip(); line = line.rstrip(); Loading @@ -32,22 +35,43 @@ def LoadDictionary( filename ): elif words[1] == "False": params_dictionary[words[0]] = False elif words[0] == "run_nums": if words[1] == "data_directory": add_all_runs_from_data_directory = True else: run_list = ParseRunList(words[1]) for i in range(0,len(run_list)): run_nums.append(run_list[i]) run_nums = run_nums + run_list else: params_dictionary[words[0]] = words[1] else: print(("Syntax Error On Line: " + line)) if add_all_runs_from_data_directory: if len(run_nums) > 0: raise Exception("cannot mix run_nums as range and data_directory") if params_dictionary["data_directory"]: run_nums = ParseRunListFromFolder(params_dictionary["data_directory"]) else: raise Exception("data_directory must be set when using run_nums from data_directory") params_dictionary["run_nums"] = run_nums return params_dictionary; return params_dictionary # # Return a list of run numbers from a string containing a comma separated # list of individual run numbers, and/or ranges of run numbers specified # with a colon separator. # def ParseRunListFromFolder(folder): files = [] for f in os.listdir(folder): full_path = os.path.join(folder, f) if os.path.isfile(full_path): files.append(full_path) return files def ParseRunList(run_string): run_list = [] groups = run_string.split(",") Loading @@ -62,4 +86,3 @@ def ParseRunList( run_string ): run_list.append(str(run)) return run_list src/ReduceSCD_OneRun.py +5 −6 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ cylinder_length = params_dictionary[ "cylinder_length" ] read_UB = params_dictionary[ "read_UB" ] UB_filename = params_dictionary[ "UB_filename" ] shared_folder = os.environ.get("SNS_TOPAZ_SHARED_FOLDER", "/SNS/TOPAZ/shared") shared_folder = os.environ.get("SNS_TOPAZ_SHARED_FOLDER", "/SNS/TOPAZ/shared") fname = shared_folder+'/ProfileFitting/franz_coefficients_2017.dat' Loading Loading @@ -278,9 +277,9 @@ run_niggli_fit_profile_file = output_directory + "/" + str(run)+ "_Niggli_profil # #ipts_folder_name = GetIPTS(INSTRUMENT='TOPAZ', RunNumber=run) location = full_name.find("IPTS") location = full_name.find("/", location) ipts_folder_name = full_name[0: location + 1] #location = full_name.find("IPTS") #location = full_name.find("/", location) #ipts_folder_name = full_name[0: location + 1] # # Load the run data and find the total monitor counts Loading @@ -292,11 +291,11 @@ if subtract_bkg is not True: event_ws = FilterBadPulses(InputWorkspace=event_ws, LowerCutoff = 95) proton_charge = event_ws.getRun().getProtonCharge() * 1000.0 # get proton charge print("\n", run, " has integrated proton charge x 1000 of", proton_charge, "\n") print("\n", run, " has integrted proton charge x 1000 of", proton_charge, "\n") else: # Subtract no-sample background bkg_subtracted_event_fname = ipts_folder_name + "shared/bkg_data/" + short_filename + "_event_bkg.nxs" bkg_subtracted_event_fname = shared_folder + "/bkg_data/" + short_filename + "_event_bkg.nxs" if os.path.exists(bkg_subtracted_event_fname): print("\nProcessing File: " + bkg_subtracted_event_fname + " ......\n") event_ws=Load(Filename=bkg_subtracted_event_fname, LoadHistory=False) Loading src/topaz_reduction.py +2 −2 Original line number Diff line number Diff line Loading @@ -321,7 +321,7 @@ list=[] index = 0 for r_num in run_nums: list.append( ProcessThread() ) cmd = 'mantidpython ' + reduce_one_run_script + ' ' + config_file_name + ' ' + str(r_num) cmd = 'mantidpython -u ' + reduce_one_run_script + ' ' + config_file_name + ' ' + str(r_num) if slurm_queue_name is not None: console_file = output_directory + "/" + str(r_num) + "_output.txt" cmd = 'srun -p ' + slurm_queue_name + \ Loading Loading @@ -352,4 +352,4 @@ print("\n*********************************************************************** print("****************************** All DONE **********************************************") print("**************************************************************************************\n") print('Connfig file: ' + config_file_name) print('Config file: ' + config_file_name) Loading
.gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ after_script: build-image: stage: build variables: TAG: "0.1" TAG: "0.2" FORCE_TAGS: "false" when: manual script: Loading
src/ReduceDictionary.py +62 −39 Original line number Diff line number Diff line Loading @@ -13,12 +13,15 @@ # individual run numbers, or ranges specified with a colon separator. # # shlex splits line space while ignoring spaces within quotes. May 2018 import os import shlex def LoadDictionary(filename): params_dictionary = {} run_nums = [] file = open(filename) add_all_runs_from_data_directory = False for line in file: line = line.strip(); line = line.rstrip(); Loading @@ -32,22 +35,43 @@ def LoadDictionary( filename ): elif words[1] == "False": params_dictionary[words[0]] = False elif words[0] == "run_nums": if words[1] == "data_directory": add_all_runs_from_data_directory = True else: run_list = ParseRunList(words[1]) for i in range(0,len(run_list)): run_nums.append(run_list[i]) run_nums = run_nums + run_list else: params_dictionary[words[0]] = words[1] else: print(("Syntax Error On Line: " + line)) if add_all_runs_from_data_directory: if len(run_nums) > 0: raise Exception("cannot mix run_nums as range and data_directory") if params_dictionary["data_directory"]: run_nums = ParseRunListFromFolder(params_dictionary["data_directory"]) else: raise Exception("data_directory must be set when using run_nums from data_directory") params_dictionary["run_nums"] = run_nums return params_dictionary; return params_dictionary # # Return a list of run numbers from a string containing a comma separated # list of individual run numbers, and/or ranges of run numbers specified # with a colon separator. # def ParseRunListFromFolder(folder): files = [] for f in os.listdir(folder): full_path = os.path.join(folder, f) if os.path.isfile(full_path): files.append(full_path) return files def ParseRunList(run_string): run_list = [] groups = run_string.split(",") Loading @@ -62,4 +86,3 @@ def ParseRunList( run_string ): run_list.append(str(run)) return run_list
src/ReduceSCD_OneRun.py +5 −6 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ cylinder_length = params_dictionary[ "cylinder_length" ] read_UB = params_dictionary[ "read_UB" ] UB_filename = params_dictionary[ "UB_filename" ] shared_folder = os.environ.get("SNS_TOPAZ_SHARED_FOLDER", "/SNS/TOPAZ/shared") shared_folder = os.environ.get("SNS_TOPAZ_SHARED_FOLDER", "/SNS/TOPAZ/shared") fname = shared_folder+'/ProfileFitting/franz_coefficients_2017.dat' Loading Loading @@ -278,9 +277,9 @@ run_niggli_fit_profile_file = output_directory + "/" + str(run)+ "_Niggli_profil # #ipts_folder_name = GetIPTS(INSTRUMENT='TOPAZ', RunNumber=run) location = full_name.find("IPTS") location = full_name.find("/", location) ipts_folder_name = full_name[0: location + 1] #location = full_name.find("IPTS") #location = full_name.find("/", location) #ipts_folder_name = full_name[0: location + 1] # # Load the run data and find the total monitor counts Loading @@ -292,11 +291,11 @@ if subtract_bkg is not True: event_ws = FilterBadPulses(InputWorkspace=event_ws, LowerCutoff = 95) proton_charge = event_ws.getRun().getProtonCharge() * 1000.0 # get proton charge print("\n", run, " has integrated proton charge x 1000 of", proton_charge, "\n") print("\n", run, " has integrted proton charge x 1000 of", proton_charge, "\n") else: # Subtract no-sample background bkg_subtracted_event_fname = ipts_folder_name + "shared/bkg_data/" + short_filename + "_event_bkg.nxs" bkg_subtracted_event_fname = shared_folder + "/bkg_data/" + short_filename + "_event_bkg.nxs" if os.path.exists(bkg_subtracted_event_fname): print("\nProcessing File: " + bkg_subtracted_event_fname + " ......\n") event_ws=Load(Filename=bkg_subtracted_event_fname, LoadHistory=False) Loading
src/topaz_reduction.py +2 −2 Original line number Diff line number Diff line Loading @@ -321,7 +321,7 @@ list=[] index = 0 for r_num in run_nums: list.append( ProcessThread() ) cmd = 'mantidpython ' + reduce_one_run_script + ' ' + config_file_name + ' ' + str(r_num) cmd = 'mantidpython -u ' + reduce_one_run_script + ' ' + config_file_name + ' ' + str(r_num) if slurm_queue_name is not None: console_file = output_directory + "/" + str(r_num) + "_output.txt" cmd = 'srun -p ' + slurm_queue_name + \ Loading Loading @@ -352,4 +352,4 @@ print("\n*********************************************************************** print("****************************** All DONE **********************************************") print("**************************************************************************************\n") print('Connfig file: ' + config_file_name) print('Config file: ' + config_file_name)