As a first step towards obtaining GPS P-code observables, it seems prudent to verify that the P code is detectable in a test recording with high C/N0.
Here's the result with an L1 recording containing a strong signal from PRN 30 (about 50 dBHz). The peak is smeared over an extent somewhat larger than two chips, the result of some residual code doppler. Also the peak is offset by about 1 chip, again the result of residual error from the C/A acquisition (about 0.1 C/A chip). It was great to see it at all though. Certainly it proves out the P code generator.
The recording is about 1.4 seconds long and contains these data bits:
000100010110111101111011110010001011000011000001100010101110010100100100101
It turns out I was a bit lucky and got a complete TOW word at the end:
0001000101101111011110111100 10001011 # Preamble 00001100000110 # TLM Message 0 # Integrity Status Flag 0 # Reserved 101011 # Parity 10010100100100101 # TOW Count (inverted: 01101011011011010)
This TOW count corresponds to Wednesday 19:40:12 in the GPS week, so the first bit of the preamble is at 19:40:06. Adding up the C/A code phase and the previous bits gives the time of the first RF sample of the file as 19:40:05.450822469 or 3375955761914 P code chips. That was the offset given to the script that produced the above plot.
I've put the code generators and some preliminary acquisition and tracking software in a new GitHub repository:
https://github.com/pmonta/GNSS-DSP-tools/
I'm sure it's not as efficient as low-level code in C, but it's nice to have concise scripts for prototyping, with everything in the Matlab-like python / numpy environment.