diff --git a/addie/config.json b/addie/config.json
index fe6b97ed..157a4bf8 100644
--- a/addie/config.json
+++ b/addie/config.json
@@ -29,7 +29,6 @@
"max": 40,
"delta": 0.02
},
- "reduction_configuration_file": "",
"characterization_file": ""
},
"bragg": {
diff --git a/addie/main.py b/addie/main.py
index 101ec2fe..fc390e72 100644
--- a/addie/main.py
+++ b/addie/main.py
@@ -131,6 +131,9 @@ class MainWindow(QMainWindow):
intermediate_grouping = copy.deepcopy(grouping_dict)
output_grouping = copy.deepcopy(grouping_dict)
+ advanced_dict = {'push_bkg': False,
+ 'ele_size': "1.0"}
+
statusbar_display_time = 5000 # 5s
# external ui (use to make sure there is only one open at a time
diff --git a/addie/processing/mantid/launch_reduction.py b/addie/processing/mantid/launch_reduction.py
old mode 100644
new mode 100755
index e9ece38d..733d342a
--- a/addie/processing/mantid/launch_reduction.py
+++ b/addie/processing/mantid/launch_reduction.py
@@ -1,65 +1,8 @@
import os
-import traceback
-from mantidqt.utils.asynchronous import AsyncTask
+import json
from addie.processing.mantid.master_table.master_table_exporter import TableFileExporter as MantidTableExporter
-# Mantid Total Scattering integration
-# (https://github.com/neutrons/mantid_total_scattering)
-try:
- import total_scattering
- print("Mantid Total Scattering Version: ", total_scattering.__version__)
- from total_scattering.reduction.total_scattering_reduction import TotalScatteringReduction
- MANTID_TS_ENABLED = True
-except ImportError:
- print('total_scattering module not found. Functionality disabled')
- MANTID_TS_ENABLED = False
-
-
-class JobPool(object):
- task_output = None,
- running = None
- task_exc_type, task_exc, task_exc_stack = None, None, None
-
- def __init__(self, configurations):
- self.jobs = []
- for config in configurations:
- print("CONFIG:", config)
- self.jobs.append(AsyncTask(TotalScatteringReduction, args=(config,),
- success_cb=self.on_success, error_cb=self.on_error,
- finished_cb=self.on_finished))
-
- def _start_next(self):
- if self.jobs:
- self.running = self.jobs.pop(0)
- self.running.start()
- else:
- self.running = None
-
- def start(self):
- if not self.jobs:
- raise RuntimeError('Cannot start empty job list')
- self._start_next()
-
- def on_success(self, task_result):
- # TODO should emit a signal
- self.task_output = task_result.output
- print('SUCCESS!!! {}'.format(self.task_output))
-
- def on_error(self, task_result):
- # TODO should emit a signal
- print('ERROR!!!')
- self.task_exc_type = task_result.exc_type
- self.task_exc = task_result.exc_value
- self.task_exc_stack = traceback.extract_tb(task_result.stack)
- traceback.print_tb(task_result.stack)
- print(task_result)
-
- def on_finished(self):
- '''Both success and failure call this method afterwards'''
- # TODO should emit a signal
- self._start_next() # kick off the next one in the pool
-
def run_mantid(parent):
num_rows = parent.processing_ui.h3_table.rowCount()
@@ -87,28 +30,56 @@ def run_mantid(parent):
filename = os.path.join(os.path.expanduser('~'),'.mantid' ,'JSON_output',dictionary['Title'] +'_'+ str(row) + '.json')
exporter.export(filename,row)
print("Row",row,"Successfully output to",filename)
-
- # append the individual rows to input list (reduction_inputs)
- reduction_inputs = []
- for row in range(num_rows):
- if not exporter.isActive(row):
- print('skipping row {} - inactive'.format(row + 1)) # REMOVE?
- continue
- print('Will be running row {} for reduction'.format(row + 1)) # TODO should be debug logging
- json_input = exporter.retrieve_row_info(row)[0]
- reduction_input = exporter.convert_from_row_to_reduction(json_input)
- if not reduction_input:
- return
- reduction_inputs.append(reduction_input)
- if len(reduction_inputs) == 0:
- print('None of the rows were activated')
- return
-
- # locate total scattering script
- if MANTID_TS_ENABLED:
- pool = JobPool(reduction_inputs)
- pool.start()
- else:
- # TODO should be on the status bar
- print('total_scattering module not found. Functionality disabled')
- return
+ with open(filename) as json_file:
+ data_tmp = json.load(json_file)
+ dict_out_tmp = {}
+ container_type=""
+ for key, item in data_tmp.items():
+ if "Sample" in key:
+ sample_tmp = {}
+ for key_s, item_s in item.items():
+ if "Density" not in key_s:
+ if "Material" in key_s:
+ string_tmp = item_s.replace("(", "").replace(")", "")
+ sample_tmp[key_s] = string_tmp
+ else:
+ sample_tmp[key_s] = item_s
+ if "Geometry" in key_s:
+ known_shape = ["PAC03", "PAC06", "PAC08",
+ "PAC10", "QuartzTube03"]
+ if item_s["Shape"] in known_shape:
+ shape_tmp = "Cylinder"
+ container_type = item_s["Shape"]
+ else:
+ shape_tmp = item_s["Shape"]
+ geo_dict_tmp = {}
+ for key_tmp in item_s:
+ geo_dict_tmp[key_tmp] = item_s[key_tmp]
+ geo_dict_tmp["Shape"] = shape_tmp
+ sample_tmp[key_s] = geo_dict_tmp
+ else:
+ sample_tmp["MassDensity"] = float(item_s["MassDensity"])
+ dict_out_tmp[key] = sample_tmp
+ elif "Normalization" in key or "Normalisation" in key:
+ van_tmp = {}
+ for key_v, item_v in item.items():
+ if "Density" not in key_v:
+ if "Material" in key_v:
+ string_tmp = item_v.replace("(", "").replace(")", "")
+ van_tmp[key_v] = string_tmp
+ else:
+ van_tmp[key_v] = item_v
+ else:
+ van_tmp["MassDensity"] = float(item_v["MassDensity"])
+ dict_out_tmp[key] = van_tmp
+ else:
+ dict_out_tmp[key] = item
+ if container_type:
+ dict_out_tmp["Environment"] = { "Name": "InAir",
+ "Container": container_type}
+ filename_to_run = os.path.join(os.path.expanduser('~'),'.mantid' ,'JSON_output', 'running_tmp.json')
+ with open(filename_to_run, 'w') as outfile:
+ json.dump(dict_out_tmp, outfile, indent=2)
+ _script_to_run = "bash /SNS/NOM/shared/scripts/mantidtotalscattering/run_mts.sh " + filename_to_run
+ parent.launch_job_manager(job_name='MantidTotalScattering',
+ script_to_run=_script_to_run)
diff --git a/addie/processing/mantid/make_calibration_handler/make_calibration.py b/addie/processing/mantid/make_calibration_handler/make_calibration.py
old mode 100644
new mode 100755
index b1133870..4e61d21f
--- a/addie/processing/mantid/make_calibration_handler/make_calibration.py
+++ b/addie/processing/mantid/make_calibration_handler/make_calibration.py
@@ -3,7 +3,6 @@
from qtpy.QtWidgets import (QMainWindow, QComboBox, QFileDialog, QHBoxLayout, QLabel, QDateEdit, QLineEdit, QPushButton,
QTableWidgetItem, QVBoxLayout, QWidget)
from addie.utilities import load_ui
-from addie.widgets.filedialog import get_save_file
from qtpy import QtCore
import datetime
@@ -34,7 +33,7 @@ def __init__(self, parent=None):
class MakeCalibrationWindow(QMainWindow):
- table_column_width = [60, 250, 350, 350, 90, 300]
+ table_column_width = [60, 250, 600, 90, 300]
table_row_height = 85
entry_level = 0
@@ -49,9 +48,6 @@ class MakeCalibrationWindow(QMainWindow):
"calibration_value",
"calibration_browser",
"calibration_browser_value",
- "vanadium_value",
- "vanadium_browser",
- "vanadium_browser_value",
"date",
"output_dir_browser",
"output_dir_value",
@@ -175,17 +171,6 @@ def get_run_number_from_nexus_file_name(self, base_nexus_name=''):
return result.group(1)
return None
- def vanadium_browser_clicked(self, entry=""):
- sample_type = "Vanadium"
- value_ui = self.master_list_ui[entry].vanadium_browser_value
-
- [_file, run_number] = self._general_browser_clicked(sample_type=sample_type,
- value_ui=value_ui)
- if _file:
- self.master_list_value[entry]["vanadium_browser"] = _file
- self.master_list_ui[entry].vanadium_value.setText(str(run_number))
- self.check_run_calibration_status()
-
def calibration_browser_clicked(self, entry=""):
sample_type = "Calibration"
value_ui = self.master_list_ui[entry].calibration_browser_value
@@ -273,41 +258,14 @@ def __insert_new_row(self, row=-1):
col1_widget.setLayout(verti_layout)
self.ui.tableWidget.setCellWidget(row, col, col1_widget)
- # new column - Vanadium
- col = 3
- # first row
- # first row
- label = QLabel("Run #:")
- vana_value = QLineEdit("")
- vana_value.returnPressed.connect(lambda entry=_name: self.run_entered(entry))
- vana_browser_button = QPushButton("Browse...")
- vana_browser_button.setMinimumWidth(button_width)
- vana_browser_button.setMaximumWidth(button_width)
- vana_browser_button.clicked.connect(lambda state, entry=_name: self.vanadium_browser_clicked(entry))
- first_row = QHBoxLayout()
- first_row.addWidget(label)
- first_row.addWidget(vana_value)
- first_row.addWidget(vana_browser_button)
- first_row_widget = QWidget()
- first_row_widget.setLayout(first_row)
- # second row
- vana_browser_button_value = QLabel("N/A")
-
- verti_layout = QVBoxLayout()
- verti_layout.addWidget(first_row_widget)
- verti_layout.addWidget(vana_browser_button_value)
- col1_widget = QWidget()
- col1_widget.setLayout(verti_layout)
- self.ui.tableWidget.setCellWidget(row, col, col1_widget)
-
# new column - date
- col = 4
+ col = 3
date = QDateEdit()
date.setDate(self.master_date_value)
self.ui.tableWidget.setCellWidget(row, col, date)
# new column - output dir
- col = 5
+ col = 4
browser_button = QPushButton("Browse...")
browser_button.setMinimumWidth(button_width)
browser_button.setMaximumWidth(button_width)
@@ -329,18 +287,13 @@ def __insert_new_row(self, row=-1):
calibration_value=cali_value,
calibration_browser=cali_browser_button,
calibration_browser_value=cali_browser_button_value,
- vanadium_value=vana_value,
- vanadium_browser=vana_browser_button,
- vanadium_browser_value=vana_browser_button_value,
date=date,
output_dir_browser=browser_button,
output_dir_value=browser_value,
output_reset=reset)
self.master_list_ui[_name] = list_local_ui
- list_local_name = dict(vanadium_run_number="",
- vanadium_browser="",
- calibration_run_number="",
+ list_local_name = dict(calibration_run_number="",
calibration_browser="")
self.master_list_value[_name] = list_local_name
@@ -359,10 +312,6 @@ def _check_status_of_row(self, row=-1):
if not self._check_local_column(run_value = local_list_ui.calibration_value):
return False
- # Vanadium column
- if not self._check_local_column(run_value=local_list_ui.vanadium_value):
- return False
-
# output dir
browse_label = local_list_ui.output_dir_value
if browse_label.text() == 'N/A':
@@ -395,15 +344,37 @@ def check_run_calibration_status(self):
self.ui.run_calibration_button.setEnabled(_status)
def run_calibration_button_clicked(self):
- # make dictionary of all infos
+ instr_dict = {"NOM": "NOMAD",
+ "PG3": "PG3}"}
o_dict = MakeCalibrationDictionary(parent=self)
- _file, _ = get_save_file(parent=self,
- caption="Select where and name of json file to create...",
- # directory = '/SNS/users/ntm/',
- filter={'json (*.json)':'json'})
- if _file:
- with open(_file, 'w') as fp:
- simplejson.dump(o_dict.dictionary, fp, indent=2, ignore_nan=True)
+ for calibrant in o_dict.dictionary['Calibrants'].keys():
+ calib_tmp_dict = o_dict.dictionary['Calibrants'][calibrant]
+ calib_file = calib_tmp_dict['Filename']
+ calib_date = calib_tmp_dict['Date'].replace("_", "-")
+ calib_senv = calib_tmp_dict['SampleEnvironment']
+ calib_outd = calib_tmp_dict['CalDirectory']
+ if "/" in calib_file:
+ instrument_name = calib_file.split("/")[2]
+ else:
+ instrument_name = calib_file.split("_")[0]
+ calib_control_file = os.path.join('/SNS/', instrument_name,
+ 'shared/CALIBRATION/Group_calib_scripts',
+ 'control_' + calibrant + ".dat")
+ with open(calib_control_file, "w") as calib_f:
+ calib_f.write("{0:<25s}:: {1:s}\n".format("diamond file", calib_file))
+ calib_f.write("{0:<25s}:: {1:s}\n".format("instrument",
+ instr_dict[instrument_name]))
+ calib_f.write("{0:<25s}:: {1:s}\n".format("date", calib_date))
+ calib_f.write("{0:<25s}:: {1:s}\n".format("sample environment",
+ calib_senv))
+ calib_f.write("{0:<25s}:: {1:s}\n".format("output directory",
+ calib_outd))
+ running_script = os.path.join('/SNS/', instrument_name,
+ 'shared/CALIBRATION/Group_calib_scripts',
+ 'running')
+ running_script += (" " + calib_control_file)
+ self.parent.launch_job_manager(job_name='MakeCalibration',
+ script_to_run=running_script)
def closeEvent(self, c):
self.parent.make_calibration_ui = None
@@ -452,15 +423,6 @@ def built_dict(self):
else:
cali_filename = None
- # vanadium run number
- vana_run_number = str(local_list_ui.vanadium_value.text())
-
- # vanadium full file name (if any)
- if str(local_list_ui.vanadium_browser.text()) != "N/A":
- vana_filename = str(local_list_value["vanadium_browser"])
- else:
- vana_filename = None
-
# local date
_date = local_list_ui.date.date()
[year, month, day] = _date.getDate()
@@ -472,14 +434,7 @@ def built_dict(self):
# local output dir
local_output_dir = str(local_list_ui.output_dir_value.text())
- # save data in vanadium dict
- vanadium_dict = {}
- vanadium_dict["RunNumber"] = vana_run_number
- if vana_filename:
- vanadium_dict["Filename"] = vana_filename
-
cali_dict = {}
- cali_dict["Vanadium"] = vanadium_dict
if cali_filename:
cali_dict["Filename"] = cali_filename
diff --git a/addie/processing/mantid/master_table/geometry_handler.py b/addie/processing/mantid/master_table/geometry_handler.py
index 85fb5da0..98ef72f5 100644
--- a/addie/processing/mantid/master_table/geometry_handler.py
+++ b/addie/processing/mantid/master_table/geometry_handler.py
@@ -43,7 +43,12 @@ def _sphere_csg_radius(value):
table2mantid = {
"Cylinder": _table2mantid_cylinder,
"Hollow Cylinder": _table2mantid_hollow_cylinder,
- "Sphere": _table2mantid_sphere
+ "Sphere": _table2mantid_sphere,
+ "PAC03": _table2mantid_cylinder,
+ "PAC06": _table2mantid_cylinder,
+ "PAC08": _table2mantid_cylinder,
+ "PAC10": _table2mantid_cylinder,
+ "QuartzTube03": _table2mantid_cylinder
}
@@ -110,7 +115,9 @@ def init_widgets_content(self):
height = 'N/A'
radius2 = 'N/A'
- if self.shape_selected.lower() == 'cylinder':
+ cylinder_sam = ['cylinder', 'pac03', 'pac06', 'pac08', 'pac10',
+ 'quartztube03']
+ if self.shape_selected.lower() in cylinder_sam:
radius = self.__get_label_value('radius')
height = self.__get_label_value('height')
elif self.shape_selected.lower() == 'sphere':
@@ -134,7 +141,9 @@ def init_widgets_layout(self):
self.shape_selected = shape_ui.currentText()
# hide/show widgets according to shape selected
- if self.shape_selected.lower() == 'cylinder':
+ cylinder_sam = ['cylinder', 'pac03', 'pac06', 'pac08', 'pac10',
+ 'quartztube03']
+ if self.shape_selected.lower() in cylinder_sam:
# change label of first label
self.ui.radius_label.setText("Radius")
# hide radius 2 widgets
@@ -179,7 +188,9 @@ def check_save_button(self):
radius2 = str(self.ui.radius2_value.text())
height = str(self.ui.height_value.text())
- if self.shape_selected.lower() == 'cylinder':
+ cylinder_sam = ['cylinder', 'pac03', 'pac06', 'pac08', 'pac10',
+ 'quartztube03']
+ if self.shape_selected.lower() in cylinder_sam:
if is_number(radius) and is_number(height):
save_button_status = True
elif self.shape_selected.lower() == 'sphere':
@@ -197,7 +208,9 @@ def accept(self):
radius2 = 'N/A'
height = 'N/A'
- if self.shape_selected.lower() == 'cylinder':
+ cylinder_sam = ['cylinder', 'pac03', 'pac06', 'pac08', 'pac10',
+ 'quartztube03']
+ if self.shape_selected.lower() in cylinder_sam:
height = str(self.ui.height_value.text())
elif self.shape_selected.lower() == 'sphere':
pass
diff --git a/addie/processing/mantid/master_table/master_table_exporter.py b/addie/processing/mantid/master_table/master_table_exporter.py
old mode 100644
new mode 100755
index 997fe186..86fb81df
--- a/addie/processing/mantid/master_table/master_table_exporter.py
+++ b/addie/processing/mantid/master_table/master_table_exporter.py
@@ -4,6 +4,7 @@
import simplejson
import numpy as np
import os
+import re
from qtpy.QtCore import Qt
@@ -89,22 +90,18 @@ def __init__(self, parent=None):
self.outputdir = self.parent.output_folder
if not self.parent.reduction_configuration:
SaveReductionConfiguration(parent.reduction_configuration_ui, grand_parent=parent)
- if self.parent.reduction_configuration['initial'] is False:
- self.intermediate_grouping_file = str(self.parent.processing_ui.calibration_file.text())
- if self.intermediate_grouping_file == 'N/A':
- self.intermediate_grouping_file = ''
+ if not self.parent.reduction_configuration['initial']:
+ self.intermediate_grouping_file = ''
else:
self.intermediate_grouping_file = self.parent.intermediate_grouping['filename']
- if self.parent.reduction_configuration['output'] is False:
- self.output_grouping_file = str(self.parent.processing_ui.calibration_file.text())
- if self.output_grouping_file == 'N/A':
- self.output_grouping_file = ''
+ if not self.parent.reduction_configuration['output']:
+ self.output_grouping_file = ''
else:
self.output_grouping_file = self.parent.output_grouping['filename']
self.calibration = str(self.parent.processing_ui.calibration_file.text())
- self.NA_list = ["None","N/A","",np.NaN]
+ self.NA_list = ["None", "N/A", "", np.NaN]
def export(self, filename='', row=None):
"""create dictionary of all rows unless `row` argument is specified,
@@ -120,7 +117,7 @@ def export(self, filename='', row=None):
# put together the data to write out
if row is not None:
- dictionary,activate = self.retrieve_row_info(row)
+ dictionary, activate = self.retrieve_row_info(row)
else:
dictionary = self.retrieve_row_infos()
# create the directory if it doesn't already exist
@@ -282,7 +279,9 @@ def _retrieve_element_infos(self, element='sample', row=-1):
self.parent.master_table_list_ui[key][element]['geometry']['radius']['value'].text())
radius2 = 'N/A'
height = 'N/A'
- if shape in ['Cylinder', 'Hollow Cylinder']:
+ height_avail = ['Cylinder', 'Hollow Cylinder', 'PAC03', 'PAC06',
+ 'PAC08', 'PAC10', 'QuartzTube03']
+ if shape in height_avail:
height = str(
self.parent.master_table_list_ui[key][element]['geometry']['height']['value'].text())
elif shape == 'Sphere':
@@ -472,8 +471,12 @@ def retrieve_row_info(self, row):
self.advanced_params = {"push_data_positive": False,
"abs_ms_ele_size": "1.0"}
- _export_dictionary_sample["AbsMSParameters"] = {"ElementSize": self.advanced_params["abs_ms_ele_size"]}
- _export_dictionary_normalization["AbsMSParameters"] = {"ElementSize": self.advanced_params["abs_ms_ele_size"]}
+ ele_size_tmp = [float(item) for item in re.split(',| ', self.advanced_params["abs_ms_ele_size"])]
+ if len(ele_size_tmp) == 1:
+ _export_dictionary_sample["AbsMSParameters"] = {"ElementSize": ele_size_tmp[0]}
+ else:
+ _export_dictionary_sample["AbsMSParameters"] = {"ElementSize": ele_size_tmp[:2]}
+ _export_dictionary_normalization["AbsMSParameters"] = {"ElementSize": ele_size_tmp[0]}
if len(self.scattering_lower) > 0 and len(self.scattering_upper) > 0:
bank1_list = [self.scattering_lower[0], self.scattering_upper[0]]
@@ -502,7 +505,7 @@ def retrieve_row_info(self, row):
'CacheDir': self.cachedir,
'OutputDir': self.outputdir,
"Merging": {
- "QBinning": [self.QBin_min,self.QBin_del,self.QBin_max],
+ "QBinning": [self.QBin_min, self.QBin_del, self.QBin_max],
"SumBanks": [],
"Characterizations": "",
"Grouping": {
@@ -525,7 +528,7 @@ def retrieve_row_info(self, row):
dictionary = self.delete_empty_rows(dictionary)
dictionary.pop('Activate')
- return dictionary,activate
+ return dictionary, activate
#Shouldn't delete the main category
def delete_empty_rows(self, dictionary):
@@ -578,7 +581,7 @@ def retrieve_row_infos(self):
# force 3 digits index (to make sure loading back the table will be
# done in the same order)
full_export_dictionary["{:03}".format(
- row)],activate = self.retrieve_row_info(row)
+ row)], activate = self.retrieve_row_info(row)
return full_export_dictionary
@@ -760,16 +763,19 @@ def pre_validator(self, json_input):
for key in necessary_keys:
if key not in json_input:
- print(f"Key '{key}' not found in the input. We cannot continue.")
+ print("Key {0:s} not found in the input. We cannot continue.".format(key))
return False
else:
if not json_input[key]:
- print(f"No valid key found in {key}. We cannot continue.")
+ print("No valid key found in {0:s}. We cannot continue.".format(key))
return False
else:
for key_1, item_1 in json_input[key].items():
if item_1 in invalid_values:
- print(f"Invalid value '{item_1}' given for key '{key_1}' of '{key}'. We cannot continue.")
+ str_tmp = "Invalid value '{0:s}' given ".format(item_1)
+ str_tmp += "for key '{0:s}' ".format(key_1)
+ str_tmp += "of '{0:s}'. We cannot continue.".format(key)
+ print(str_tmp)
return False
return True
diff --git a/addie/processing/mantid/master_table/master_table_loader.py b/addie/processing/mantid/master_table/master_table_loader.py
old mode 100644
new mode 100755
index b7b00774..cd945e72
--- a/addie/processing/mantid/master_table/master_table_loader.py
+++ b/addie/processing/mantid/master_table/master_table_loader.py
@@ -5,7 +5,7 @@
import copy
import simplejson
-from qtpy.QtWidgets import QDialog # , QLabel
+from qtpy.QtWidgets import QDialog
from addie.utilities import load_ui
from qtpy import QtCore, QtGui
@@ -267,17 +267,18 @@ def _retrieve_element_dict(self, element='Sample', source_row_entry={}):
_target_row_entry['inelastic_correction'] = None
if element == 'Sample':
_target_row_entry["resonance"] = {}
- _target_row_entry["resonance"]["axis"] = _source_entry["Resonance"]["Axis"]
- if isinstance(_source_entry["Resonance"]["LowerLimits"], list):
- lower_tmp = ",".join([str(item) for item in _source_entry["Resonance"]["LowerLimits"]])
- else:
- lower_tmp = _source_entry["Resonance"]["LowerLimits"]
- if isinstance(_source_entry["Resonance"]["UpperLimits"], list):
- upper_tmp = ",".join([str(item) for item in _source_entry["Resonance"]["UpperLimits"]])
- else:
- upper_tmp = _source_entry["Resonance"]["UpperLimits"]
- _target_row_entry["resonance"]["lower"] = lower_tmp
- _target_row_entry["resonance"]["upper"] = upper_tmp
+ if "Resonance" in _source_entry:
+ _target_row_entry["resonance"]["axis"] = _source_entry["Resonance"]["Axis"]
+ if isinstance(_source_entry["Resonance"]["LowerLimits"], list):
+ lower_tmp = ",".join([str(item) for item in _source_entry["Resonance"]["LowerLimits"]])
+ else:
+ lower_tmp = _source_entry["Resonance"]["LowerLimits"]
+ if isinstance(_source_entry["Resonance"]["UpperLimits"], list):
+ upper_tmp = ",".join([str(item) for item in _source_entry["Resonance"]["UpperLimits"]])
+ else:
+ upper_tmp = _source_entry["Resonance"]["UpperLimits"]
+ _target_row_entry["resonance"]["lower"] = lower_tmp
+ _target_row_entry["resonance"]["upper"] = upper_tmp
return _target_row_entry
@@ -372,6 +373,14 @@ def load(self):
nbr_groups = o_grouping.get_number_of_groups()
self.parent.output_grouping['nbr_groups'] = nbr_groups
+ if "AbsMSParameters" in _source_row_entry["Sample"]:
+ ele_size_val = _source_row_entry["Sample"]["AbsMSParameters"]["ElementSize"]
+ if type(ele_size_val) == list:
+ ele_size_val = ",".join([str(item) for item in ele_size_val])
+ else:
+ ele_size_val = str(ele_size_val)
+ self.parent.advanced_dict["ele_size"] = ele_size_val
+
first_entry = False
o_table_ui_loader = FromDictionaryToTableUi(parent=self.parent)
diff --git a/addie/processing/mantid/master_table/reduction_configuration_handler.py b/addie/processing/mantid/master_table/reduction_configuration_handler.py
old mode 100644
new mode 100755
index b709de55..d0e102d9
--- a/addie/processing/mantid/master_table/reduction_configuration_handler.py
+++ b/addie/processing/mantid/master_table/reduction_configuration_handler.py
@@ -81,6 +81,8 @@ def init_widgets(self):
self.ui.output_browse_value.setText(output_grouping['filename'])
self.ui.output_browse_groups_value.setText(str(output_grouping['nbr_groups']))
+ self.ui.abs_ms_ele_size.setText(self.parent.advanced_dict["ele_size"])
+
self.init_global_key_value_widgets()
self.update_key_value_widgets()
@@ -392,7 +394,6 @@ def __init__(self, parent=None, grand_parent=None):
data = simplejson.load(f)
pdf_q_range = data['pdf']['q_range']
pdf_r_range = data['pdf']['r_range']
- pdf_reduction_configuration_file = data["pdf"]["reduction_configuration_file"]
pdf_characterization_file = data["pdf"]["characterization_file"]
bragg_characterization_file = data["bragg"]["characterization_file"]
@@ -405,7 +406,6 @@ def __init__(self, parent=None, grand_parent=None):
else:
pdf_q_range = grand_parent.reduction_configuration['pdf']['q_range']
pdf_r_range = grand_parent.reduction_configuration['pdf']['r_range']
- pdf_reduction_configuration_file = grand_parent.reduction_configuration['pdf']['reduction_configuration_file']
pdf_characterization_file = grand_parent.reduction_configuration['pdf']['characterization_file']
bragg_characterization_file = grand_parent.reduction_configuration["bragg"]["characterization_file"]
@@ -414,6 +414,7 @@ def __init__(self, parent=None, grand_parent=None):
#calibration_file = grand_parent.reduction_configuration["pdf_bragg"]["calibration_file"]
push_data_positive = grand_parent.reduction_configuration["advanced"]["push_data_positive"]
+ abs_ms_ele_size = grand_parent.reduction_configuration["advanced"]["abs_ms_ele_size"]
# PDF and Bragg
#self._set_text_value(ui=parent.ui.calibration_file, value=calibration_file)
@@ -425,7 +426,6 @@ def __init__(self, parent=None, grand_parent=None):
self._set_text_value(ui=parent.ui.pdf_r_range_min, value=pdf_r_range["min"])
self._set_text_value(ui=parent.ui.pdf_r_range_max, value=pdf_r_range["max"])
self._set_text_value(ui=parent.ui.pdf_r_range_delta, value=pdf_r_range["delta"])
- self._set_text_value(ui=parent.ui.pdf_reduction_configuration_file, value=pdf_reduction_configuration_file)
self._set_text_value(ui=parent.ui.pdf_characterization_file, value=pdf_characterization_file)
# Bragg
@@ -471,8 +471,6 @@ def __init__(self, parent=None, grand_parent=None):
pdf_r_range_max = self._get_text_value(parent.ui.pdf_r_range_max)
pdf_r_range_delta = self._get_text_value(parent.ui.pdf_r_range_delta)
- pdf_reduction_configuration_file = self._get_text_value(parent.ui.pdf_reduction_configuration_file)
-
bragg_characterization_file = self._get_text_value(parent.ui.bragg_characterization_file)
bragg_number_of_bins = self._get_text_value(parent.ui.bragg_number_of_bins)
bragg_wavelength_min = self._get_text_value(parent.ui.bragg_wavelength_min)
@@ -494,8 +492,6 @@ def __init__(self, parent=None, grand_parent=None):
pdf_r_range_max = '40.0'
pdf_r_range_delta = '0.02'
- pdf_reduction_configuration_file = ''
-
bragg_characterization_file = ''
bragg_number_of_bins = '-6000'
bragg_wavelength_min = '0.1'
@@ -514,7 +510,6 @@ def __init__(self, parent=None, grand_parent=None):
'max': pdf_r_range_max,
'delta': pdf_r_range_delta}
- pdf_reduction_configuration['reduction_configuration_file'] = pdf_reduction_configuration_file
reduction_configuration['pdf'] = pdf_reduction_configuration
bragg_reduction_configuration["characterization_file"] = bragg_characterization_file
diff --git a/addie/processing/mantid/master_table/self_scattering_handler.py b/addie/processing/mantid/master_table/self_scattering_handler.py
old mode 100644
new mode 100755
diff --git a/addie/processing/mantid/master_table/table_row_handler.py b/addie/processing/mantid/master_table/table_row_handler.py
old mode 100644
new mode 100755
index 45c5834a..32e6fa98
--- a/addie/processing/mantid/master_table/table_row_handler.py
+++ b/addie/processing/mantid/master_table/table_row_handler.py
@@ -75,7 +75,7 @@ def update_ui(ui=None, new_list=[]):
# mult. scat. correction
mult_scat_correction_ui = self.main_window.master_table_list_ui[key][data_type]['mult_scat_correction']
- list_mult_scat_correction = self.get_multi_scat_correction_list(shape=shape_index,section='Sample')
+ list_mult_scat_correction = self.get_multi_scat_correction_list(shape=shape_index)
update_ui(ui=mult_scat_correction_ui, new_list=list_mult_scat_correction)
_enabled_radius_1 = True
@@ -83,8 +83,21 @@ def update_ui(ui=None, new_list=[]):
_enabled_height = True
_label_radius_1 = 'Radius'
_label_radius_2 = 'Outer Radius'
- if shape_index == 0: # cylinder
+ cylinder_sam = [0, 3, 4, 5, 6, 7]
+ if shape_index in cylinder_sam: # cylinder
_enabled_radius_2 = False
+ if shape_index == 3:
+ sam_radius_val = "0.135"
+ elif shape_index == 4:
+ sam_radius_val = "0.295"
+ elif shape_index == 5:
+ sam_radius_val = "0.385"
+ elif shape_index == 6:
+ sam_radius_val = "0.460"
+ elif shape_index == 7:
+ sam_radius_val = "0.14"
+ else:
+ sam_radius_val = "N/A"
elif shape_index == 1: # sphere
_enabled_height = False
_enabled_radius_2 = False
@@ -92,6 +105,8 @@ def update_ui(ui=None, new_list=[]):
_label_radius_1 = 'Inner Radius'
self.main_window.master_table_list_ui[key][data_type]['geometry']['radius']['value'].setVisible(_enabled_radius_1)
+ if shape_index in cylinder_sam: # cylinder
+ self.main_window.master_table_list_ui[key][data_type]['geometry']['radius']['value'].setText(sam_radius_val)
self.main_window.master_table_list_ui[key][data_type]['geometry']['radius2']['value'].setVisible(_enabled_radius_2)
self.main_window.master_table_list_ui[key][data_type]['geometry']['height']['value'].setVisible(_enabled_height)
@@ -137,10 +152,6 @@ def inelastic_correction_changed(self, value=None, key=None, data_type='sample')
sample_norm_column=INDEX_OF_INELASTIC_CORRECTION)
self.main_window.check_master_table_column_highlighting(column=column)
- # inelastic_correction = info['inelastic_correction'].currentText()
- # if inelastic_correction not in ["None", None]:
- # PlaczekHandler(parent=self.main_window, key=key, data_type=data_type)
-
def multi_scattering_correction(self, value='', key=None, data_type='sample'):
# change state of other widgets of the same column if they are selected
self.transfer_widget_states(from_key=key, data_type=data_type)
@@ -390,6 +401,11 @@ def insert_row(self, row=-1,
_widget.addItem("Cylinder")
_widget.addItem("Sphere")
_widget.addItem("Hollow Cylinder")
+ _widget.addItem("PAC03")
+ _widget.addItem("PAC06")
+ _widget.addItem("PAC08")
+ _widget.addItem("PAC10")
+ _widget.addItem("QuartzTube03")
_master_table_row_ui['sample']['shape'] = _widget
_layout.addWidget(_widget)
_w = QWidget()
@@ -948,14 +964,16 @@ def unlock_signals_ui(self, list_ui=[]):
_ui.blockSignals(False)
def get_multi_scat_correction_list(self, shape=0):
- if shape == 0: # cylinder
+ cylinder_sam = [0, 3, 4, 5, 6, 7]
+ if shape in cylinder_sam: # cylinder
return ['None',
- 'Carpenter',
- 'Mayers']
+ 'SampleOnly']
elif shape == 1: # sphere
- return ['None']
+ return ['None',
+ 'SampleOnly']
elif shape == 2: # hollow cylinder
- return ['None']
+ return ['None',
+ 'SampleOnly']
return ['None']
@@ -965,20 +983,19 @@ def get_inelastic_scattering_list(self, shape='Cylinder'):
]
def get_absorption_correction_list(self, shape=0,type='Sample'):
- if shape == 0 and type == 'Sample': # cylinder, Sample
- return ['None',
- 'SampleOnly',
- 'SampleAndContainer',
- 'FullPaalmanPings',
- ]
- elif shape == 0 and type == 'Normalization': #cylinder, normalization
- return ['None',
- 'SampleOnly',
- 'SampleAndContainer']
+ cylinder_sam = [0, 3, 4, 5, 6, 7]
+ if shape in cylinder_sam: # cylinder
+ if type == 'Sample': # Sample
+ return ['None',
+ 'SampleOnly',
+ 'SampleAndContainer',
+ 'FullPaalmanPings']
+ else: # normalization
+ return ['None',
+ 'SampleOnly']
elif shape == 1: # sphere
return ['None',
- 'Monte Carlo',
- ]
+ 'Monte Carlo']
elif shape== 2: # hollow cylinder
return ['None',
'Monte Carlo']
diff --git a/addie/ui/make_calibration.ui b/addie/ui/make_calibration.ui
index 8b12dd85..7b9360b9 100644
--- a/addie/ui/make_calibration.ui
+++ b/addie/ui/make_calibration.ui
@@ -190,11 +190,6 @@
Calibration
-
-
- Vanadium
-
-
Date
diff --git a/addie/ui/reduction_configuration_dialog.ui b/addie/ui/reduction_configuration_dialog.ui
index f6b5b9ce..c82fff3f 100644
--- a/addie/ui/reduction_configuration_dialog.ui
+++ b/addie/ui/reduction_configuration_dialog.ui
@@ -1017,48 +1017,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Reduction Config. File
-
-
-
-
-
-
-
-
-
-
- 50
- 0
-
-
-
-
- 50
- 16777215
-
-
-
- Name:
-
-
-
- -
-
-
- -
-
-
- .json
-
-
-
-
-
-
-
-