Skip to content

Commit

Permalink
Refs #5534 extended ftq_Re and fqt_Im to negative times
Browse files Browse the repository at this point in the history
modified: LoadSassena.cpp
modified: LoadSassenaTest.h
  • Loading branch information
jmborr committed Jun 23, 2012
1 parent 8e6ea00 commit 1f38dad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
23 changes: 15 additions & 8 deletions Code/Mantid/Framework/DataHandling/src/LoadSassena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ void LoadSassena::loadFQ(const hid_t& h5file, API::WorkspaceGroup_sptr gws, cons
}

/**
* Create one workspace to hold the real part and another to hold the imaginary part
* Create one workspace to hold the real part and another to hold the imaginary part.
* We symmetrize the structure factor to negative times
* Y-values are structure factor for each Q-value
* X-values are time bins
* @param h5file file identifier
Expand All @@ -197,8 +198,10 @@ void LoadSassena::loadFQT(const hid_t& h5file, API::WorkspaceGroup_sptr gws, con
double dt = 1.0; //time unit increment;
hsize_t dims[3];
this->dataSetInfo(h5file, setName, dims);
int nt = static_cast<int>( dims[1] ); //number of time points
double* buf = new double[nq*nt*2];
int nnt = static_cast<int>( dims[1] ); //number of non-negative time points
int nt = 2*nnt - 1; //number of time points
int origin = nnt-1;
double* buf = new double[nq*nnt*2];
this->dataSetDouble(h5file,setName,buf);

DataObjects::Workspace2D_sptr wsRe = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(API::WorkspaceFactory::Instance().create("Workspace2D", nq, nt, nt));
Expand All @@ -216,13 +219,17 @@ void LoadSassena::loadFQT(const hid_t& h5file, API::WorkspaceGroup_sptr gws, con
MantidVec& imX = wsIm->dataX(iq);
MantidVec& reY = wsRe->dataY(iq);
MantidVec& imY = wsIm->dataY(iq);
for(int it=0; it<nt; it++)
for(int it=0; it<nnt; it++)
{
reX[it] = it*dt; // time point for the real part
reY[it] = *curr; // real part of the intermediate structure factor
reX[origin+it] = it*dt; // time point for the real part
reY[origin+it] = *curr; // real part of the intermediate structure factor
reX[origin-it] = -it*dt; // symmetric negative time
reY[origin-it] = *curr; // symmetric value for the negative time
curr ++;
imX[it] = it*dt;
imY[it] = *curr;
imX[origin+it] = it*dt;
imY[origin+it] = *curr;
imX[origin-it] = -it*dt;
imY[origin-it] = *curr;
curr ++;
}
}
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/Framework/DataHandling/test/LoadSassenaTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ class LoadSassenaTest : public CxxTest::TestSuite

//Test fq Real part
ws = boost::dynamic_pointer_cast<DataObjects::Workspace2D>( gws->getItem("outGWS_fqt.Re") );
TS_ASSERT_DELTA( ws->readY(4)[7], 1918.2156, 1e-04 );
TS_ASSERT_DELTA( ws->readY(4)[0], 1918.2156, 1e-04 );
TS_ASSERT_DELTA( ws->readY(4)[14], 1918.2156, 1e-04 );

//Test fq Imaginary part
ws = boost::dynamic_pointer_cast<DataObjects::Workspace2D>( gws->getItem("outGWS_fqt.Im") );
TS_ASSERT_DELTA( ws->readY(4)[7], 656.82368, 1e-05 );
TS_ASSERT_DELTA( ws->readY(4)[0], 656.82368, 1e-05 );
TS_ASSERT_DELTA( ws->readY(4)[14], 656.82368, 1e-05 );

} // end of testExec

Expand Down

0 comments on commit 1f38dad

Please sign in to comment.