Skip to content

Commit 82f9e41

Browse files
Merge pull request #19 from valeri-atamaniouk/i160-final-patches
iqgen: unit tests for signals
2 parents 7f58d3c + cb65afb commit 82f9e41

File tree

3 files changed

+87
-211
lines changed

3 files changed

+87
-211
lines changed

peregrine/iqgen/bits/encoder_factory.py

Lines changed: 0 additions & 199 deletions
This file was deleted.

tests/test_iqgen_signals.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (C) 2016 Swift Navigation Inc.
2+
#
3+
# Contact: Valeri Atamaniouk <[email protected]>
4+
# This source is subject to the license found in the file 'LICENSE' which must
5+
# be be distributed together with this source. All other rights reserved.
6+
#
7+
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
8+
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
9+
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
10+
11+
'''
12+
Unit tests for IQgen signal definitions
13+
'''
14+
15+
from peregrine.iqgen.bits.signals import GPS
16+
from peregrine.iqgen.bits.signals import GLONASS
17+
from scipy.constants import c as C
18+
19+
20+
def test_GPSL1():
21+
'''
22+
Test GPS L1 signal methods
23+
'''
24+
doppler = -10. / C * GPS.L1CA.CENTER_FREQUENCY_HZ
25+
assert GPS.L1CA.calcDopplerShiftHz(1000., 10.) == doppler
26+
assert GPS.L1CA.getCodeChipIndex(0.) == 0
27+
assert GPS.L1CA.getCodeChipIndex(0.5) == 511500
28+
assert GPS.L1CA.getSymbolIndex(0.) == 0
29+
assert GPS.L1CA.getSymbolIndex(0.5) == 25
30+
31+
32+
def test_GPSL2():
33+
'''
34+
Test GPS L2 signal methods
35+
'''
36+
doppler = -10. / C * GPS.L2C.CENTER_FREQUENCY_HZ
37+
assert GPS.L2C.calcDopplerShiftHz(1000., 10.) == doppler
38+
assert GPS.L2C.getCodeChipIndex(0.) == 0
39+
assert GPS.L2C.getCodeChipIndex(0.5) == 511500
40+
assert GPS.L2C.getSymbolIndex(0.) == 0
41+
assert GPS.L2C.getSymbolIndex(0.5) == 25
42+
43+
44+
def test_GLONASS_common():
45+
'''
46+
Test common GLONASS signal methods
47+
'''
48+
assert GLONASS.getCodeChipIndex(0.) == 0
49+
assert GLONASS.getCodeChipIndex(0.5) == 511000 / 2
50+
assert GLONASS.getSymbolIndex(0.) == 0
51+
assert GLONASS.getSymbolIndex(0.5) == 50
52+
53+
54+
def test_GLONASSL1():
55+
'''
56+
Test GLONASS L1 signal methods
57+
'''
58+
doppler = -10. / C * GLONASS.L1S[0].CENTER_FREQUENCY_HZ
59+
assert GLONASS.L1S[0].calcDopplerShiftHz(1000., 10.) == doppler
60+
assert GLONASS.L1S[0].getCodeChipIndex(0.) == 0
61+
assert GLONASS.L1S[0].getCodeChipIndex(0.5) == 511000 / 2
62+
assert GLONASS.L1S[0].getSymbolIndex(0.) == 0
63+
assert GLONASS.L1S[0].getSymbolIndex(0.5) == 50
64+
65+
66+
def test_GLONASSL2():
67+
'''
68+
Test GLONASS L2 signal methods
69+
'''
70+
doppler = -10. / C * GLONASS.L2S[0].CENTER_FREQUENCY_HZ
71+
assert GLONASS.L2S[0].calcDopplerShiftHz(1000., 10.) == doppler
72+
assert GLONASS.L2S[0].getCodeChipIndex(0.) == 0
73+
assert GLONASS.L2S[0].getCodeChipIndex(0.5) == 511000 / 2
74+
assert GLONASS.L2S[0].getSymbolIndex(0.) == 0
75+
assert GLONASS.L2S[0].getSymbolIndex(0.5) == 50

tests/test_iqgen_sv_glo.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import numpy
2323

2424

25-
def test_GPSSv_init():
25+
def test_GLOSv_init():
2626
'''
2727
GLONASS SV initialization test
2828
'''
@@ -34,7 +34,7 @@ def test_GPSSv_init():
3434
assert isinstance(sv.doppler, DopplerBase)
3535

3636

37-
def test_GPSSV_bands():
37+
def test_GLOSV_bands():
3838
'''
3939
GLONASS SV band configurations
4040
'''
@@ -58,9 +58,9 @@ def test_GPSSV_bands():
5858
assert sv.isL2Enabled()
5959

6060

61-
def test_GPSSV_messages():
61+
def test_GLOSV_messages():
6262
'''
63-
GPS SV messages test
63+
GLONASS SV messages test
6464
'''
6565
sv = GLOSatellite(1)
6666
assert sv.l1Message == sv.getL1Message()
@@ -75,19 +75,19 @@ def test_GPSSV_messages():
7575
assert sv.l2Message == sv.getL2Message() != msg2
7676

7777

78-
def test_GPSSV_str():
78+
def test_GLOSV_str():
7979
'''
80-
GPS SV string representation
80+
GLONASS SV string representation
8181
'''
8282
sv = GLOSatellite(3)
8383
value = str(sv)
8484
assert value.find('GLONASS') >= 0
8585
assert value.find('3') >= 0
8686

8787

88-
def test_SVBase_getBatchSignals0():
88+
def test_GLOSv_getBatchSignals0():
8989
'''
90-
GPS SV signal generation: not enabled
90+
GLONASS SV signal generation: not enabled
9191
'''
9292
sv = GLOSatellite(1)
9393
start = 0.
@@ -106,9 +106,9 @@ def test_SVBase_getBatchSignals0():
106106
assert (samples == 0).all()
107107

108108

109-
def test_SVBase_getBatchSignals1():
109+
def test_GLOSv_getBatchSignals1():
110110
'''
111-
GPS SV signal generation: not available
111+
GLONASS SV signal generation: not available
112112
'''
113113
sv = GLOSatellite(1)
114114
start = 0.
@@ -127,7 +127,7 @@ def test_SVBase_getBatchSignals1():
127127
assert (samples == 0).all()
128128

129129

130-
def test_SVBase_getBatchSignals2():
130+
def test_GLOSv_getBatchSignals2():
131131
'''
132132
GLONASS SV signal generation: L1
133133
'''
@@ -154,7 +154,7 @@ def test_SVBase_getBatchSignals2():
154154
assert (samples[3] == 0).all()
155155

156156

157-
def test_SVBase_getBatchSignals3():
157+
def test_GLOSv_getBatchSignals3():
158158
'''
159159
GLONASS SV signal generation: L2
160160
'''

0 commit comments

Comments
 (0)