Skip to content
Snippets Groups Projects
Commit 1d504264 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Merged core algorithm of mpaf with that of mpa.

parent 9a207a00
No related branches found
No related tags found
No related merge requests found
......@@ -164,25 +164,16 @@ void NManip::points_rebin_by_factor()
for ( int j=0; j<fin->nJ(); j++ ) {
RSpec sin = fin->VS(j);
PSpec sout( new CSpec() );
sout->z = sin->z;
if ( sin->size()<ng )
int nout = sin->size() / ng;
if ( nout<1 )
throw "not enough points in spectrum " + S(j);
vector<int> breaks( nout+1 );
for ( int iout=0; iout<nout+1; ++iout )
breaks[iout] = iout*ng;
PSpec sout = sin->binned( breaks );
for ( int iv=0; iv<sin->size()/ng; ++iv ) {
double xg = 0, yg = 0, vg = 0;
for ( int i=iv*ng; i<(iv+1)*ng; ++i ) {
xg += sin->x[i];
yg += sin->y[i];
if ( sin->has_dy() )
vg += SQR( sin->dy[i] );
}
if ( sin->has_dy() )
sout->push_xyd(xg/ng, yg/ng, sqrt(vg)/ng );
else
sout->push_xy(xg/ng, yg/ng );
}
fout->V.push_back(sout);
}
NOlm::mem_store( fout, fiter.k() );
......
#!/usr/bin/env frida
fm 7 7 h
0 oy j+i
fm 9 1 h
0 oy 3+i
1 mpa 0,3
throw_unless(abs(y[2,3,0]-(3+1))<1e-15,"mpa_test11")
throw_unless(abs(y[2,3,1]-(3+4.5))<1e-15,"mpa_test12")
throw_unless(abs(y[2,0,0]-(3+1))<1e-15,"mpa_test11")
throw_unless(abs(y[2,0,1]-(3+5.5))<1e-15,"mpa_test12")
1 mpaf 3
throw_unless(ni[3,3]==2,"mpa_test20")
throw_unless(abs(y[3,3,0]-(3+1))<1e-15,"mpa_test21")
throw_unless(abs(y[3,3,1]-(3+4))<1e-15,"mpa_test22")
throw_unless(ni[3,0]==3,"mpa_test20")
throw_unless(abs(y[3,0,0]-(3+1))<1e-15,"mpa_test21")
throw_unless(abs(y[3,0,2]-(3+7))<1e-15,"mpa_test22")
1 mpaf 4
throw_unless(ni[4,0]==2,"mpa_test30")
throw_unless(abs(y[4,0,0]-(3+1.5))<1e-15,"mpa_test31")
throw_unless(abs(y[4,0,1]-(3+5.5))<1e-15,"mpa_test32")
exit(1)
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