Skip to content
Snippets Groups Projects
Commit b3ac127a authored by Michael Whitty's avatar Michael Whitty
Browse files

fixes #2512

parent d9c18792
No related merge requests found
......@@ -811,13 +811,6 @@
<layout class="QVBoxLayout" name="confit_layoutProperties" >
<item>
<layout class="QVBoxLayout" name="confit_layoutOptions" >
<item>
<widget class="QCheckBox" name="confit_ckPlotGuess" >
<property name="text" >
<string>Plot Guess</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="confit_layoutFitType" >
<item>
......@@ -848,13 +841,6 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="confit_ckFixCentres" >
<property name="text" >
<string>Fix Peak Centres</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="confit_layoutBackground" >
<item>
......@@ -885,6 +871,24 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_30" >
<item>
<widget class="QCheckBox" name="confit_ckFixCentres" >
<property name="text" >
<string>Fix Peak Centres</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="confit_ckPlotGuess" >
<property name="text" >
<string>Plot Guess</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
......@@ -902,7 +906,7 @@
<item>
<widget class="QLabel" name="confit_lbSpecNo" >
<property name="text" >
<string>Spectra No:</string>
<string>Spectra Range</string>
</property>
</widget>
</item>
......@@ -919,6 +923,26 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>to</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="confit_leSpecMax" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>-1</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......
......@@ -441,6 +441,7 @@ void IndirectDataAnalysis::setupConFit()
connect(m_uiForm.confit_pbSequential, SIGNAL(clicked()), this, SLOT(confitSequential()));
m_uiForm.confit_leSpecNo->setValidator(m_valInt);
m_uiForm.confit_leSpecMax->setValidator(m_valInt);
}
void IndirectDataAnalysis::setupAbsorptionF2Py()
......@@ -2115,6 +2116,16 @@ void IndirectDataAnalysis::confitPlotInput()
m_cfInputWSName = wsname;
int specNo = m_uiForm.confit_leSpecNo->text().toInt();
// Set spectra max value
int specMax = m_cfInputWS->getNumberHistograms() - 1;
if ( specNo < 0 || specNo > specMax )
{
m_uiForm.confit_leSpecNo->setText("0");
specNo = 0;
}
int smCurrent = m_uiForm.confit_leSpecMax->text().toInt();
if ( smCurrent < 0 || smCurrent > specMax )
m_uiForm.confit_leSpecMax->setText(QString::number(specMax));
m_cfDataCurve = plotMiniplot(m_cfPlot, m_cfDataCurve, wsname, specNo);
int npnts = m_cfDataCurve->data().size();
......@@ -2221,6 +2232,8 @@ void IndirectDataAnalysis::confitSequential()
"func = r'" + QString::fromStdString(function) + "'\n"
"startx = " + stX + "\n"
"endx = " + enX + "\n"
"specMin = " + m_uiForm.confit_leSpecNo->text() + "\n"
"specMax = " + m_uiForm.confit_leSpecMax->text() + "\n"
"plot = '" + m_uiForm.confit_cbPlotOutput->currentText() + "'\n"
"save = ";
......@@ -2228,7 +2241,7 @@ void IndirectDataAnalysis::confitSequential()
pyInput +=
"bg = '" + bg + "'\n"
"confitSeq(input, func, startx, endx, save, plot, bg)\n";
"confitSeq(input, func, startx, endx, save, plot, bg, specMin, specMax)\n";
QString pyOutput = runPythonCode(pyInput);
}
......
......@@ -61,14 +61,16 @@ def concatWSs(workspaces, unit, name):
CreateWorkspace(name, dataX, dataY, dataE, NSpec = len(workspaces),
UnitX=unit)
def confitParsToWS(Table, Data, BackG='FixF'):
def confitParsToWS(Table, Data, BackG='FixF', specMin=0, specMax=-1):
if ( specMax == -1 ):
specMax = mtd[Data].getNumberHistograms() - 1
dataX = []
if mtd[Data].getAxis(1).isSpectra():
ConvertSpectrumAxis(Data, 'inq', 'MomentumTransfer', 'Indirect')
Transpose('inq', 'inq')
readX = mtd['inq'].readX(0)
nBins = len(readX)
for i in range(0,nBins):
for i in range(specMin, specMax+1):
dataX.append(readX[i])
mtd.deleteWorkspace('inq')
else:
......@@ -82,7 +84,7 @@ def confitParsToWS(Table, Data, BackG='FixF'):
msg += 'Input must have axis values of Q'
print msg
sys.exit(msg)
for i in range(0, mtd[Data].getNumberHistograms()):
for i in range(specMin, specMax+1):
dataX.append(float(axis.label(i)))
xAxisVals = []
dataY = []
......@@ -127,13 +129,15 @@ def confitPlotSeq(inputWS, plot):
plotSpecs.append(i)
plotSpectrum(inputWS, plotSpecs)
def confitSeq(inputWS, func, startX, endX, save, plot, bg):
input = inputWS+',i0'
for i in range(1, mtd[inputWS].getNumberHistograms()):
def confitSeq(inputWS, func, startX, endX, save, plot, bg, specMin, specMax):
input = inputWS+',i' + str(specMin)
if (specMax == -1):
specMax = mtd[inputWS].getNumberHistograms() - 1
for i in range(specMin + 1, specMax + 1):
input += ';'+inputWS+',i'+str(i)
outNm = getWSprefix(inputWS) + '_conv_'
PlotPeakByLogValue(input, outNm, func, StartX=startX, EndX=endX)
wsname = confitParsToWS(outNm, inputWS, bg)
wsname = confitParsToWS(outNm, inputWS, bg, specMin, specMax)
if save:
SaveNexusProcessed(wsname, wsname+'.nxs')
if plot != 'None':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment