Stanford-NavLab / gnss_lib_py

Modular Python tool for parsing, analyzing, and visualizing Global Navigation Satellite Systems (GNSS) data and state estimates
MIT License
116 stars 28 forks source link

num_cols is not set on NavData.copy() #151

Closed cntaylor closed 5 months ago

cntaylor commented 5 months ago

Describe the bug When using "copy" to pull certain columns out of a larger "NavData" structure, the new NavData has not yet set the num_cols field appropriately. It says num_cols is 0 when there are values in there.

To Reproduce This is some simple code to reproduce. I am using the Chemnitz data, I am attaching a CSV of just the first 20 lines or so to make this issue self-contained.

import gnss_lib_py as glp
import numpy as np

test_file = 'berlin1_potsdamer_platz/RXM-RAWX_small.csv'

nav_data_csv = glp.SmartLocRaw(test_file)
to_grab=np.arange(10)
small_nav_data = nav_data_csv.copy(cols=to_grab)
print('The copied one says it has ',small_nav_data.num_cols,'entries')
print('But it really has ',small_nav_data.array.shape[1],'entries')

Expected behavior The two numbers should be equal.

RXM-RAWX_small.csv

kanhereashwin commented 5 months ago

Hi Dr. Taylor,

Thank you for finding and flagging this bug. We will take a look at it and patch it as soon as we can.