23 US_Model* model, QStringList& mieGUIDs, QStringList& nieGUIDs )
35 QString daEditGUID = edata->
editGUID;
36 QString modelGUID = ( model == 0 ) ?
41 DbgLv(2) <<
"LaNoi:editGUID " << daEditGUID;
42 DbgLv(2) <<
"LaNoi:modelGUID " << modelGUID;
43 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
51 for (
int ii = 0; ii <
noiIDs.size(); ii++ ) {
52 DbgLv(2) <<
"LaNoi:allNoi nID eID mID type" <<
noiIDs.at(ii)
54 for (
int ii = 0; ii <
modIDs.size(); ii++ ) {
62 QApplication::restoreOverrideCursor();
66 int latemx = ondisk ? nemods - 1 : 0;
70 modelGUID = mieGUIDs[ latemx ];
78 modelGUID = mieGUIDs[ latemx ];
83 if ( modelGUID != mieGUIDs[ 0 ] )
85 if ( ! mieGUIDs.removeOne( modelGUID ) )
87 qDebug(
"*ERROR* Loaded/Latest model not in model-in-edit list!" );
88 QApplication::restoreOverrideCursor();
92 mieGUIDs.insert( 0, modelGUID );
105 for (
int ii = 1; ii < nemods; ii++ )
107 lmodlGUID = mieGUIDs[ ii ];
108 modelIndx = QString().sprintf(
"%4.4d", kk );
115 nenois += qMin( 2, kenois );
117 lnoisGUID = tmpGUIDs.at( 0 ).section(
":", 0, 1 )
119 nieGUIDs << lnoisGUID;
122 lnoisGUID = tmpGUIDs.at( 1 ).section(
":", 0, 1 )
124 nieGUIDs << lnoisGUID;
126 DbgLv(2) <<
"LaNoi: kenois nenois niesz" << kenois << nenois << nieGUIDs.size();
131 DbgLv(2) <<
"LaNoi:nemods nmnois nenois" << nemods << nmnois << nenois;
132 for (
int jj=0;jj<nenois;jj++)
133 DbgLv(2) <<
"LaNoi: jj nieG" << jj << nieGUIDs.at(jj);
134 QApplication::restoreOverrideCursor();
143 amsg = tr(
", associated with the loaded edit.\n" );
146 amsg = tr(
", associated with the loaded edit/model.\n" );
150 msg = tr(
"There are noise files" ) + amsg
151 + tr(
"Do you want to load some of them?" );
156 QString noiID = nieGUIDs.at( 0 ).section(
":", 0, 0 );
160 i_noise.
load(
false, noiID, NULL );
165 i_noise.
load(
true, noiID, &db );
168 double datmin = edata->
value( 0, 0 );
169 double datmax = datmin;
170 double noimin = 1.0e10;
171 double noimax = -noimin;
174 for (
int ii = 0; ii < edata->
scanData.size(); ii++ )
176 for (
int jj = 0; jj < npoint; jj++ )
178 double datval = edata->
value( ii, jj );
179 datmin = qMin( datmin, datval );
180 datmax = qMax( datmax, datval );
184 for (
int ii = 0; ii < i_noise.
values.size(); ii++ )
186 double noival = i_noise.
values[ ii ];
187 noimin = qMin( noimin, noival );
188 noimax = qMax( noimax, noival );
191 if ( ( noimax - noimin ) > ( datmax - datmin ) )
194 + tr(
"\nBUT THE NOISE HAS AN UNUSUALLY LARGE DATA RANGE.\n\n" );
197 msg = tr(
"There is a noise file" ) + amsg
198 + tr(
"Do you want to load it?" );
201 msgBox.setWindowTitle( tr(
"Edit/Model Associated Noise" ) );
202 msgBox.setText( msg );
203 msgBox.setStandardButtons( QMessageBox::No | QMessageBox::Yes );
204 msgBox.setDefaultButton( QMessageBox::Yes );
206 if ( msgBox.exec() != QMessageBox::Yes )
213 for (
int ii = 0; ii < ( nemods - kk ); ii++ )
214 mieGUIDs.removeLast();
223 QStringList& mGUIDs )
231 DbgLv(2) <<
"LaNoi:MIE: ondisk" << ondisk;
233 for (
int ii = 0; ii <
modIDs.size(); ii++ )
238 if ( eGUID == xeGUID )
244 return mGUIDs.size();
249 QStringList& nGUIDs )
257 for (
int ii = 0; ii <
noiIDs.size(); ii++ )
259 xnGUID =
noiIDs .at( ii );
264 xntype = xntype.contains(
"ri_nois", Qt::CaseInsensitive ) ?
267 if ( mGUID == xmGUID )
268 nGUIDs << xnGUID +
":" + xntype +
":0000";
271 return nGUIDs.size();
287 query <<
"get_editID" << daEditGUID;
290 QString daEditID = db.value( 0 ).toString();
291 DbgLv(2) <<
"LaNoi:idlDB: daEdit ID GUID" << daEditID << daEditGUID;
306 query <<
"get_noise_desc_by_editID" << invID << daEditID;
311 noiEdID = db.value( 2 ).toString();
313 noiIDs << db.value( 1 ).toString();
314 noiTypes << db.value( 4 ).toString();
315 noiMoIDs << db.value( 5 ).toString();
321 query <<
"get_model_desc_by_editID" << invID << daEditID;
326 QString modGUID = db.value( 1 ).toString();
327 QString modEdID = db.value( 6 ).toString();
329 if (
noiMoIDs.contains( modGUID ) && modEdID == daEditID )
332 modDescs << db.value( 2 ).toString();
333 modEdIDs << db.value( 5 ).toString();
339 for (
int ii =
modIDs.size() - 1; ii >=0; ii-- )
342 QString asysID = mdesc.section(
".", -2, -2 );
343 bool mCarlo = ( asysID.contains(
"-MC" ) &&
344 asysID.contains(
"_mc" ) );
345 QString reqID = asysID.section(
"_", 0, -2 );
349 if ( reqIDs.contains( reqID ) )
364 for (
int ii = 0; ii <
noiTypes.size(); ii++ )
367 int jj =
modIDs.indexOf( moGUID );
368 DbgLv(2) <<
"LaNoi:idlDB: ii jj moGUID" << ii << jj << moGUID;
370 QString edGUID = ( jj < 0 ) ?
"" :
modEdIDs.at( jj );
395 QStringList filter(
"N*.xml" );
396 QStringList f_names = dir.entryList( filter, QDir::Files, QDir::Name );
398 QXmlStreamAttributes attr;
400 for (
int ii = 0; ii < f_names.size(); ii++ )
402 QString fname( path +
"/" + f_names[ ii ] );
403 QFile m_file( fname );
405 if ( !m_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
408 QXmlStreamReader xml( &m_file );
410 while ( ! xml.atEnd() )
414 if ( xml.isStartElement() && xml.name() ==
"noise" )
416 attr = xml.attributes();
417 noiIDs << attr.value(
"noiseGUID" ).toString();
418 noiMoIDs << attr.value(
"modelGUID" ).toString();
419 noiTypes << attr.value(
"type" ).toString();
435 f_names = dir.entryList( filter, QDir::Files, QDir::Name );
437 for (
int ii = 0; ii < f_names.size(); ii++ )
439 QString fname( path +
"/" + f_names[ ii ] );
440 QFile m_file( fname );
442 if ( !m_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
445 QXmlStreamReader xml( &m_file );
447 while ( ! xml.atEnd() )
451 if ( xml.isStartElement() && xml.name() ==
"model" )
453 attr = xml.attributes();
454 QString modelID = attr.value(
"modelGUID" ).toString();
455 QString editID = attr.value(
"editGUID" ).toString();
456 QString reqGUID = attr.value(
"requestGUID" ).toString();
457 QString mcst = attr.value(
"monteCarlo" ).toString();
458 bool mCarlo = ( ! mcst.isEmpty() && mcst !=
"0" );
460 if (
noiMoIDs.contains( modelID ) && editID == daEditGUID )
464 if ( reqIDs.contains( reqGUID ) )
480 QString dmyGUID =
"00000000-0000-0000-0000-000000000000";
483 for (
int ii = 0; ii <
noiMoIDs.size(); ii++ )
485 QString modelID =
noiMoIDs.at( ii );
486 int jj =
modIDs.indexOf( modelID );
487 QString editID = jj >=0 ?
modEdIDs.at( jj ) : dmyGUID;