# SCF

These past weeks I have been trying to implement the SCF algorithm from “Automatic Modulation Classification For Cognitive Radios Using Cyclic Feature Detection” – Barathram Ramkumar.

The signal is divided into N frames. DFT is then performed on the first frame, the FFT is then shifted by:

(alpha (a real number from 0 to 1) * frame length) / 2 and

(-alpha (a real number from 0 to 1) * frame length) / 2

These results are then multiplied together.  The mean value of this result for a particular alpha value is then taken.  The result is then passed through a moving average filter, and recorded.  We then increment the value of alpha, and begin the process again.

The following is a graph of the SCF generated by my Python code, from the BPSK complex data from https://cyclostationary.wordpress.com/downloads/, you can compare the output with Dr Spooner’s at https://cyclostationary.wordpress.com/2016/01/28/a-gallery-of-spectral-correlation/

Dr Spooner, provided invaluable advice, for the generation of the following graphs, from the data on his website:

# Graphing GNU Radio complex output

The flow graph you can see below generates data, which is used by my Python script.  It loads data from a file called /tmp/in.dat, which was simply created through the following command:

```
dd if=/dev/urandom bs=10M count=1 of=/tmp/in.dat

```

I set the payload length of the Packet encoder to 20 bytes, you will notice how as this length increases, the output from the SCF becomes less useful.

## BPSK non-differential coding

You can see the flow graph & the Python code used to generate the above graph at the following Github repository.

https://github.com/chrisruk/scf

I’m going to investigate the FAM (FFT accumulation method) algorithm in gr-specest.

Next week I plan to create a GNU Radio python block using Tensor Flow, to attempt classification of modulation schemes, first with the output of SCF and then making use of FAM, which I believe will be less computationally expensive.

The classifier which we will choose first will likely be an Artificial Neural Network, which will need to be trained through the use of labelled modulation schemes.

The plan is then to output messages which can interface with Sebastian’s modules, using a simple message passing interface he described, whereby the centre frequency is passed, along with the probability that the classifier assigns to each modulation type.

Any feedback or valuable comments from experts are welcome.