diff --git a/pub/CHANGELOG b/pub/CHANGELOG index 2c97a49e91eca00ba5f88de5bd20e09cb7bda6cd..094e89b53b60d23ca8c707f1ad3ae60696864bde 100644 --- a/pub/CHANGELOG +++ b/pub/CHANGELOG @@ -1,6 +1,6 @@ Release 2.1.8f of -- new command ftvd to read x-y-dy lines +- new commands ftvd (to read x-y-dy lines), oixyd - improved error message from convolution Release 2.1.8e of 19nov13, to be used with frida2libs-131120: diff --git a/pub/src/commands.cpp b/pub/src/commands.cpp index b2b31838ad3cd560c6672a223529e50c13496a1b..8fa6d1a8558c38c65bc757e66fc12689ae141a07 100644 --- a/pub/src/commands.cpp +++ b/pub/src/commands.cpp @@ -508,6 +508,7 @@ bool fridaCommand( string cmd ) " oi rank-reducing (""integral"") operations\n" " oio ditto with oldstyle menu\n" " oixy choose two columns, save them as x and y\n" + " oixyd choose three columns, save them as x, y, dy\n" ; } else if (cmd == "op") { @@ -524,8 +525,8 @@ bool fridaCommand( string cmd ) NOperate::Functional( cmd.substr(2) ); } else if (cmd == "oi") { NOperate::Integral(); - } else if (cmd == "oixy") { - NOperate::IntXY(); + } else if (cmd.substr(0,4) == "oixy") { + NOperate::IntXY( cmd.substr(2) ); } else if (cmd == "oio") { NIntOld::Opr(); diff --git a/pub/src/opr.cpp b/pub/src/opr.cpp index 9f1c335014421652d1934fa180d845bbea60f5d4..f915ac9ddc310707dbfbdb4a3671c37e2e3f7507 100644 --- a/pub/src/opr.cpp +++ b/pub/src/opr.cpp @@ -318,16 +318,28 @@ void NOperate::Integral(void) //! Integral operations to generate not only new y, but also new x. -void NOperate::IntXY(void) +void NOperate::IntXY( string mode ) { NOlm::IterateD fiter; - static int icolx = 0, icoly = 1; + bool with_d; + if ( mode=="xy" ) + with_d = false; + else if ( mode=="xyd" ) + with_d = true; + else + throw "invalid command"; + + static int icolx = 0, icoly = 1, icold = 2; static CCoord xco, yco; icolx = iask( "x from column", icolx ); if( icolx<0) return; icoly = iask( "y from column", icoly ); if( icoly<0) return; + if ( with_d ) { + icold = iask( "dy from column", icold ); + if( icold<0) return; + } xco = CCoord( "x", "" ); yco = CCoord( "y", "" ); @@ -344,9 +356,15 @@ void NOperate::IntXY(void) for ( int j=0; j<fin->nJ(); j++ ) { int n = fin->nPts(j); - if( icolx>=n || icoly>=n ) + if( icolx>=n || icoly>=n || (with_d && icold>=n) ) throw "not enough columns in spectrum " + S(j); - sout->push_xy( fin->VS(j)->y[icolx], fin->VS(j)->y[icoly] ); + if ( with_d ) + sout->push_xyd( fin->VS(j)->y[icolx], + fin->VS(j)->y[icoly], + fin->VS(j)->y[icold] ); + else + sout->push_xy( fin->VS(j)->y[icolx], + fin->VS(j)->y[icoly] ); sout->z = fin->VS(j)->z; if ( nz ) { // new spectrum if jump in any z values if ( j+1 < fin->nJ() && fin->V[j+1]->z != fin->V[j]->z ) { diff --git a/pub/src/opr.hpp b/pub/src/opr.hpp index f8536e60c7888b2bae93ef6fb5f0e76f18c7a2b2..cedb521ec41e5d256b6e108e8b9a307d7c221866 100644 --- a/pub/src/opr.hpp +++ b/pub/src/opr.hpp @@ -14,7 +14,7 @@ namespace NOperate { void select( bool askdelete ); void Pointwise( string llabel ); void Integral(); - void IntXY(); + void IntXY( string mode ); void Functional( const string& subcmd ); }