Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
paarnes committed Jan 8, 2025
1 parent c8544cd commit 9816c67
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
- [Read a RINEX navigation file (v.3)](#read-a-rinex-navigation-file-v3)
- [Read in the results from an uncompressed Pickle file](#read-in-the-results-from-an-uncompressed-pickle-file)
- [Read in the results from a compressed Pickle file](#read-in-the-results-from-a-compressed-pickle-file)
- [Estimate the receiver position based on pseudoranges using SP3 file and print the standard deviation of the estimated position](#estimate-the-receiver-position-based-on-pseudoranges-using-sp3-file-and-print-the-standard-deviation-of-the-estimated-position)
- [Estimate the receiver position based on pseudoranges using RINEX navigation file and print the DOP values](#estimate-the-receiver-position-based-on-pseudoranges-using-rinex-navigation-file-and-print-the-dop-values)



- [Background information about implementation](#some-background-information-on-implementation)
- [Converting Keplerian Elements to ECEF Coordinates](#converting-keplerian-elements-to-ecef-coordinates)
- [Interpolating a GLONASS State Vector to ECEF Coordinates](#interpolating-a-glonass-state-vector-to-ecef-coordinates)
Expand Down Expand Up @@ -379,6 +384,54 @@ result_dict = PickleHandler.read_zstd_pickle(path_to_picklefile)
```


### Estimate the receiver position based on pseudoranges using SP3 file and print the standard deviation of the estimated position
```python
from gnssmultipath import GNSSPositionEstimator
import numpy as np

rinObs = 'OPEC00NOR_S_20220010000_01D_30S_MO_3.04_croped.rnx'
sp3 = 'Testfile_20220101.eph'

# Set desired time for when to estimate position and which system to use
desired_time = np.array([2022, 1, 1, 1, 5, 30.0000000])
desired_system = "G" # GPS
gnsspos, stats = GNSSPositionEstimator(rinObs,
sp3_file = sp3,
desired_time = desired_time,
desired_system = desired_system,
elevation_cut_off_angle = 15
).estimate_position()

print('Estimated coordinates in ECEF (m):\n' + '\n'.join([f'{axis} = {coord}' for axis, coord in zip(['X', 'Y', 'Z'], np.round(gnsspos[:-1], 3))]))
print('\nStandard deviation of the estimated coordinates (m):\n' + '\n'.join([f'{k} = {v}' for k, v in stats["Standard Deviations"].items() if k in ['Sx', 'Sy', 'Sz']]))
```

### Estimate the receiver position based on pseudoranges using RINEX navigation file and print the DOP values
```python
from gnssmultipath import GNSSPositionEstimator
import numpy as np

rinObs = 'OPEC00NOR_S_20220010000_01D_30S_MO_3.04_croped.rnx'
rinNav = 'BRDC00IGS_R_20220010000_01D_MN.rnx'

# Set desired time for when to estimate position and which system to use
desired_time = np.array([2022, 1, 1, 2, 40, 0.0000000])
desired_system = "R" # GLONASS


gnsspos, stats = GNSSPositionEstimator(rinObs,
rinex_nav_file = rinNav,
desired_time = desired_time,
desired_system = desired_system,
elevation_cut_off_angle = 10).estimate_position()

print('Estimated coordinates in ECEF (m):\n' + '\n'.join([f'{axis} = {coord}' for axis, coord in zip(['X', 'Y', 'Z'], np.round(gnsspos[:-1], 3))]))
print('\nStandard deviation of the estimated coordinates (m):\n' + '\n'.join([f'{k} = {v}' for k, v in stats["Standard Deviations"].items() if k in ['Sx', 'Sy', 'Sz']]))
print(f'\nDOP values:\n' + '\n'.join([f'{k} = {v}' for k, v in stats["DOPs"].items()]))
```



## Some background information on implementation

### Converting Keplerian Elements to ECEF Coordinates
Expand Down
167 changes: 167 additions & 0 deletions src/Examples_on_how_to_run_it.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,173 @@
" save_results_as_compressed_pickle=True,\n",
" outputDir=outputdir)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Estimate approximate receiver posistion based on pseudoranges"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Use a SP3 file"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO(rinexReadObsFileHeader304): Rinex header has been read\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Rinex observations are being read: 100%|██████████| (100/100)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO(readRinexObs304): The following GNSS systems have been read into the data: GPS, GLONASS, Galileo, Beidou\n",
"INFO(readRinexObs304): The following GPS observation types have been registered: C1C, L1C, C1P, C2W, L2W, C2X, L2X, C5X, L5X\n",
"INFO(readRinexObs304): The following GLONASS observation types have been registered: C1C, L1C, C1P, L1P, C2P, L2P, C2C, L2C\n",
"INFO(readRinexObs304): The following Galileo observation types have been registered: C1X, L1X, C7X, L7X, C5X, L5X, C8X, L8X\n",
"INFO(readRinexObs304): The following Beidou observation types have been registered: C2X, L2X, C7X, L7X, C6X, L6X\n",
"INFO(readRinexObs304): LLI have been read (if present in observation file)\n",
"INFO(readRinexObs304): SS have been read (if present in observation file)\n",
"INFO(readRinexObs304): Total processing time: 0.359375 seconds\n",
"\n",
"\n",
"Estimated coordinates in ECEF (m):\n",
"X = 3149786.364\n",
"Y = 598260.72\n",
"Z = 5495355.141\n",
"\n",
"Standard deviation of the estimated coordinates (m):\n",
"Sx = 4.233\n",
"Sy = 2.409\n",
"Sz = 7.096\n"
]
}
],
"source": [
"from gnssmultipath import GNSSPositionEstimator\n",
"import numpy as np\n",
"\n",
"rinObs = os.path.join(path_to_testdata, 'ObservationFiles/OPEC00NOR_S_20220010000_01D_30S_MO_3.04_croped.rnx')\n",
"sp3 = os.path.join(path_to_testdata, 'SP3/Testfile_20220101.eph')\n",
"\n",
"# Set desired time for when to estimate position and which system to use\n",
"desired_time = np.array([2022, 1, 1, 1, 5, 30.0000000])\n",
"desired_system = \"G\" # GPS\n",
"gnsspos, stats = GNSSPositionEstimator(rinObs,\n",
" sp3_file = sp3,\n",
" desired_time = desired_time,\n",
" desired_system = desired_system,\n",
" elevation_cut_off_angle = 15\n",
" ).estimate_position()\n",
"\n",
"print('Estimated coordinates in ECEF (m):\\n' + '\\n'.join([f'{axis} = {coord}' for axis, coord in zip(['X', 'Y', 'Z'], np.round(gnsspos[:-1], 3))]))\n",
"print('\\nStandard deviation of the estimated coordinates (m):\\n' + '\\n'.join([f'{k} = {v}' for k, v in stats[\"Standard Deviations\"].items() if k in ['Sx', 'Sy', 'Sz']]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Use a RINEX navigation file and print DOP values"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Rinex navigation file is being read: 100%|██████████| (100/100)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO(rinexReadObsFileHeader304): Rinex header has been read\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Rinex observations are being read: 100%|██████████| (100/100)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO(readRinexObs304): The following GNSS systems have been read into the data: GPS, GLONASS, Galileo, Beidou\n",
"INFO(readRinexObs304): The following GPS observation types have been registered: C1C, L1C, C1P, C2W, L2W, C2X, L2X, C5X, L5X\n",
"INFO(readRinexObs304): The following GLONASS observation types have been registered: C1C, L1C, C1P, L1P, C2P, L2P, C2C, L2C\n",
"INFO(readRinexObs304): The following Galileo observation types have been registered: C1X, L1X, C7X, L7X, C5X, L5X, C8X, L8X\n",
"INFO(readRinexObs304): The following Beidou observation types have been registered: C2X, L2X, C7X, L7X, C6X, L6X\n",
"INFO(readRinexObs304): LLI have been read (if present in observation file)\n",
"INFO(readRinexObs304): SS have been read (if present in observation file)\n",
"INFO(readRinexObs304): Total processing time: 0.359375 seconds\n",
"\n",
"\n",
"Estimated coordinates in ECEF (m):\n",
"X = 3149785.771\n",
"Y = 598281.355\n",
"Z = 5495359.165\n",
"\n",
"Standard deviation of the estimated coordinates (m):\n",
"Sx = 1.483\n",
"Sy = 1.634\n",
"Sz = 2.343\n",
"\n",
"DOP values:\n",
"PDOP = 1.66\n",
"TDOP = 0.833\n",
"GDOP = 1.857\n"
]
}
],
"source": [
"from gnssmultipath import GNSSPositionEstimator\n",
"import numpy as np\n",
"\n",
"rinObs = os.path.join(path_to_testdata, 'ObservationFiles/OPEC00NOR_S_20220010000_01D_30S_MO_3.04_croped.rnx')\n",
"rinNav = os.path.join(path_to_testdata, 'NavigationFiles/BRDC00IGS_R_20220010000_01D_MN.rnx')\n",
"\n",
"# Set desired time for when to estimate position and which system to use\n",
"desired_time = np.array([2022, 1, 1, 2, 40, 0.0000000])\n",
"desired_system = \"R\" # GLONASS\n",
"\n",
"\n",
"gnsspos, stats = GNSSPositionEstimator(rinObs,\n",
" rinex_nav_file = rinNav,\n",
" desired_time = desired_time,\n",
" desired_system = desired_system,\n",
" elevation_cut_off_angle = 10).estimate_position()\n",
"\n",
"print('Estimated coordinates in ECEF (m):\\n' + '\\n'.join([f'{axis} = {coord}' for axis, coord in zip(['X', 'Y', 'Z'], np.round(gnsspos[:-1], 3))]))\n",
"print('\\nStandard deviation of the estimated coordinates (m):\\n' + '\\n'.join([f'{k} = {v}' for k, v in stats[\"Standard Deviations\"].items() if k in ['Sx', 'Sy', 'Sz']]))\n",
"print(f'\\nDOP values:\\n' + '\\n'.join([f'{k} = {v}' for k, v in stats[\"DOPs\"].items()]))"
]
}
],
"metadata": {
Expand Down

0 comments on commit 9816c67

Please sign in to comment.