Skip to content

Commit 0ddf12d

Browse files
committed
change OSError to FileNotFoundError
1 parent 80fae69 commit 0ddf12d

4 files changed

Lines changed: 6 additions & 14 deletions

File tree

gnss_lib_py/parsers/navdata.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def from_csv_path(self, csv_path, **kwargs):
100100
if not isinstance(csv_path, str):
101101
raise TypeError("csv_path must be string")
102102
if not os.path.exists(csv_path):
103-
raise OSError("file not found")
103+
raise FileNotFoundError("file not found")
104104

105105
self._build_navdata()
106106

@@ -674,14 +674,8 @@ def interpolate(self, x_row, y_rows, inplace=False, *args):
674674
specified rows and columns. If inplace is True, returns
675675
None.
676676
677-
Notes
678-
-----
679-
Copied from https://stackoverflow.com/questions/6518811/interpolate-nan-values-in-a-numpy-array
680-
681677
"""
682678

683-
# TODO: change to interpolate based on UnixTimeMillis
684-
685679
if isinstance(y_rows,str):
686680
y_rows = [y_rows]
687681
if not isinstance(x_row, str):
@@ -708,12 +702,10 @@ def interpolate(self, x_row, y_rows, inplace=False, *args):
708702
else:
709703
new_navdata[y_row,nan_idxs] = np.interp(x_vals, xp_vals,
710704
yp_vals, *args)
711-
712705
if inplace:
713706
return None
714707
return new_navdata
715708

716-
717709
def in_rows(self, rows):
718710
"""Checks whether the given rows are in NavData.
719711

gnss_lib_py/parsers/precise_ephemerides.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def parse_sp3(input_path, constellation = 'gps'):
102102
if not isinstance(input_path, str):
103103
raise TypeError("input_path must be string")
104104
if not os.path.exists(input_path):
105-
raise OSError("file not found")
105+
raise FileNotFoundError("file not found")
106106

107107
# Load in the file
108108
with open(input_path, 'r', encoding="utf-8") as infile:
@@ -228,7 +228,7 @@ def parse_clockfile(input_path, constellation = 'gps'):
228228
if not isinstance(input_path, str):
229229
raise TypeError("input_path must be string")
230230
if not os.path.exists(input_path):
231-
raise OSError("file not found")
231+
raise FileNotFoundError("file not found")
232232

233233
# Poll the total no. of satellites based on constellation specified
234234
if constellation in NUMSATS.keys():

tests/parsers/test_navdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def test_init_csv(csv_path):
217217

218218

219219
# raises exception if not a file path
220-
with pytest.raises(OSError):
220+
with pytest.raises(FileNotFoundError):
221221
data = NavData(csv_path="")
222222

223223
# raises exception if input int

tests/parsers/test_precise_ephemerides.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_load_sp3data_gps_missing(sp3_path_missing):
322322
measurements
323323
"""
324324
# Create a sp3 class for each expected satellite
325-
with pytest.raises(OSError):
325+
with pytest.raises(FileNotFoundError):
326326
_ = parse_sp3(sp3_path_missing, constellation = 'gps')
327327

328328
def test_load_clkdata_gps_missing(clk_path_missing):
@@ -335,7 +335,7 @@ def test_load_clkdata_gps_missing(clk_path_missing):
335335
measurements
336336
"""
337337
# Create a sp3 class for each expected satellite
338-
with pytest.raises(OSError):
338+
with pytest.raises(FileNotFoundError):
339339
_ = parse_clockfile(clk_path_missing, constellation = 'gps')
340340

341341
@pytest.fixture(name="sp3_path_nodata")

0 commit comments

Comments
 (0)