CRIMAC-WP4-Machine-learning / CRIMAC-Raw-To-Svf-TSf

Python code showing the current processing steps for modern broadband echosounders, from raw data to Sv(f) and TS(f).
GNU Lesser General Public License v3.0
5 stars 1 forks source link

IndexError: index 1024 is out of bounds for axis 0 with size 1024 #3

Open gepe-hi opened 2 years ago

gepe-hi commented 2 years ago

For any other json dataset than the original (pyEcholabEK80data.json) I get a

IndexError: index 1024 is out of bounds for axis 0 with size 1024

error when running main.py.

This happens in line 319 Y_pc_t_m = _Y_pc_t_m[idx] (EK80CalculationPaper.py)

The idx in

@staticmethod
def calcDFTforTS(y_pc_t_n, y_mf_auto_red_n, n_f_points, f0, f1, f_s_dec):

idx seems to "duplicate"?:

...1004 1005 1005 1006 1007 1007 1008 1009 1009 1010 1011 1011 1012 1013 1013 1014 1015 1015 1016 1017 1017 1018 1019 1019 1020 1021 1021 1022 1022 1023 1024 1024 1 2 2 3 4 4 5 6 6 7 8 8 9 10 10 11 12 12 13 14 14 15 16 16 17 18 18 19 19 20 21 21 22 23 23 24 25 25...

gavinmacaulay commented 2 years ago

Python indices start at zero, so an index of 1024 in an array of size 1024 will fail. Perhaps the +1 in https://github.com/CRIMAC-WP4-Machine-learning/CRIMAC-Raw-To-Svf-TSf/blob/62401aab1ea1ece6b8c6ad41be9490a953a0e76e/Core/EK80CalculationPaper.py#L306 is the problem?