添加错误提示
This commit is contained in:
parent
b70e2d238a
commit
22113ad870
|
@ -1990,18 +1990,17 @@ bool GammaAnalyALG::Process(bool bUpdate, QChar dataType, vec certEne)
|
||||||
qDebug() << "The counts of spectrum are all zero!";
|
qDebug() << "The counts of spectrum are all zero!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
callGammaProcess(0);
|
callGammaProcess(0);
|
||||||
|
|
||||||
stdvec vy;
|
stdvec vy;
|
||||||
vy = getBaseInfo(s_YControl);
|
vy = getBaseInfo(s_YControl);
|
||||||
|
|
||||||
/* **********************************刻度更新*********************************************** */
|
/* **********************************刻度更新*********************************************** */
|
||||||
if(bUpdate)
|
if(bUpdate)
|
||||||
{
|
{
|
||||||
calUpdate(dataType, certEne, true, true, true);
|
calUpdate(dataType, certEne, true, true, true);
|
||||||
callGammaProcess(1);
|
callGammaProcess(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
vy = getBaseInfo(s_YControl);
|
vy = getBaseInfo(s_YControl);
|
||||||
/* **********************************寻峰*********************************************** */
|
/* **********************************寻峰*********************************************** */
|
||||||
PeakSearch();
|
PeakSearch();
|
||||||
|
@ -2022,7 +2021,6 @@ bool GammaAnalyALG::Process(bool bUpdate, QChar dataType, vec certEne)
|
||||||
fitPeakFull(idx, ep, ep, ep);
|
fitPeakFull(idx, ep, ep, ep);
|
||||||
vy = getBaseInfo(s_YControl);
|
vy = getBaseInfo(s_YControl);
|
||||||
callGammaProcess(4);
|
callGammaProcess(4);
|
||||||
|
|
||||||
baseInfo(s_Energy) = calValues(Cal_Energy, RangeVec2(1, m_nChans));
|
baseInfo(s_Energy) = calValues(Cal_Energy, RangeVec2(1, m_nChans));
|
||||||
baseInfo(s_FwhmcAll) = GetFwhmcAll();
|
baseInfo(s_FwhmcAll) = GetFwhmcAll();
|
||||||
baseInfo(s_Lc) = calculateLC(baseInfo(s_BaseLine), baseInfo(s_FwhmcAll), specSetup.RiskLevelK);
|
baseInfo(s_Lc) = calculateLC(baseInfo(s_BaseLine), baseInfo(s_FwhmcAll), specSetup.RiskLevelK);
|
||||||
|
@ -2034,7 +2032,6 @@ bool GammaAnalyALG::Process(bool bUpdate, QChar dataType, vec certEne)
|
||||||
////("____na_cy.txt", baseInfo(s_YControl));
|
////("____na_cy.txt", baseInfo(s_YControl));
|
||||||
////("____na_cdy.txt", baseInfo(s_YSlope));
|
////("____na_cdy.txt", baseInfo(s_YSlope));
|
||||||
////("____na_steps.txt", baseInfo(s_Steps));*/
|
////("____na_steps.txt", baseInfo(s_Steps));*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2077,6 +2074,7 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
|
||||||
QStringList names;
|
QStringList names;
|
||||||
names << phd->newEner << phd->newReso;
|
names << phd->newEner << phd->newReso;
|
||||||
bool bUpdate = false;
|
bool bUpdate = false;
|
||||||
|
|
||||||
if(phd->bAnalyed)
|
if(phd->bAnalyed)
|
||||||
{
|
{
|
||||||
SetCalPara(names, phd->mapEnerPara[ names[0] ], phd->mapResoPara[ names[1] ], phd->mapEffiPara[phd->newEffi], phd->mapTotEPara[phd->newTotE]);
|
SetCalPara(names, phd->mapEnerPara[ names[0] ], phd->mapResoPara[ names[1] ], phd->mapEffiPara[phd->newEffi], phd->mapTotEPara[phd->newTotE]);
|
||||||
|
@ -2458,10 +2456,8 @@ void GammaAnalyALG::SetCalData(QStringList names, G_EnergyBlock EnerKD, G_Resolu
|
||||||
qDebug() << "The parameter names must has at least 2 element in GammaAnalyALG::SetCalData.";
|
qDebug() << "The parameter names must has at least 2 element in GammaAnalyALG::SetCalData.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_curEner = names[0];
|
m_curEner = names[0];
|
||||||
m_curReso = names[1];
|
m_curReso = names[1];
|
||||||
|
|
||||||
if(EnerKD.record_count > 0)
|
if(EnerKD.record_count > 0)
|
||||||
{
|
{
|
||||||
mat calDatas(EnerKD.record_count, 3);
|
mat calDatas(EnerKD.record_count, 3);
|
||||||
|
@ -2509,7 +2505,6 @@ void GammaAnalyALG::SetCalData(QStringList names, G_EnergyBlock EnerKD, G_Resolu
|
||||||
Acal_tot_efficiency_para = FitCalPara(Cal_Tot_efficiency, Cal_Tot_Effi_Data);
|
Acal_tot_efficiency_para = FitCalPara(Cal_Tot_efficiency, Cal_Tot_Effi_Data);
|
||||||
//Acal_tot_efficiency_para.print("Acal_tot_efficiency_para = ");
|
//Acal_tot_efficiency_para.print("Acal_tot_efficiency_para = ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*QString name;
|
/*QString name;
|
||||||
setCalibrationData(name, Cal_Energy, "PHD", tmpEner);
|
setCalibrationData(name, Cal_Energy, "PHD", tmpEner);
|
||||||
setCalibrationData(name, Cal_Resolution, "PHD", QVec2ToMat(ResoKD));
|
setCalibrationData(name, Cal_Resolution, "PHD", QVec2ToMat(ResoKD));
|
||||||
|
@ -3352,7 +3347,6 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
double k = specSetup.k_back;
|
double k = specSetup.k_back;
|
||||||
double k_alpha = specSetup.k_alpha;
|
double k_alpha = specSetup.k_alpha;
|
||||||
double k_beta = specSetup.k_beta;
|
double k_beta = specSetup.k_beta;
|
||||||
|
|
||||||
// get baseline and peak parameters
|
// get baseline and peak parameters
|
||||||
field<rowvec> t_f1;
|
field<rowvec> t_f1;
|
||||||
if(updr)
|
if(updr)
|
||||||
|
@ -3367,6 +3361,7 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
t_f1 = dmspec(QStringList("BaseLine")); //BL = dmspec(sn, 'BaseLine');
|
t_f1 = dmspec(QStringList("BaseLine")); //BL = dmspec(sn, 'BaseLine');
|
||||||
|
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
//("patBaseVar_BaseLine.txt", t_f1(0));
|
//("patBaseVar_BaseLine.txt", t_f1(0));
|
||||||
}
|
}
|
||||||
|
@ -3375,7 +3370,6 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
QStringList dmpsItems;
|
QStringList dmpsItems;
|
||||||
dmpsItems << "Centroid" << "FWHM_Ch" << "NetArea" << "SigmaCh";
|
dmpsItems << "Centroid" << "FWHM_Ch" << "NetArea" << "SigmaCh";
|
||||||
field<vec> t_f2 = dmps(dmpsItems);
|
field<vec> t_f2 = dmps(dmpsItems);
|
||||||
|
|
||||||
/* // modify all peaks, if idx is string
|
/* // modify all peaks, if idx is string
|
||||||
if isstr(idx)
|
if isstr(idx)
|
||||||
idx = [1 : length(Ct)];
|
idx = [1 : length(Ct)];
|
||||||
|
@ -3385,7 +3379,6 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
{
|
{
|
||||||
idx = vectorise( RangeVec(0, t_f2(0).size()-1) );
|
idx = vectorise( RangeVec(0, t_f2(0).size()-1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
vec MBC, LC, LD, BC;
|
vec MBC, LC, LD, BC;
|
||||||
if(t_f1(0).is_empty()) //if isempty(BL)
|
if(t_f1(0).is_empty()) //if isempty(BL)
|
||||||
{
|
{
|
||||||
|
@ -3404,17 +3397,14 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
t_f2(1) = t_f2(1)(idx); //Fc = Fc(idx);
|
t_f2(1) = t_f2(1)(idx); //Fc = Fc(idx);
|
||||||
t_f2(2) = t_f2(2)(idx); //NA = NA(idx);
|
t_f2(2) = t_f2(2)(idx); //NA = NA(idx);
|
||||||
t_f2(3) = t_f2(3)(idx); //Sc = Sc(idx);
|
t_f2(3) = t_f2(3)(idx); //Sc = Sc(idx);
|
||||||
|
|
||||||
vec W = 2 * k * t_f2(1); //W = 2 * k * Fc;
|
vec W = 2 * k * t_f2(1); //W = 2 * k * Fc;
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
|
|
||||||
// total background counts from Ct +- k*Fc
|
// total background counts from Ct +- k*Fc
|
||||||
|
|
||||||
rowvec tmp1 = max(0, t_f1(0));
|
rowvec tmp1 = max(0, t_f1(0));
|
||||||
BC = Independ::abkcnt( tmp1, t_f2(0), t_f2(1), k); //BC = abkcnt(max(BL, 0), Ct, Fc, k);
|
BC = Independ::abkcnt( tmp1, t_f2(0), t_f2(1), k); //BC = abkcnt(max(BL, 0), Ct, Fc, k);
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
// Mean Back Counts
|
// Mean Back Counts
|
||||||
MBC = BC / W;
|
MBC = BC / W;
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
|
@ -3433,7 +3423,6 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
vec DA = c*f*sqrt(t_f2(3) % MBC); //DA = c*f*sqrt(Sc .* MBC);
|
vec DA = c*f*sqrt(t_f2(3) % MBC); //DA = c*f*sqrt(Sc .* MBC);
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
//("patBaseVar_DA.txt", DA);
|
//("patBaseVar_DA.txt", DA);
|
||||||
|
|
||||||
// Currie's LC
|
// Currie's LC
|
||||||
LC = k_alpha * DA;
|
LC = k_alpha * DA;
|
||||||
|
|
||||||
|
@ -3444,7 +3433,6 @@ void GammaAnalyALG::patBaseVar(colvec &sqi, colvec &uqi, uvec idx, int updr)
|
||||||
LD = LC + (kb2/2) * ( 1 + sqrt(1 + (4/kb2)*( LC+pow(DA,2) ) ) );
|
LD = LC + (kb2/2) * ( 1 + sqrt(1 + (4/kb2)*( LC+pow(DA,2) ) ) );
|
||||||
/* -------------------------------打印输出 ---------------------------------- */
|
/* -------------------------------打印输出 ---------------------------------- */
|
||||||
//("patBaseVar_LD.txt", LD);
|
//("patBaseVar_LD.txt", LD);
|
||||||
|
|
||||||
if(updr)
|
if(updr)
|
||||||
{
|
{
|
||||||
// total counts
|
// total counts
|
||||||
|
@ -5596,7 +5584,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
// if true, peaks found in peak search will be kept
|
// if true, peaks found in peak search will be kept
|
||||||
//write_peaks_to_pat = getSpecSetup(sn, 'KeepCalPeakSearchPeaks');
|
//write_peaks_to_pat = getSpecSetup(sn, 'KeepCalPeakSearchPeaks');
|
||||||
bool write_peaks_to_pat = specSetup.KeepCalPeakSearchPeaks;
|
bool write_peaks_to_pat = specSetup.KeepCalPeakSearchPeaks;
|
||||||
|
|
||||||
// for calibration spectra, use energies from certificate instead of setup file
|
// for calibration spectra, use energies from certificate instead of setup file
|
||||||
//[dataType, certEne] = dminfo(sn, 'DataType', 'CertificateGEnergies');
|
//[dataType, certEne] = dminfo(sn, 'DataType', 'CertificateGEnergies');
|
||||||
vec ELibEne, ELibRes;
|
vec ELibEne, ELibRes;
|
||||||
|
@ -5648,7 +5635,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////("calUpdate_ELibEne.txt", ELibEne);
|
////("calUpdate_ELibEne.txt", ELibEne);
|
||||||
////("calUpdate_ELibRes.txt", ELibRes);
|
////("calUpdate_ELibRes.txt", ELibRes);
|
||||||
|
|
||||||
|
@ -5659,7 +5645,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
uvec ene1PIdx = calPeakSearch(ELibEne1, ELibEne);
|
uvec ene1PIdx = calPeakSearch(ELibEne1, ELibEne);
|
||||||
calEnergyUpdate1(ene1PIdx, ELibEne1);
|
calEnergyUpdate1(ene1PIdx, ELibEne1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(R)
|
if(R)
|
||||||
{
|
{
|
||||||
// update resolution calibration
|
// update resolution calibration
|
||||||
|
@ -5667,7 +5652,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
uvec resPIdx = calPeakSearch(ELibRes1, ELibRes);
|
uvec resPIdx = calPeakSearch(ELibRes1, ELibRes);
|
||||||
calResUpdate(resPIdx);
|
calResUpdate(resPIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(E2)
|
if(E2)
|
||||||
{
|
{
|
||||||
// second energy calibration update
|
// second energy calibration update
|
||||||
|
@ -5675,7 +5659,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
uvec ene2PIdx = calPeakSearch(ELibEne2, ELibEne);
|
uvec ene2PIdx = calPeakSearch(ELibEne2, ELibEne);
|
||||||
calEnergyUpdate2(ene2PIdx, ELibEne2);
|
calEnergyUpdate2(ene2PIdx, ELibEne2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep changes (quickfit) in PAT, if requested
|
// keep changes (quickfit) in PAT, if requested
|
||||||
if(write_peaks_to_pat)
|
if(write_peaks_to_pat)
|
||||||
{
|
{
|
||||||
|
@ -5696,7 +5679,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
|
||||||
baseInfo(s_YSlope).clear();
|
baseInfo(s_YSlope).clear();
|
||||||
baseInfo(s_AnalysisRange).clear();
|
baseInfo(s_AnalysisRange).clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uvec GammaAnalyALG::calPeakSearch(vec &EF, vec ELib)
|
uvec GammaAnalyALG::calPeakSearch(vec &EF, vec ELib)
|
||||||
|
@ -5920,7 +5902,6 @@ void GammaAnalyALG::calEnergyUpdate2(uvec idx, vec ELib)
|
||||||
{
|
{
|
||||||
uword NPeaks = idx.size();
|
uword NPeaks = idx.size();
|
||||||
vec C = zeros<vec>(NPeaks);
|
vec C = zeros<vec>(NPeaks);
|
||||||
|
|
||||||
// fit peaks
|
// fit peaks
|
||||||
vec ret1, ret2, ret3;
|
vec ret1, ret2, ret3;
|
||||||
uvec tmp;
|
uvec tmp;
|
||||||
|
@ -5936,7 +5917,6 @@ void GammaAnalyALG::calEnergyUpdate2(uvec idx, vec ELib)
|
||||||
C(i) = as_scalar(ret2);
|
C(i) = as_scalar(ret2);
|
||||||
}
|
}
|
||||||
//C.print("C = ");
|
//C.print("C = ");
|
||||||
|
|
||||||
// fit new centroids to library energies
|
// fit new centroids to library energies
|
||||||
vec p, perr;
|
vec p, perr;
|
||||||
s = Independ::calFitPara(p, perr, Cal_Energy, C, ELib);
|
s = Independ::calFitPara(p, perr, Cal_Energy, C, ELib);
|
||||||
|
@ -5952,15 +5932,12 @@ void GammaAnalyALG::calEnergyUpdate2(uvec idx, vec ELib)
|
||||||
{
|
{
|
||||||
vec F02 = Independ::calFcnEval(C, Acal_energy_para[m_curEner](0));
|
vec F02 = Independ::calFcnEval(C, Acal_energy_para[m_curEner](0));
|
||||||
double sum02 = sum(pow(F02 - ELib, 2)) / C.size();
|
double sum02 = sum(pow(F02 - ELib, 2)) / C.size();
|
||||||
|
|
||||||
vec F2 = Independ::calFcnEval(C, p);
|
vec F2 = Independ::calFcnEval(C, p);
|
||||||
double sum2 = sum(pow(F2 - ELib, 2)) / C.size();
|
double sum2 = sum(pow(F2 - ELib, 2)) / C.size();
|
||||||
|
|
||||||
if(sum2 < sum02)
|
if(sum2 < sum02)
|
||||||
{
|
{
|
||||||
m_curEner = CalUpdate2;
|
m_curEner = CalUpdate2;
|
||||||
Cal_Ener_Data[m_curEner] = data;
|
Cal_Ener_Data[m_curEner] = data;
|
||||||
|
|
||||||
field<vec> f_p(2);
|
field<vec> f_p(2);
|
||||||
f_p(0) = p; f_p(1) = perr;
|
f_p(0) = p; f_p(1) = perr;
|
||||||
Acal_energy_para[m_curEner] = f_p;
|
Acal_energy_para[m_curEner] = f_p;
|
||||||
|
@ -6131,7 +6108,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
end */
|
end */
|
||||||
bool s = true;
|
bool s = true;
|
||||||
QStringList addArg("");
|
QStringList addArg("");
|
||||||
|
|
||||||
// get index of leftmost and rightmost peak
|
// get index of leftmost and rightmost peak
|
||||||
//allidx = [Af; Cf; Ff];
|
//allidx = [Af; Cf; Ff];
|
||||||
uvec allidx = join_vert(Af, Cf);
|
uvec allidx = join_vert(Af, Cf);
|
||||||
|
@ -6145,7 +6121,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
X2 = gNaN;
|
X2 = gNaN;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
uword LIdx = min(allidx);
|
uword LIdx = min(allidx);
|
||||||
uword RIdx = max(allidx);
|
uword RIdx = max(allidx);
|
||||||
|
|
||||||
|
@ -6153,7 +6128,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
uvec Bool = zeros<uvec>(RIdx + 1u);
|
uvec Bool = zeros<uvec>(RIdx + 1u);
|
||||||
Bool(allidx) = ones<uvec>(allidx.n_elem);
|
Bool(allidx) = ones<uvec>(allidx.n_elem);
|
||||||
allidx = find(Bool);
|
allidx = find(Bool);
|
||||||
|
|
||||||
// get peak parameters
|
// get peak parameters
|
||||||
//[C, FC, NA] = dmps(sn, 'Centroid', 'FWHM_Ch', 'NetArea');
|
//[C, FC, NA] = dmps(sn, 'Centroid', 'FWHM_Ch', 'NetArea');
|
||||||
QStringList Opts; Opts << "Centroid" << "FWHM_Ch" << "NetArea";
|
QStringList Opts; Opts << "Centroid" << "FWHM_Ch" << "NetArea";
|
||||||
|
@ -6161,7 +6135,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
vec C = t_f(0);
|
vec C = t_f(0);
|
||||||
vec FC = t_f(1);
|
vec FC = t_f(1);
|
||||||
vec NA = t_f(2);
|
vec NA = t_f(2);
|
||||||
|
|
||||||
// interval for fitting: left centroid - width left FWHM to right centroid + ...
|
// interval for fitting: left centroid - width left FWHM to right centroid + ...
|
||||||
int CL = floor(C(LIdx) - FitWidth * FC(LIdx));
|
int CL = floor(C(LIdx) - FitWidth * FC(LIdx));
|
||||||
int CR = ceil(C(RIdx) + FitWidth * FC(RIdx));
|
int CR = ceil(C(RIdx) + FitWidth * FC(RIdx));
|
||||||
|
@ -6170,7 +6143,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
rowvec S = baseInfo(s_Spectrum); //S = dmspec(sn, 'Spectrum');
|
rowvec S = baseInfo(s_Spectrum); //S = dmspec(sn, 'Spectrum');
|
||||||
rowvec x = RangeVec2(CL, CR);
|
rowvec x = RangeVec2(CL, CR);
|
||||||
rowvec y = S.cols(CL-1, CR-1);
|
rowvec y = S.cols(CL-1, CR-1);
|
||||||
|
|
||||||
// initial baseline y = k*x + d through extremal points (spectrum data)
|
// initial baseline y = k*x + d through extremal points (spectrum data)
|
||||||
double k = (S(CR) - S(CL)) / (CR -CL);
|
double k = (S(CR) - S(CL)) / (CR -CL);
|
||||||
double d = S(CL) - k * CL;
|
double d = S(CL) - k * CL;
|
||||||
|
@ -6182,7 +6154,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
uvec zeroIdx = find(NA(Af) < minNA);
|
uvec zeroIdx = find(NA(Af) < minNA);
|
||||||
MatAssign(NA, Af(zeroIdx), minNA);
|
MatAssign(NA, Af(zeroIdx), minNA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fit parameters
|
// fit parameters
|
||||||
//[s, BL, Ao, Co, Fo, X2] = fitFunction(x, y, 'peakBaseLin', [k d], [1 2], NA, Af, C, Cf, FC, Ff, addArg{:});
|
//[s, BL, Ao, Co, Fo, X2] = fitFunction(x, y, 'peakBaseLin', [k d], [1 2], NA, Af, C, Cf, FC, Ff, addArg{:});
|
||||||
field<vec> para;
|
field<vec> para;
|
||||||
|
@ -6197,7 +6168,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
Co = para(2);
|
Co = para(2);
|
||||||
Fo = para(3);
|
Fo = para(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write results to temporary PAT
|
// write results to temporary PAT
|
||||||
/*patSetPeaks(allidx, 'FittingMethod', 'Q', 'NetArea', Ao(allidx), ...
|
/*patSetPeaks(allidx, 'FittingMethod', 'Q', 'NetArea', Ao(allidx), ...
|
||||||
'Centroid', Co(allidx), 'FWHM_Ch', Fo(allidx), 'NetAreaFree', Af, ...
|
'Centroid', Co(allidx), 'FWHM_Ch', Fo(allidx), 'NetAreaFree', Af, ...
|
||||||
|
@ -6213,7 +6183,6 @@ bool GammaAnalyALG::fitPeakQuick(vec &Ao, vec &Co, vec &Fo, double &X2, uvec Af,
|
||||||
patSetPeaks(allidx, items, vals);
|
patSetPeaks(allidx, items, vals);
|
||||||
vec sqi, uqi;
|
vec sqi, uqi;
|
||||||
patBaseVar(sqi, uqi, allidx);
|
patBaseVar(sqi, uqi, allidx);
|
||||||
|
|
||||||
// return only fitted parameters
|
// return only fitted parameters
|
||||||
Ao = Ao(Af);
|
Ao = Ao(Af);
|
||||||
Co = Co(Cf);
|
Co = Co(Cf);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.9.1, 2024-08-26T16:15:56. -->
|
<!-- Written by QtCreator 4.9.1, 2024-12-12T15:13:09. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|
|
@ -1424,7 +1424,6 @@ mat vecsum(rowvec y, vec l, vec h)
|
||||||
// sizes of input vectors
|
// sizes of input vectors
|
||||||
int n = y.size();
|
int n = y.size();
|
||||||
int m = l.size();
|
int m = l.size();
|
||||||
|
|
||||||
if(h.size() != m)
|
if(h.size() != m)
|
||||||
{
|
{
|
||||||
qDebug() << "summation indizes must be of same size";
|
qDebug() << "summation indizes must be of same size";
|
||||||
|
@ -1444,7 +1443,6 @@ mat vecsum(rowvec y, vec l, vec h)
|
||||||
|
|
||||||
// integer and fractional part
|
// integer and fractional part
|
||||||
vec rl = round(l);
|
vec rl = round(l);
|
||||||
|
|
||||||
// 0.5 added, since e.g. for integer l, only y(l)/2 accounts to the sum
|
// 0.5 added, since e.g. for integer l, only y(l)/2 accounts to the sum
|
||||||
vec dl = l - rl + 0.5;
|
vec dl = l - rl + 0.5;
|
||||||
|
|
||||||
|
@ -1456,7 +1454,6 @@ mat vecsum(rowvec y, vec l, vec h)
|
||||||
vec rh = round(h);
|
vec rh = round(h);
|
||||||
|
|
||||||
vec dh = rh - h + 0.5;
|
vec dh = rh - h + 0.5;
|
||||||
|
|
||||||
//uvec bh = AndUMat( AndUMat( rh > 0, rh <= n), dh != 0 );
|
//uvec bh = AndUMat( AndUMat( rh > 0, rh <= n), dh != 0 );
|
||||||
//bh.print("bh = ");
|
//bh.print("bh = ");
|
||||||
|
|
||||||
|
@ -1466,15 +1463,16 @@ mat vecsum(rowvec y, vec l, vec h)
|
||||||
{
|
{
|
||||||
// sum from low to high
|
// sum from low to high
|
||||||
//s(i) = sum( y([max(1, rl(i)) : min(n, rh(i))]) );
|
//s(i) = sum( y([max(1, rl(i)) : min(n, rh(i))]) );
|
||||||
if(min(n,rh(i)) < 0) throw std::string(" Row::cols(): indices out of bounds or incorrectly used");
|
|
||||||
s(i) = sum( y.cols( max(1, rl(i))-1, min(n, rh(i))-1 ) );
|
|
||||||
|
|
||||||
|
if(min(n,rh(i)) < 0) throw std::string(" Row::cols(): indices out of bounds or incorrectly used");
|
||||||
|
if(max(1, rl(i))-1 >= y.n_cols || min(n, rh(i))-1 >= y.n_cols || max(1, rl(i))-1 < 0 || min(n, rh(i))-1 < 0)
|
||||||
|
throw std::string(" Row::cols(): indices out of bounds or incorrectly used");
|
||||||
|
s(i) = sum( y.cols( max(1, rl(i))-1, min(n, rh(i))-1 ) );
|
||||||
// fractional part at low border
|
// fractional part at low border
|
||||||
if( rl(i) > 0 && rl(i) <= n && dl(i) != 0 ) // if( bl(i) )
|
if( rl(i) > 0 && rl(i) <= n && dl(i) != 0 ) // if( bl(i) )
|
||||||
{
|
{
|
||||||
s(i) = s(i) - dl(i) * y(rl(i)-1);
|
s(i) = s(i) - dl(i) * y(rl(i)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fractional part at high border
|
// fractional part at high border
|
||||||
if( rh(i) > 0 && rh(i) <= n && dh(i) != 0 ) // if( bh(i) )
|
if( rh(i) > 0 && rh(i) <= n && dh(i) != 0 ) // if( bh(i) )
|
||||||
{
|
{
|
||||||
|
@ -1482,7 +1480,6 @@ mat vecsum(rowvec y, vec l, vec h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// size of l
|
// size of l
|
||||||
s.reshape( size(l) ); //s = reshape(s, sz);
|
s.reshape( size(l) ); //s = reshape(s, sz);
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -1465,13 +1465,13 @@ JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_CalValuesHandler_an
|
||||||
}
|
}
|
||||||
// **************** printf("maplines get\n");
|
// **************** printf("maplines get\n");
|
||||||
|
|
||||||
|
|
||||||
GammaAnalyALG alg;
|
GammaAnalyALG alg;
|
||||||
try {
|
try {
|
||||||
alg.setFilePath(xmlFilePath);
|
alg.setFilePath(xmlFilePath);
|
||||||
alg.setJniBl(env, sendObj, userId);
|
alg.setJniBl(env, sendObj, userId);
|
||||||
alg.AnalyseSpectrum(phd, mapLines);
|
alg.AnalyseSpectrum(phd, mapLines);
|
||||||
} catch (std::string error) {
|
}
|
||||||
|
catch (std::string error) {
|
||||||
QJsonObject errObj;
|
QJsonObject errObj;
|
||||||
errObj["analyFlag"] = false;
|
errObj["analyFlag"] = false;
|
||||||
errObj["analyMessage"] = error.c_str();
|
errObj["analyMessage"] = error.c_str();
|
||||||
|
@ -1480,8 +1480,16 @@ JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_CalValuesHandler_an
|
||||||
QString jsonStr = doc.toJson();
|
QString jsonStr = doc.toJson();
|
||||||
jstring jresult = env->NewStringUTF(jsonStr.toStdString().c_str());
|
jstring jresult = env->NewStringUTF(jsonStr.toStdString().c_str());
|
||||||
return jresult;
|
return jresult;
|
||||||
|
} catch (...) {
|
||||||
|
QJsonObject errObj;
|
||||||
|
errObj["analyFlag"] = false;
|
||||||
|
errObj["analyMessage"] = "update calibration error";
|
||||||
|
QJsonDocument doc;
|
||||||
|
doc.setObject(errObj);
|
||||||
|
QString jsonStr = doc.toJson();
|
||||||
|
jstring jresult = env->NewStringUTF(jsonStr.toStdString().c_str());
|
||||||
|
return jresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// **************** printf("AnalyseSpectrum calc\n");
|
// **************** printf("AnalyseSpectrum calc\n");
|
||||||
|
|
||||||
QJsonObject resultjson;
|
QJsonObject resultjson;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user