StatChangeDetector

Note

This feature is available only with a License - Contact us for more details

Activity detector based on a statistical analysis of the content of sub-bands. Internally, this detector works as follows :

  • The incoming signal is plit in 'n bands' through a polyphase filter bank,
  • Then, each call to runDetections () performs a new estimation and the power per frequency is compared to the reference value.
  • A detection is returned ( popDetection() method) if the statistical distribution of the time-domain signal in the sub-band does not fit with a random (noise) distribution.

There are two different ways to feed the ChangeDetector object :

  • Automatic : use the setRX( JSReceiver rx ) method to plug the output of the receiver to feed the detector,
  • Manual : use the pushIQ( IQData block) method to add IQSamples in the processing queue.

The first call to either setRX( JSReceiver rx ) or pushIQ( IQData block) sets the working mode and cannot be changed.

object StatChangeDetector {
    constructor StatChangeDetector( number fcenterMHz, int nbands );

    bool setRx( JSReceiver rx );
     or
    bool pushIQ( IQData data ); 

    int runDetections();
    void clearDetections();

    bool ignore( number freq_start [MHz], freq_stop [MHz] );
    object popDetection() ;

}

.setRx

    .setRx(IQ_stream);
  • Example:
var s = new JSpectrumBlock( 466, 512 ) ;
s.setRx( rx ) ; // make it work with the scanner radio

.runDetections

Perform a cycle of detections and returns the number of signals detected which can be read by popDetections ().

.runDetections();

.clearDetections

Reset detections counter

.clearDetections();

.popDetections

var detection = s.popDetection();

Returns following values for the 'detection' variable during the signal detection:

{ id : sequential number, center : freq MHz, bw  : Hz, power_level : float, snr : float }

.ignore

var ignore = s.ignore(Fstart_MHz, Fend_MHz);

Ignore detections for the frequency range Fstart to Fend.

Example with RX :

// open RX  

var rx = Soapy.makeDevice({'query' : 'driver=rtlsdr' }) ;
if( typeof rx != 'object' ) {
    print('no radio ?');
    exit();
}

if( !rx.isValid()) {
    print('no radio ?');
    exit();
}

if( rx.setRxSampleRate( 2e6 )) {
      print('Sample rate changed');
}

var s = new StatChangeDetector( 466, 128 ) ;
s.setRx( rx );


// now run
for( i=0 ; i < 10 ; i++ ) {
    print('------------' + i );

    var changes = s.runDetections();
    //print( changes + ' detected changes');
    if( changes > 0 ) {             
           // investigate detections
            var detection = s.popDetection() ;
            while( typeof detection === 'object' && detection !== null ) {      
                print(JSON.stringify(detection));
                detection = s.popDetection() ;
            }
    } 
}
print('finished');
Last update: May 1, 2022