Extract a pulsar profile and add sound from noise by folding/adding/stacking.

Skip to first unread message

Michiel Klaassen

Jan 5, 2022, 7:54:22 AM1/5/22
to sara-list, camras-forum
Best wishes to you All,
To explain to my girlfriend and our children some more about pulsars, I decided to take our captured data and add a visual and audio interpretation of the pulsar.
From the period data 100 to 545 (fig1) we took the short range 100 to 200 periods; fig 2.

Next we selected periods 100 to 200 of the datastream and folded/added it in real time every period. You can see in the video that the pulse is rising from the noise. At the same time the peak above a certain level will generate a tone. This tone can also be so low in frequency that it gives the 'thumb' sound of a pulsar. The background sound can be set to a loud noise sound level or it can be set to attenuate completely.
The total presentation time is 100 periods of the B0329+54 pulsar, so about a minute.

Configuration is done with the Ap.cfg file; it contains the following:

0.------pulsar audio folding------------
1.pulsar name = B0329 SGRT
2.pulsar period time [s]=0.71463071463
3.spectrum file name without extension=z-100bt
4.fold period from =100
5.fold period to =205
6.audio pulse squelch level (0..1)=0.998
7.audio noise volume (0..1)=0.1

The tones were generated with an online tool from
Also we ripped sound from a youtube track with Audacity (first time for me).

We used the python pygame modules to handle the sounds. To run the python script you need pygame installed; see

More specific info:
The data captured in this session had a lot of RFI (Radio Frequency Interference ). Later we could trace that back to the LAN (Local Area Network) cables.
The source period files or spectrum files were generated by the 3pt-calc.exe program. Each file consists of a number of spectra for each bin range and one sum spectrum bin range. The sum of the spectra is also available in the sum bins (nr 10 or nr 20). The latest 3pt calc program splits the spectrum into 20 channels.
This audio script is loading the successive period files and scans the bins for the maximum value. Next it scans again to flag every bin with an amplitude higher than the squelch level. This flagged bin will generate an audio tone.
In the right side monitor window of 'spider' you can see info of each period.
The first value is the period number (from 100 to 200).
The second value is the bin number of the maximum found amplitude. In the beginning the bin numbers vary, but later, from period 130, the bin number is the stable number 65.
The third value is the period time of the audio period.
The horizontal line is the squelch level; noise can be heard when the amplitude rises above this level. 

The video on youtube (first time for me) can be seen here:

A second video shows the same folding, but now the individual periods are also shown in red.
The amplitude of the individual period is actually 4 times larger, but in the graph reduced for clarity.
In preview the movie screen resolution is good, but via youtube it seems to reduce and also fullscreen does not work for me. But perhaps I have a lot to learn. 

We have to find out how to minimize the size of the converted py script to an executable. At the moment it is huge (1GB).When it has a reasonable size, then it will be available here also.

This project is also added to the project list (nr 17) of the parac site.


Michiel Klaassen

Jan 6, 2022, 5:00:00 PM1/6/22
to sara-list, camras-forum
My son advised me to enable reactions on the youtube videos, because some people think that else the video could be copied from somewhere. Also I already added some more info, but I have to modify links to clickable links next.
Learning all the time.

Michiel Klaassen

Jan 24, 2022, 9:39:52 AM1/24/22
to sara-list, camras-forum
Hi All,
When capturing pulsars in an urban area, the biggest problem is RFI.
Especially when you want to use a yagi antenna, because they are sensitive to irradiation sideways and even from the back.  
So, better is not to use a plain yagi, or open dipole. 
A solution is to choose a corner antenna. It has a good directivity and the probe is shielded from local irradiation.

Another method is to use a horn antenna with the probe deep inside the horn. A large 'horn of plenty' would be perfect. I suggested this method to an amateur who was complaining about RFI making it impossible for him to get results. Well he did not believe me, so that is why I constructed my suggestion myself. 
The dimensions for 460MHz match the dimensions of an oil drum and that can be bought cheap. see the article in the SARA journal. The drum is positioned so that the pulsar is drifting through the beam.
Data captured with this system is used many times to test several post calculation methods.

The latest addition to the results is an audio folding method described earlier.

The total capturing time is 60minutes  but only about 25minutes can be used for folding. 
You can see that also in the signal to noise graph. In the central part the s/n factor is increasing steadily.

If the standard deviation of a period is large, then this period is rejected or zapped.
However, even half an hour is a long time when you have to listen to a pulsar sound. So I took the best part of the best part, and that is from period 1500 to 2714 (see Ap.cfg); that is 1200 periods*0.714=785 seconds or 14 minutes.
Well that is a long time also, and takes a lot of MB, so I put that one on youtube also.

So if you dare; start it, and next wind it towards the end to save lifetime.
If you have time, you will see that the amplitude of the stacked result is lowering (as expected) and the single pulse  period amplitude stays the same. The squelch level is set to 0.6 times the peak value, but you can change that in the Ap.cfg file.
I added some pictures of the details of the setup to make this presentation less boring.
This project and some more info will be added to the website.

from the man cave.JPG
Pulsar profile 20220121-201145.png

Michiel Klaassen

Jan 24, 2022, 11:03:17 AM1/24/22
to sara-list, camras-forum
Yes Dear, yes Dear, I will upload the picture you took also.
Credits: Jolanda Goedhart

Michiel Klaassen

Jan 31, 2022, 9:51:30 AM1/31/22
to sara-list, camras-forum
In case I annoy you; just hit the delete button.

Vela pulsar fold and sound with Matplot blitting

Yes; Blitting is the word.
I found old IQ data I received from Guillermo Gancio. He captured the vela pulsar with the huge 30m telescope of the IAR in Argentine.

This pulsar has a period time of only 0.09 seconds. The standard plotting software I had could not keep up displaying the graphs, so I had to change things.

So I discovered Matplotlib blitting. That is plotting only the necessary varying things in a plot.
With this method you can increase the display rate from 5 fps to 120fps.
On the inet there are lots of Python blit, and animated examples; mostly very complex and hard to understand. A lot of Classes, .self and Defines are used; too complex for me.
So, once again, in the end, I discovered the essence and bundled it all into an exe.

With this version I added the option to zap (discard) a period of data. The decision is made by calculating the standard deviation (std) of that period. 
If it is engulfed in strong RFI, then the std level will be high. The decision level can be set via the config file.
While running the program, the std level is also printed onto the plot, so you can set the zap level just above that level.     
Because the plot speed is higher now, there is no need for program execution speed by de-selecting one of the two graphs.

A peculiarity is that the data contains a very strong hum of about 150Hz. Perhaps it is a 50Hz overtone or a control signal sneaking into the data stream, but as you can see; when averaging the data the pulsar profile can still be extracted.

Another peculiarity is that the pass band curve displays extra bumps. Because the capturing was done on 1420MHz these curves come from neutral hydrogen. To verify this signal we can look into 'the' database of H1;
When we enter the RADEC direction of the Vela pulsar (08 35 20.65525 -45 10 35.1545), we get fig3. This graph looks exactly the same. Normally the curve you get in the frequency regime is mirrored. That is not the case here; so how is that possible.
Well, the frequency data was captured and mirrored already, by mixing with a local oscillator signal above the frequency band of interest. You can also note that because the DM is given as a negative value.

This new version of Pulsar Fold and Audio, incl VELA example data  can be found on the website.
....zip (soon)

A video lasting 20 seconds can be found here


Pulsar profile 20220131-145556.png
Band pass real 20220107-224844.png
H1-direction Vela 20220131-103313.png
Multiplot vela -20220130-174750.png
Reply all
Reply to author
0 new messages