diff --git a/pub/CHANGELOG b/pub/CHANGELOG index 0d61598b3d88da971764dbd6f0270bb262218c28..bcfeb35035d60ea1a7eee0ff7bbfc0dfd5aa69ab 100644 --- a/pub/CHANGELOG +++ b/pub/CHANGELOG @@ -1,5 +1,6 @@ - New conversion script i96-to-yda +- Print info when new fit curve gets constant weighing. Release 2.3.3f of 3aug16: diff --git a/pub/ftest/fthb.tab b/pub/ftest/fthb.tab new file mode 100644 index 0000000000000000000000000000000000000000..3fc2517747b0cb402702d37cd31d1e5c8594af58 --- /dev/null +++ b/pub/ftest/fthb.tab @@ -0,0 +1,5 @@ +0 1 2 +3 4 5 + +6 7 8 +9 10 11 diff --git a/pub/lib/commands.cpp b/pub/lib/commands.cpp index cd8c8c253dbd007fbf485f25906943abe860b33b..e42246e200a9a8750059299d45a9ec2f09209bbe 100644 --- a/pub/lib/commands.cpp +++ b/pub/lib/commands.cpp @@ -266,11 +266,12 @@ bool frida_command( string cmd ) " fx exchange (copy, then delete source)\n" " fdel delete\n" " fm make\n" - " ft(h|v|c)[m][s][d] read tab\n" + " ft(h|v|c)[m|b][s][d] read tab\n" " h horizontal (only y values, one line per spectrum)\n" " v vertical (one x-y pair per line)\n" " c choose vertical columns\n" " m multi-block (blocks begin with z line)\n" + " b multi-block (without z lines)\n" " s from script\n" " d input includes dy\n" ; diff --git a/pub/lib/curve.cpp b/pub/lib/curve.cpp index 01fe1c73e9648d5e1691ddc833af376a3f12e5f9..a0070bf7d10a2af81c4853bdf822f4c0402e2f13 100644 --- a/pub/lib/curve.cpp +++ b/pub/lib/curve.cpp @@ -52,7 +52,11 @@ void NCurveFile::create_fitcurve() fout->ZCo = fd->ZCo; fout->RPar = fd->RPar; fout->log_action( "cc " + fc->expr + " # z from " + fd->name ); - fout->weighing = fd->has_nonzero_dy() ? COlc::_VAR : COlc::_LIN; + fout->weighing = COlc::_VAR; + if( fd->has_nonzero_dy() ) { + fout->weighing = COlc::_LIN; + cout << "Constant weight since there are data points with dy=0\n"; + } for (int j=0; j<fd->nJ(); j++) { PCurve sout( new CCurve ); sout->z = fd->VS(j)->z; diff --git a/pub/lib/import.cpp b/pub/lib/import.cpp index 261bc83d9e71a49cd218124355c8d02d4921155e..2f89b2f12a485b6ba1de5388dbdb0680f2d3fd2c 100644 --- a/pub/lib/import.cpp +++ b/pub/lib/import.cpp @@ -26,7 +26,7 @@ void NImport::read_tab( string qualif ) { // EMBEDDED_DIALOG // ** parse qualif ** - if( qualif.find_first_not_of("hvcsmd")!=string::npos ) + if( qualif.find_first_not_of("hvcsbmd")!=string::npos ) throw S("invalid qualifier"); char dir = qualif[0]; if( !( dir=='h' || dir=='v' || dir=='c' ) ) @@ -36,6 +36,9 @@ void NImport::read_tab( string qualif ) static int iycol=0; bool fromscript = qualif.find('s')!=string::npos; bool multiblock = qualif.find('m')!=string::npos; + bool simpleblock = qualif.find('b')!=string::npos; + if (multiblock && simpleblock) + throw S("incompatible options bm"); bool with_d = qualif.find('d')!=string::npos; if( horizontal && with_d ) throw S("incompatible options hd"); @@ -98,6 +101,7 @@ void NImport::read_tab( string qualif ) double val; PSpec s; while( triv::freadln(fd, &lin) ) { + cout << "DEBUG '" << lin << "'\n"; ++n_in; if( lin.substr(0,4)=="#rpa" ){ triv::string_extract_word( lin.substr(4), &s1, &s2 ); @@ -113,22 +117,30 @@ void NImport::read_tab( string qualif ) if( nline==-1 ) { // start of block if( !horizontal && nblock!=0 && s && s->size()>0 ) fout->V.push_back( move(s) ); - if ( multiblock ) { + if( multiblock ) { if( !triv::str2vec(lin, &zdat, 0, false) ) throw "invalid header line [" + lin + "] (or legitimate break ?)"; if( nblock==0 ){ // first header nzdat = zdat.size(); - nz += nzdat; for( int iz=0; iz<nzdat; ++iz ) fout->ZCo.push_back( CCoord("z"+S(iz), "") ); } else if( zdat.size() != nzdat ) throw "line " + S(n_in) + ": header has length " + S(zdat.size()) + " instead of " + S(nzdat); + } else if( simpleblock ) { + if( nblock==0 ) // first header + fout->ZCo.push_back( CCoord("#block", "") ); + cout << "DEBUG SB " << nblock << "\n"; + nzdat = 1; + zdat.resize( 1, (double)nblock ); + cout << "DEBUG ZD0 " << zdat[0] << "\n"; } - if ( nblock==0 && horizontal ) { - nz += 1; + if( nblock==0 && horizontal ) { + nz = 1; + if( multiblock || simpleblock ) + nz += nzdat; fout->ZCo.push_back( CCoord("line", "") ); } if( !horizontal ){ @@ -144,10 +156,11 @@ void NImport::read_tab( string qualif ) } if( lin=="" && nline!=-1 ) { // end-of-block + cout << "DEBUG EL\n"; nline = -1; - ++nblock; continue; } + cout << "DEBUG DL " << nblock << "\n"; // regular data line if( !triv::str2vec(lin, &dat, 0, false) )