diff --git a/Code/Mantid/Kernel/src/ConfigService.cpp b/Code/Mantid/Kernel/src/ConfigService.cpp index 5144ce4075bb73c4bad80a40d8efd18b583d4ca5..1a6adcd0a298afb449364dd0f5e50fa5531bf7fb 100644 --- a/Code/Mantid/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Kernel/src/ConfigService.cpp @@ -77,12 +77,12 @@ namespace Mantid m_ConfigPaths.insert(std::make_pair("plugins.directory", true)); m_ConfigPaths.insert(std::make_pair("instrumentDefinition.directory", true)); m_ConfigPaths.insert(std::make_pair("requiredpythonscript.directories", true)); - m_ConfigPaths.insert(std::make_pair("pythonscripts.directory", false)); - m_ConfigPaths.insert(std::make_pair("pythonscripts.directories", false)); - m_ConfigPaths.insert(std::make_pair("ManagedWorkspace.FilePath", false)); + m_ConfigPaths.insert(std::make_pair("pythonscripts.directory", true)); + m_ConfigPaths.insert(std::make_pair("pythonscripts.directories", true)); + m_ConfigPaths.insert(std::make_pair("ManagedWorkspace.FilePath", true)); m_ConfigPaths.insert(std::make_pair("defaultsave.directory", false)); - m_ConfigPaths.insert(std::make_pair("datasearch.directories",false)); - m_ConfigPaths.insert(std::make_pair("pythonalgorithms.directories",false)); + m_ConfigPaths.insert(std::make_pair("datasearch.directories",true)); + m_ConfigPaths.insert(std::make_pair("pythonalgorithms.directories",true)); //attempt to load the default properties file that resides in the directory of the executable loadConfig( getBaseDir() + m_properties_file_name); @@ -128,10 +128,7 @@ namespace Mantid std::string value(m_pConf->getString(key)); value = makeAbsolute(value, key); - if( !value.empty() ) - { - m_AbsolutePaths.insert(std::make_pair(key, value)); - } + m_AbsolutePaths.insert(std::make_pair(key, value)); } } @@ -154,13 +151,17 @@ namespace Mantid for( Poco::StringTokenizer::Iterator itr = tokenizer.begin(); itr != iend; ) { std::string absolute = makeAbsolute(*itr, key); - if( !absolute.empty() ) + if( absolute.empty() ) { - converted += absolute; + ++itr; } - if( ++itr != iend ) + else { - converted += ";"; + converted += absolute; + if( ++itr != iend ) + { + converted += ";"; + } } } return converted; diff --git a/Code/Mantid/PythonAPI/MantidFramework.py b/Code/Mantid/PythonAPI/MantidFramework.py index 388f8f8a76fec81d6102e129679cc8c1b5ba9069..3289afdc3fa0da1d3ddbeab660f0e542929092b4 100644 --- a/Code/Mantid/PythonAPI/MantidFramework.py +++ b/Code/Mantid/PythonAPI/MantidFramework.py @@ -886,6 +886,7 @@ if not '.' in sys.path: def __addToPySearchPath(dirs): if type(dirs) == str: + if dirs.rstrip() == "": return dirs = dirs.split(';') if type(dirs) != list: return @@ -902,5 +903,18 @@ __addToPySearchPath(mtd.getConfigProperty('requiredpythonscript.directories')) # Now additional user specified directories __addToPySearchPath(mtd.getConfigProperty('pythonscripts.directories')) -# Finally old scripts key -__addToPySearchPath(mtd.getConfigProperty('pythonscripts.directory')) +# Finally old scripts key; For backwards compatability add all directories that are one-level below this +direcs = mtd.getConfigProperty('pythonscripts.directory') +__addToPySearchPath(direcs) +if direcs == '': + files = [] +else: + try: + files = os.listdir(direcs) + except: + files = [] + +for file in files: + fullpath = os.path.join(direcs,file) + if not 'svn' in file and os.path.isdir(fullpath): + __addToPySearchPath(fullpath) diff --git a/Code/Mantid/PythonAPI/scripts/SANS/SANSReduction.py b/Code/Mantid/PythonAPI/scripts/SANS/SANSReduction.py index 7c49e0f349fae2f49483a19ab660beb534be1e06..e31d76e58bda456011bee26ca7cdb436b64d0c13 100644 --- a/Code/Mantid/PythonAPI/scripts/SANS/SANSReduction.py +++ b/Code/Mantid/PythonAPI/scripts/SANS/SANSReduction.py @@ -130,10 +130,24 @@ REAR_DET_X_CORR = 0.0 #------------------------------- End of input section ----------------------------------------- -# Transmission variables for SANS2D. The CalculateTransmission algorithm contains the defaults -# for LOQ so these are not used for LOQ -TRANS_WAV1 = 2.0 -TRANS_WAV2 = 14.0 +# Transmission variables +TRANS_FIT_DEF = 'Log' +TRANS_FIT = TRANS_FIT_DEF +# Map input values to Mantid options +TRANS_FIT_OPTIONS = { +'YLOG' : 'Log', +'STRAIGHT' : 'Linear', +'CLEAR' : 'Off', +# Add Mantid ones as well +'LOG' : 'Log', +'LINEAR' : 'Linear', +'OFF' : 'Off' +} +TRANS_WAV1 = None +TRANS_WAV2 = None +TRANS_WAV1_FULL = None +TRANS_WAV2_FULL = None +# Mon/Det for SANS2D TRANS_UDET_MON = 2 TRANS_UDET_DET = 3 @@ -210,9 +224,11 @@ def printParameter(var): ########################### def SANS2D(): _printMessage('SANS2D()') - global INSTR_NAME, MONITORSPECTRUM + global INSTR_NAME, MONITORSPECTRUM, TRANS_WAV1, TRANS_WAV2, TRANS_WAV1_FULL, TRANS_WAV2_FULL INSTR_NAME = 'SANS2D' MONITORSPECTRUM = 2 + TRANS_WAV1_FULL = TRANS_WAV1 = 2.0 + TRANS_WAV2_FULL = TRANS_WAV2 = 14.0 if DETBANK != 'rear-detector': Detector('rear-detector') @@ -221,6 +237,8 @@ def LOQ(): global INSTR_NAME, MONITORSPECTRUM INSTR_NAME = 'LOQ' MONITORSPECTRUM = 2 + TRANS_WAV1_FULL = TRANS_WAV1 = 2.2 + TRANS_WAV2_FULL = TRANS_WAV2 = 10.0 if DETBANK != 'main-detector-bank': Detector('main-detector-bank') @@ -355,7 +373,7 @@ def AssignCan(can_run, reload = True): det_names = ['Front_Det_Z', 'Front_Det_X','Front_Det_Rot', 'Rear_Det_Z', 'Rear_Det_X'] for i in range(0, 5): - if math.fabs(smp_values[i] - can_values[i]) > 5e-03: + if math.fabs(smp_values[i] - can_values[i]) > 5e-04: _issueWarning(det_names[i] + " values differ between sample and can runs. Sample = " + str(smp_values[i]) + \ ' , Can = ' + str(can_values[i])) _MARKED_DETS_.append(det_names[i]) @@ -545,15 +563,33 @@ def LimitsQXY(qmin, qmax, step, type): def LimitsPhi(phimin, phimax): _printMessage("LimitsPHI(" + str(phimin) + ' ' + str(phimax) + ')') _readLimitValues('L/PHI ' + str(phimin) + ' ' + str(phimax)) - + def Gravity(flag): _printMessage('Gravity(' + str(flag) + ')') if isinstance(flag, bool) or isinstance(flag, int): global GRAVITY GRAVITY = flag else: - _warnUser("Invalid GRAVITY flag passed, try True/False. Setting kept as " + str(GRAVITY)) - + _issueWarning("Invalid GRAVITY flag passed, try True/False. Setting kept as " + str(GRAVITY)) + +def TransFit(mode,lambdamin=None,lambdamax=None): + global TRANS_WAV1, TRANS_WAV2, TRANS_FIT + if lambdamin is None or lambdamax is None: + _printMessage("TransFit(\"" + str(mode) + "\")") + TRANS_WAV1 = TRANS_WAV1_FULL + TRANS_WAV2 = TRANS_WAV2_FULL + else: + _printMessage("TransFit(\"" + str(mode) + "\"," + str(lambdamin) + "," + str(lambdamax) + ")") + TRANS_WAV1 = lambdamin + TRANS_WAV2 = lambdamax + + mode = mode.upper() + if mode in TRANS_FIT_OPTIONS.keys(): + TRANS_FIT = TRANS_FIT_OPTIONS[mode] + else: + _issueWarning("Invalid fit mode passed to TransFit, using default LOG method") + TRANS_FIT = 'Log' + ################################### # Scaling value ################################### @@ -837,7 +873,14 @@ def MaskFile(filename): _issueWarning('Incorrectly formatted BACK/MON/TIMES line, not running FlatBackground.') BACKMON_START = None BACKMON_END = None - + elif upper_line.startswith("FIT/TRANS/"): + params = upper_line[10:].split() + if len(params) == 3: + fit_type, lambdamin, lambdamax = params + TransFit(fit_type, lambdamin, lambdamax) + else: + _issueWarning('Incorrectly formatted FIT/TRANS line, setting defaults to LOG and full range') + TransFit(TRANS_FIT_DEF) else: continue @@ -1113,38 +1156,52 @@ def CalculateTransmissionCorrection(run_setup, lambdamin, lambdamax, use_def_tra return None if use_def_trans == DefaultTrans: - if INSTR_NAME == 'SANS2D': - fulltransws = trans_raw.split('_')[0] + '_trans_' + run_setup.getSuffix() + '_' + str(TRANS_WAV1) + '_' + str(TRANS_WAV2) - wavbin = str(TRANS_WAV1) + ',' + str(DWAV) + ',' + str(TRANS_WAV2) - else: - fulltransws = trans_raw.split('_')[0] + '_trans_' + run_setup.getSuffix() + '_2.2_10' - wavbin = str(2.2) + ',' + str(DWAV) + ',' + str(10.0) + wavbin = str(TRANS_WAV1_FULL) + ',' + str(DWAV) + ',' + str(TRANS_WAV2_FULL) + translambda_min = TRANS_WAV1_FULL + translambda_max = TRANS_WAV2_FULL else: - fulltransws = trans_raw.split('_')[0] + '_trans_' + run_setup.getSuffix() + '_' + str(lambdamin) + '_' + str(lambdamax) + translambda_min = TRANS_WAV1 + translambda_max = TRANS_WAV2 wavbin = str(lambdamin) + ',' + str(DWAV) + ',' + str(lambdamax) - if mtd.workspaceExists(fulltransws) == False or use_def_trans == False: + fittedtransws = trans_raw.split('_')[0] + '_trans_' + run_setup.getSuffix() + '_' + str(translambda_min) + '_' + str(translambda_max) + unfittedtransws = fittedtransws + "_unfitted" + if use_def_trans == False or \ + (TRANS_FIT != 'Off' and mtd.workspaceExists(fittedtransws) == False) or \ + (TRANS_FIT == 'Off' and mtd.workspaceExists(unfittedtransws) == False): + # If no fitting is required just use linear and get unfitted data from CalculateTransmission algorithm + if TRANS_FIT == 'Off': + fit_type = 'Linear' + else: + fit_type = TRANS_FIT if INSTR_NAME == 'LOQ': # Change the instrument definition to the correct one in the LOQ case LoadInstrument(trans_raw, INSTR_DIR + "/LOQ_trans_Definition.xml") LoadInstrument(direct_raw, INSTR_DIR + "/LOQ_trans_Definition.xml") trans_tmp_out = SANSUtility.SetupTransmissionWorkspace(trans_raw, '1,2', BACKMON_START, BACKMON_END, wavbin, True) direct_tmp_out = SANSUtility.SetupTransmissionWorkspace(direct_raw, '1,2', BACKMON_START, BACKMON_END, wavbin, True) - CalculateTransmission(trans_tmp_out,direct_tmp_out, fulltransws, OutputUnfittedData=True) + CalculateTransmission(trans_tmp_out,direct_tmp_out, fittedtransws, MinWavelength = translambda_min, MaxWavelength = translambda_max, \ + FitMethod = fit_type, OutputUnfittedData=True) else: - trans_tmp_out = SANSUtility.SetupTransmissionWorkspace(trans_raw, '1,2', BACKMON_START, BACKMON_END, wavbin, False) + trans_tmp_out = SANSUtility.SetupTransmissionWorkspace(trans_raw, '1,2', BACKMON_START, BACKMON_END, wavbin, False) direct_tmp_out = SANSUtility.SetupTransmissionWorkspace(direct_raw, '1,2', BACKMON_START, BACKMON_END, wavbin, False) - CalculateTransmission(trans_tmp_out,direct_tmp_out, fulltransws, TRANS_UDET_MON, TRANS_UDET_DET, TRANS_WAV1, TRANS_WAV2, OutputUnfittedData=True) - # Remove temopraries + CalculateTransmission(trans_tmp_out,direct_tmp_out, fittedtransws, TRANS_UDET_MON, TRANS_UDET_DET, MinWavelength = translambda_min, \ + MaxWavelength = translambda_max, FitMethod = fit_type, OutputUnfittedData=True) + # Remove temporaries mantid.deleteWorkspace(trans_tmp_out) mantid.deleteWorkspace(direct_tmp_out) + + if TRANS_FIT == 'Off': + result = unfittedtransws + else: + result = fittedtransws if use_def_trans == DefaultTrans: tmp_ws = 'trans_' + run_setup.getSuffix() + '_' + str(lambdamin) + '_' + str(lambdamax) - CropWorkspace(fulltransws, tmp_ws, XMin = str(lambdamin), XMax = str(lambdamax)) + CropWorkspace(result, tmp_ws, XMin = str(lambdamin), XMax = str(lambdamax)) return tmp_ws else: - return fulltransws + return result ## # Setup component positions, xbeam and ybeam in metres diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.h b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.h index a176430b5a32ae9b7e2f97d9365284aa21b99264..fd5e729f4b8163b18786545184e0760bdea8d67a 100644 --- a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.h +++ b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.h @@ -174,6 +174,8 @@ private slots: void clearLogger(); ///Verbose mode checked/unchecked void verboseMode(int state); + ///Default trans changed state + void updateTransInfo(int state); private: /// The form generated by Qt Designer diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.ui b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.ui index a34b25c77628d8fff3df51cfb49201475afc6583..86506a67095fc08262abe2e7959a704fb28e13a5 100644 --- a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.ui +++ b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSRunWindow.ui @@ -1149,13 +1149,6 @@ </property> </widget> </item> - <item row="2" column="0" > - <widget class="QLabel" name="label_16" > - <property name="text" > - <string>Wavelength (Angstroms)</string> - </property> - </widget> - </item> <item row="5" column="0" > <widget class="QLabel" name="label_21" > <property name="text" > @@ -1338,7 +1331,7 @@ p, li { white-space: pre-wrap; } <item row="5" column="5" > <widget class="QComboBox" name="qy_dqy_opt" > <property name="sizePolicy" > - <sizepolicy vsizetype="Maximum" hsizetype="Maximum" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1370,21 +1363,21 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="6" column="1" > + <item row="7" column="1" > <widget class="QCheckBox" name="def_trans" > <property name="text" > <string/> </property> </widget> </item> - <item row="6" column="0" > + <item row="7" column="0" > <widget class="QLabel" name="label_36" > <property name="text" > <string>Use default transmission</string> </property> </widget> </item> - <item row="6" column="2" colspan="2" > + <item row="7" column="2" colspan="2" > <widget class="QLabel" name="label_23" > <property name="text" > <string>Account for gravity</string> @@ -1394,7 +1387,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="6" column="4" > + <item row="7" column="4" > <widget class="QCheckBox" name="gravity_check" > <property name="text" > <string/> @@ -1417,10 +1410,10 @@ p, li { white-space: pre-wrap; } <property name="margin" > <number>0</number> </property> - <item row="0" column="5" > - <widget class="QLineEdit" name="q_dq" > + <item row="0" column="2" > + <widget class="QLineEdit" name="q_min" > <property name="sizePolicy" > - <sizepolicy vsizetype="Maximum" hsizetype="Maximum" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1433,13 +1426,6 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="0" column="4" > - <widget class="QLabel" name="q_step_lbl" > - <property name="text" > - <string>stepping</string> - </property> - </widget> - </item> <item row="0" column="3" > <widget class="QLineEdit" name="q_max" > <property name="sizePolicy" > @@ -1456,10 +1442,17 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="0" column="2" > - <widget class="QLineEdit" name="q_min" > + <item row="0" column="4" > + <widget class="QLabel" name="q_step_lbl" > + <property name="text" > + <string>stepping</string> + </property> + </widget> + </item> + <item row="0" column="5" > + <widget class="QLineEdit" name="q_dq" > <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <sizepolicy vsizetype="Maximum" hsizetype="Maximum" > <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1492,7 +1485,6 @@ p, li { white-space: pre-wrap; } </widget> </item> </layout> - <zorder>q_dq_opt</zorder> <zorder>q_min</zorder> <zorder>q_max</zorder> <zorder>q_step_lbl</zorder> @@ -1564,34 +1556,46 @@ p, li { white-space: pre-wrap; } </item> </widget> </item> + <item row="6" column="0" > + <widget class="QLabel" name="label_38" > + <property name="text" > + <string>Trans Fit (Angstroms)</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="label_16" > + <property name="text" > + <string>Wavelength (Angstroms)</string> + </property> + </widget> + </item> + <item row="6" column="1" > + <widget class="QLineEdit" name="trans_min" /> + </item> + <item row="6" column="2" > + <widget class="QLineEdit" name="trans_max" /> + </item> + <item row="6" column="5" > + <widget class="QComboBox" name="trans_opt" > + <item> + <property name="text" > + <string>Logarithmic</string> + </property> + </item> + <item> + <property name="text" > + <string>Linear</string> + </property> + </item> + <item> + <property name="text" > + <string>Off</string> + </property> + </item> + </widget> + </item> </layout> - <zorder>label_3</zorder> - <zorder>label_16</zorder> - <zorder>label_21</zorder> - <zorder>rad_min</zorder> - <zorder>wav_min</zorder> - <zorder>rad_max</zorder> - <zorder>limits_max_lbl</zorder> - <zorder>wav_max</zorder> - <zorder>qy_max</zorder> - <zorder>wav_step_lbl</zorder> - <zorder>qy_step_lbl</zorder> - <zorder>wav_dw</zorder> - <zorder>qy_dqy</zorder> - <zorder>wav_dw_opt</zorder> - <zorder>qy_dqy_opt</zorder> - <zorder>limits_min_lbl</zorder> - <zorder>def_trans</zorder> - <zorder>label_36</zorder> - <zorder>label_23</zorder> - <zorder>gravity_check</zorder> - <zorder>q_stack</zorder> - <zorder>label_19</zorder> - <zorder>q_min</zorder> - <zorder>q_max</zorder> - <zorder>q_step_lbl</zorder> - <zorder>q_dq</zorder> - <zorder>q_dq_opt</zorder> </widget> </item> </layout> diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp index 77c71d2f275376d776ebbbb26b725182f1b60218..1530118fa06f64a24f2de7a888f68b473b75e619 100644 --- a/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp +++ b/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp @@ -97,11 +97,6 @@ void SANSRunWindow::initLayout() //Set column stretch on the mask table m_uiForm.mask_table->horizontalHeader()->setStretchLastSection(true); - // Set stacked widget margin - /* int left(0),right(0), top(0), bottom(0); - m_uiForm.q_stack->layout()->getContentsMargins(&left, &top, &right, &bottom);*/ - m_uiForm.q_stack->layout()->setContentsMargins(0, 0, 0, 0); - //Button connections connect(m_uiForm.data_dirBtn, SIGNAL(clicked()), this, SLOT(selectDataDir())); connect(m_uiForm.userfileBtn, SIGNAL(clicked()), this, SLOT(selectUserFile())); @@ -178,6 +173,9 @@ void SANSRunWindow::initLayout() connect(m_uiForm.inst_opt, SIGNAL(currentIndexChanged(int)), this, SLOT(handleInstrumentChange(int))); + // Default transmission switch + connect(m_uiForm.def_trans, SIGNAL(stateChanged(int)), this, SLOT(updateTransInfo(int))); + // Add Python set functions as underlying data m_uiForm.inst_opt->setItemData(0, "LOQ()"); m_uiForm.inst_opt->setItemData(1, "SANS2D()"); @@ -188,6 +186,9 @@ void SANSRunWindow::initLayout() m_uiForm.q_dq_opt->setItemData(0, "LIN"); m_uiForm.q_dq_opt->setItemData(1, "LOG"); m_uiForm.qy_dqy_opt->setItemData(0, "LIN"); + m_uiForm.trans_opt->setItemData(0,"Log"); + m_uiForm.trans_opt->setItemData(1,"Linear"); + m_uiForm.trans_opt->setItemData(2,"Off"); readSettings(); } @@ -198,7 +199,7 @@ void SANSRunWindow::initLayout() void SANSRunWindow::initLocalPython() { // Imoprt the SANS module and set the correct instrument - QString result = runPythonCode("try:\n\tfrom SANSReduction import *\nexcept ImportError:\tprint 'Error: Cannot find SANSReduction module.\\nUnable to continue.'"); + QString result = runPythonCode("try:\n\tfrom SANSReduction import *\nexcept (ImportError,SyntaxError), details:\tprint 'Error importing SANSReduction: ' + str(details)"); if( result.trimmed().isEmpty() ) { m_have_reducemodule = true; @@ -442,6 +443,16 @@ bool SANSRunWindow::loadUserFile() m_uiForm.qy_max->setText(runReduceScriptFunction("printParameter('QXY2'),")); setLimitStepParameter("Qxy", runReduceScriptFunction("printParameter('DQXY'),"), m_uiForm.qy_dqy, m_uiForm.qy_dqy_opt); + // Tranmission options + m_uiForm.trans_min->setText(runReduceScriptFunction("printParameter('TRANS_WAV1'),")); + m_uiForm.trans_max->setText(runReduceScriptFunction("printParameter('TRANS_WAV2'),")); + text = runReduceScriptFunction("printParameter('TRANS_FIT')"); + int index = m_uiForm.trans_opt->findData(text, Qt::UserRole, Qt::MatchFixedString); + if( index >= 0 ) + { + m_uiForm.trans_opt->setCurrentIndex(index); + } + //Monitor spectrum m_uiForm.monitor_spec->setText(runReduceScriptFunction("printParameter('MONITORSPECTRUM'),")); @@ -476,7 +487,7 @@ bool SANSRunWindow::loadUserFile() ////Detector bank param = runReduceScriptFunction("printParameter('DETBANK')"); - int index = m_uiForm.detbank_sel->findText(param); + index = m_uiForm.detbank_sel->findText(param); if( index >= 0 && index < 2 ) { m_uiForm.detbank_sel->setCurrentIndex(index); @@ -1394,19 +1405,23 @@ QString SANSRunWindow::createAnalysisDetailsScript(const QString & type) exec_reduce += "LimitsR(" + m_uiForm.rad_min->text() + "," + m_uiForm.rad_max->text() + ")\n" + "LimitsWav(" + m_uiForm.wav_min->text() + "," + m_uiForm.wav_max->text() + "," + - m_uiForm.wav_dw->text() + ",'" + m_uiForm.wav_dw_opt->itemData(m_uiForm.wav_dw_opt->currentIndex()).toString() + "')\n"; - if( m_uiForm.q_dq_opt->currentIndex() == 2 ) - { - "LimitsQ(" + m_uiForm.q_rebin->text() + ")\n"; - } - else - { - "LimitsQ(" + m_uiForm.q_min->text() + "," + m_uiForm.q_max->text() + "," + - m_uiForm.q_dq->text() + ",'" + m_uiForm.q_dq_opt->itemData(m_uiForm.q_dq_opt->currentIndex()).toString() + "')\n"; - } - exec_reduce += "LimitsQXY(0.0," + m_uiForm.qy_max->text() + "," + - m_uiForm.qy_dqy->text() + ",'" + m_uiForm.qy_dqy_opt->itemData(m_uiForm.qy_dqy_opt->currentIndex()).toString() + "')\n" + - "LimitsPhi(" + m_uiForm.phi_min->text() + "," + m_uiForm.phi_max->text() + ")\n"; + m_uiForm.wav_dw->text() + ",'" + m_uiForm.wav_dw_opt->itemData(m_uiForm.wav_dw_opt->currentIndex()).toString() + "')\n"; + if( m_uiForm.q_dq_opt->currentIndex() == 2 ) + { + "LimitsQ(" + m_uiForm.q_rebin->text() + ")\n"; + } + else + { + "LimitsQ(" + m_uiForm.q_min->text() + "," + m_uiForm.q_max->text() + "," + + m_uiForm.q_dq->text() + ",'" + m_uiForm.q_dq_opt->itemData(m_uiForm.q_dq_opt->currentIndex()).toString() + "')\n"; + } + exec_reduce += "LimitsQXY(0.0," + m_uiForm.qy_max->text() + "," + + m_uiForm.qy_dqy->text() + ",'" + m_uiForm.qy_dqy_opt->itemData(m_uiForm.qy_dqy_opt->currentIndex()).toString() + "')\n" + + "LimitsPhi(" + m_uiForm.phi_min->text() + "," + m_uiForm.phi_max->text() + ")\n"; + + //Transmission behaviour + exec_reduce += "TransFit('" + m_uiForm.trans_opt->itemData(m_uiForm.trans_opt->currentIndex()).toString() + "'," + + m_uiForm.trans_min->text() + "," + m_uiForm.trans_max->text() + ")\n"; //Centre values exec_reduce += "SetCentre(" + m_uiForm.beam_x->text() + "," + m_uiForm.beam_y->text() + ")\n"; @@ -1880,6 +1895,18 @@ void SANSRunWindow::verboseMode(int state) else {} } +/** + * Update the transmission range boxes if the "Use Transmission defaults is checked" + */ +void SANSRunWindow::updateTransInfo(int state) +{ + if( state == Qt::Checked ) + { + m_uiForm.trans_min->setText(runReduceScriptFunction("printParameter('TRANS_WAV1_FULL'),")); + m_uiForm.trans_max->setText(runReduceScriptFunction("printParameter('TRANS_WAV2_FULL'),")); + } +} + /** * Run a SANS assign command * @param key The key of the edit box to assign from