-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from project8/develop
Develop
- Loading branch information
Showing
16 changed files
with
690 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"generators": | ||
[ | ||
"planewave-signal", | ||
"lpf-fft", | ||
"decimate-signal", | ||
"digitizer" | ||
], | ||
|
||
"planewave-signal": | ||
{ | ||
"lo-frequency": 25.8781e9, | ||
"planewave-frequency": 25.9281e9, | ||
"array-radius": 0.05, | ||
"npatches-per-strip": 22, | ||
"patch-spacing": 0.0068, | ||
"feed": "quadrature", | ||
"phase-delay": 0 | ||
}, | ||
|
||
"kass-signal": | ||
{ | ||
"lo-frequency": 25.3106e9, | ||
"pitchangle-filename": "/home/hep/baker/ps48/locust_mc/cbuild/bin/pitchangles.txt", | ||
"xml-filename": "/home/hep/baker/ps48/locust_mc/Config/Tutorial/Project8Phase1_WithRoot_Template.xml" | ||
}, | ||
|
||
"patch-signal": | ||
{ | ||
"lo-frequency": 25.8781e9, | ||
"array-radius": 0.05, | ||
"npatches-per-strip": 21, | ||
"patch-spacing": 0.0054, | ||
"feed": "corporate", | ||
"xml-filename": "/home/hep/baker/ps48/locust_mc/Config/Tutorial/Project8Phase3_WithRoot_Template.xml" | ||
}, | ||
|
||
"freefield-signal": | ||
{ | ||
"lo-frequency": 25.2814e9, | ||
"xml-filename": "/home/penny/locust_mc/Config/Tutorial/Project8Phase3_WithRoot_Template.xml" | ||
}, | ||
|
||
"simulation": | ||
{ | ||
"egg-filename": "/home/penny/locust_mc/cbuild/bin/locust_mc.egg", | ||
"n-records": 1, | ||
"record-size": 81920, | ||
"n-channels": 1 | ||
}, | ||
|
||
"gaussian-noise": | ||
{ | ||
"noise-floor": 4.2e-22, | ||
"domain": "time" | ||
}, | ||
|
||
"digitizer": | ||
{ | ||
"v-range": 3.0e-6, | ||
"v-offset": -1.5e-6 | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* LMCHighPassFilterFFTGenerator.cc | ||
* | ||
* Created on: Feb. 14 2019 | ||
* Author: plslocum | ||
*/ | ||
|
||
#include "LMCHighPassFilterFFTGenerator.hh" | ||
|
||
#include "logger.hh" | ||
|
||
|
||
using std::string; | ||
|
||
namespace locust | ||
{ | ||
LOGGER( lmclog, "HighPassFilterFFTGenerator" ); | ||
|
||
MT_REGISTER_GENERATOR(HighPassFilterFFTGenerator, "hpf-fft"); | ||
|
||
HighPassFilterFFTGenerator::HighPassFilterFFTGenerator( const std::string& aName ) : | ||
Generator( aName ), | ||
fDoGenerateFunc( &HighPassFilterFFTGenerator::DoGenerateTime ), | ||
fThreshold ( 1.0e6 ) // 1 MHz | ||
{ | ||
fRequiredSignalState = Signal::kTime; | ||
} | ||
|
||
HighPassFilterFFTGenerator::~HighPassFilterFFTGenerator() | ||
{ | ||
} | ||
|
||
bool HighPassFilterFFTGenerator::Configure( const scarab::param_node* aParam ) | ||
{ | ||
if( aParam == NULL) return true; | ||
|
||
if( aParam->has( "threshold" ) ) | ||
{ | ||
SetThreshold( aParam->get_value< double >( "threshold", fThreshold ) ); | ||
} | ||
return true; | ||
} | ||
|
||
double HighPassFilterFFTGenerator::GetThreshold() const | ||
{ | ||
return fThreshold; | ||
} | ||
|
||
void HighPassFilterFFTGenerator::SetThreshold( double aThreshold ) | ||
{ | ||
fThreshold = aThreshold; | ||
return; | ||
} | ||
|
||
|
||
void HighPassFilterFFTGenerator::Accept( GeneratorVisitor* aVisitor ) const | ||
{ | ||
aVisitor->Visit( this ); | ||
return; | ||
} | ||
|
||
|
||
bool HighPassFilterFFTGenerator::DoGenerate( Signal* aSignal ) | ||
{ | ||
return (this->*fDoGenerateFunc)( aSignal ); | ||
} | ||
|
||
bool HighPassFilterFFTGenerator::DoGenerateTime( Signal* aSignal ) | ||
{ | ||
const unsigned nchannels = fNChannels; | ||
double CutoffFreq = fThreshold; | ||
int nwindows = 10; | ||
int windowsize = aSignal->TimeSize()/nwindows; | ||
|
||
|
||
fftw_complex *SignalComplex; | ||
SignalComplex = (fftw_complex*)fftw_malloc( sizeof(fftw_complex) * windowsize ); | ||
fftw_complex *FFTComplex; | ||
FFTComplex = (fftw_complex*)fftw_malloc( sizeof(fftw_complex) * windowsize ); | ||
|
||
fftw_plan ForwardPlan; | ||
ForwardPlan = fftw_plan_dft_1d(windowsize, SignalComplex, FFTComplex, FFTW_FORWARD, FFTW_ESTIMATE); | ||
fftw_plan ReversePlan; | ||
ReversePlan = fftw_plan_dft_1d(windowsize, FFTComplex, SignalComplex, FFTW_BACKWARD, FFTW_ESTIMATE); | ||
|
||
for (int ch=0; ch<nchannels; ch++) | ||
{ | ||
for (int nwin = 0; nwin < nwindows; nwin++) | ||
{ | ||
// Construct complex voltage. | ||
for( unsigned index = 0; index < windowsize; ++index ) | ||
{ | ||
SignalComplex[index][0] = aSignal->SignalTimeComplex()[ ch*aSignal->TimeSize() + nwin*windowsize + index ][0]; | ||
SignalComplex[index][1] = aSignal->SignalTimeComplex()[ ch*aSignal->TimeSize() + nwin*windowsize + index ][1]; | ||
} | ||
|
||
fftw_execute(ForwardPlan); | ||
|
||
// High Pass FilterFFT | ||
for( unsigned index = 0; index < windowsize; ++index ) | ||
{ | ||
if ((index < CutoffFreq/(fAcquisitionRate*1.e6)*windowsize)||(index>0.5*windowsize)) | ||
{ | ||
FFTComplex[index][0] = 0.; | ||
FFTComplex[index][1] = 0.; | ||
} | ||
} | ||
|
||
fftw_execute(ReversePlan); | ||
|
||
double norm = (double)(windowsize); | ||
|
||
for( unsigned index = 0; index < windowsize; ++index ) | ||
{ | ||
// normalize | ||
aSignal->SignalTimeComplex()[ ch*aSignal->TimeSize() + nwin*windowsize + index ][0] = SignalComplex[index][0]/norm; | ||
aSignal->SignalTimeComplex()[ ch*aSignal->TimeSize() + nwin*windowsize + index ][1] = SignalComplex[index][1]/norm; | ||
} | ||
} // nwin | ||
} // NCHANNELS | ||
|
||
delete [] SignalComplex; | ||
delete [] FFTComplex; | ||
|
||
|
||
return true; | ||
} | ||
|
||
bool HighPassFilterFFTGenerator::DoGenerateFreq( Signal* aSignal ) | ||
{ | ||
return true; | ||
} | ||
|
||
} /* namespace locust */ |
Oops, something went wrong.