Speed up getTransimissionData.
This commit is contained in:
@@ -301,7 +301,7 @@ CEInfo Recon::getCEInfo(Parser* aParser, const MeasurementInfo aInfo)
|
||||
}
|
||||
result.ce = ce;
|
||||
result.ceOffSet = aParser->getCEData().getCEOffset();
|
||||
result.ce_sf = aInfo.sampleRate;
|
||||
result.ce_sf = aParser->getCEData().getCE_SF();
|
||||
if (aInfo.Hardware == "USCT3dv3")
|
||||
{
|
||||
size_t size = aParser->getMetaData().getTasIndices().getLength();
|
||||
|
||||
@@ -37,6 +37,12 @@ namespace
|
||||
Matrix receiverBlock;
|
||||
Matrix waterTempBlock;
|
||||
MetaInfos metaInfos;
|
||||
|
||||
Matrix ascanBlock;
|
||||
Matrix ascanBlockRef;
|
||||
Matrix dists;
|
||||
Matrix distRefBlock;
|
||||
Matrix waterTempRefBlock;
|
||||
};
|
||||
|
||||
Matrix prepareAScansForTransmissionDetection(const Matrix& aAscanBlock, const Matrix& aGainBlock)
|
||||
@@ -169,12 +175,19 @@ namespace
|
||||
result.receiverBlock = blockData.receiverPositionBlock;
|
||||
result.waterTempBlock = waterTempBlock;
|
||||
|
||||
DetectResult detect = transmissionDetection(ascanBlock, ascanBlockRef, dists, distRefBlock, waterTempBlock, waterTempRefBlock, aExpectedSOSWater[0]);
|
||||
result.attData = detect.att;
|
||||
result.tofData = detect.tof;
|
||||
result.ascanBlock = ascanBlock;
|
||||
result.ascanBlockRef = ascanBlockRef;
|
||||
result.dists = dists;
|
||||
result.distRefBlock = distRefBlock;
|
||||
result.waterTempRefBlock = waterTempRefBlock;
|
||||
|
||||
// DetectResult detect = transmissionDetection(ascanBlock, ascanBlockRef, dists, distRefBlock, waterTempBlock, waterTempRefBlock, aExpectedSOSWater[0]);
|
||||
// result.attData = detect.att;
|
||||
// result.tofData = detect.tof;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
||||
@@ -228,20 +241,54 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
rnBlockTotal = zeros(1,numScans,1);
|
||||
}
|
||||
|
||||
size_t vectorSize = aMotorPos.getDataSize() * (aSlList.getDataSize() / transParams::senderTASSize) * (aSnList.getDataSize() / transParams::senderElementSize);
|
||||
std::vector<BlockOfTransmissionData> blockOfTransmissionDatas(vectorSize);
|
||||
|
||||
int numData = 0;
|
||||
int numPossibleScans = 0;
|
||||
|
||||
for(int i=0; i<aMotorPos.getDataSize(); ++i)
|
||||
{
|
||||
#pragma omp parallel for num_threads(24)
|
||||
for(int j=0; j<aSlList.getDataSize() / transParams::senderTASSize; ++j)
|
||||
{
|
||||
for(int k=0; k<aSnList.getDataSize() / transParams::senderElementSize; ++k)
|
||||
{
|
||||
size_t index = i * (aSlList.getDataSize() / transParams::senderTASSize) * (aSnList.getDataSize() / transParams::senderElementSize) +
|
||||
j * (aSnList.getDataSize() / transParams::senderElementSize) + k;
|
||||
Matrix mp = aMotorPos(i).toMatrix();
|
||||
Matrix mpRef = aMotoPosRef(i).toMatrix();
|
||||
Matrix sl = aSlList.block(0, transParams::senderTASSize*j, transParams::senderTASSize*j+transParams::senderTASSize - 1);
|
||||
Matrix sn = aSnList.block(0, transParams::senderElementSize*k, transParams::senderElementSize*k+transParams::senderElementSize - 1);
|
||||
blockOfTransmissionDatas[index] = getBlockOfTransmissionData(mp,mpRef,sl,sn,aRlList,aRnList,tasTemps,aTemp.expectedSOSWater,aGeom,aGeomRef,rmsNoise,rmsNoiseRef,aExpInfo,aExpInfoRef,aPreComputes,aParser, aParserRef);
|
||||
std::cout<<numPossibleScans<<std::endl;
|
||||
numPossibleScans++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<aMotorPos.getDataSize(); ++i)
|
||||
{
|
||||
for(int j=0; j<aSlList.getDataSize() / transParams::senderTASSize; ++j)
|
||||
{
|
||||
for(int k=0; k<aSnList.getDataSize() / transParams::senderElementSize; ++k)
|
||||
{
|
||||
Matrix mp = aMotorPos(i).toMatrix();
|
||||
Matrix mpRef = aMotoPosRef(i).toMatrix();
|
||||
Matrix sl = aSlList.block(0, transParams::senderTASSize*j, transParams::senderTASSize*j+transParams::senderTASSize - 1);
|
||||
Matrix sn = aSnList.block(0, transParams::senderElementSize*k, transParams::senderElementSize*k+transParams::senderElementSize - 1);
|
||||
auto transmissionBlock = getBlockOfTransmissionData(mp,mpRef,sl,sn,aRlList,aRnList,tasTemps,aTemp.expectedSOSWater,aGeom,aGeomRef,rmsNoise,rmsNoiseRef,aExpInfo,aExpInfoRef,aPreComputes,aParser, aParserRef);
|
||||
// Matrix mp = aMotorPos(i).toMatrix();
|
||||
// Matrix mpRef = aMotoPosRef(i).toMatrix();
|
||||
// Matrix sl = aSlList.block(0, transParams::senderTASSize*j, transParams::senderTASSize*j+transParams::senderTASSize - 1);
|
||||
// Matrix sn = aSnList.block(0, transParams::senderElementSize*k, transParams::senderElementSize*k+transParams::senderElementSize - 1);
|
||||
// auto transmissionBlock = getBlockOfTransmissionData(mp,mpRef,sl,sn,aRlList,aRnList,tasTemps,aTemp.expectedSOSWater,aGeom,aGeomRef,rmsNoise,rmsNoiseRef,aExpInfo,aExpInfoRef,aPreComputes,aParser, aParserRef);
|
||||
|
||||
size_t index = i * (aSlList.getDataSize() / transParams::senderTASSize) * (aSnList.getDataSize() / transParams::senderElementSize) +
|
||||
j * (aSnList.getDataSize() / transParams::senderElementSize) + k;
|
||||
|
||||
DetectResult detect = transmissionDetection( blockOfTransmissionDatas[index].ascanBlock, blockOfTransmissionDatas[index].ascanBlockRef,
|
||||
blockOfTransmissionDatas[index].dists, blockOfTransmissionDatas[index].distRefBlock,
|
||||
blockOfTransmissionDatas[index].waterTempBlock, blockOfTransmissionDatas[index].waterTempRefBlock,
|
||||
aTemp.expectedSOSWater[0]);
|
||||
blockOfTransmissionDatas[index].attData = detect.att;
|
||||
blockOfTransmissionDatas[index].tofData = detect.tof;
|
||||
BlockOfTransmissionData transmissionBlock=blockOfTransmissionDatas[index];
|
||||
size_t numUsedData = transmissionBlock.senderBlock.getDimSize(1);
|
||||
if(transParams::applyCalib)
|
||||
{
|
||||
@@ -265,7 +312,6 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.rnBlock.getData(), 1, rnBlockTotal.getData() + numData, 1);
|
||||
}
|
||||
numData += numUsedData;
|
||||
std::cout<<j<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,7 +351,6 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
Matrix valid;
|
||||
if(transParams::applyCalib)
|
||||
{
|
||||
double* snr = Aurora::malloc(numData);
|
||||
valid = findDefectTransmissionData(Matrix::copyFromRawData(snrValues.getData(), 1, numData), transParams::snrThreshold) *
|
||||
findDefectTransmissionData(Matrix::copyFromRawData(snrValuesRef.getData(), 1, numData), transParams::snrThreshold);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user