Dear Yiru-Jiao.
Thank you for providing a good script.
However, I had some problem using this code.
In 'event_matching.py'
57~58th line.
veh_j = df_sur[df_sur['target_id']==target_id][['time','x_ekf','y_ekf','psi_ekf','speed_ekf','target_id','range','forward']].copy()
veh_j = veh_j.rename(columns={'x_ekf':'x','y_ekf':'y','psi_ekf':'psi','speed_ekf':'speed'})
Those lines are using a tag named 'speed_efk' and that cause the error like:
==============================================================================
PS C:\Users\coldm\OneDrive\바탕 화면\100CarNDS 재현\Reconstruct100CarNDSData-main (2)\Reconstruct100CarNDSData-main> & C:/Users/coldm/AppData/Local/Microsoft/WindowsApps/python3.12.exe "c:/Users/coldm/OneDrive/바탕 화면/100CarNDS 재현/Reconstruct100CarNDSData-main (2)/Reconstruct100CarNDSData-main/event_matching.py"
Processing Crash data...
There are 34 trips processed
Trip 8313 has no surrounding data available
Trip 8322 has 1 surrounding vehicles
Traceback (most recent call last):
File "c:\Users\coldm\OneDrive\바탕 화면\100CarNDS 재현\Reconstruct100CarNDSData-main (2)\Reconstruct100CarNDSData-main\event_matching.py", line 57, in
veh_j = df_sur[df_sur['target_id']==target_id][['time','x_ekf','y_ekf','psi_ekf','speed_ekf','target_id','range','forward']].copy()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\coldm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pandas\core\frame.py", line 4108, in getitem
indexer = self.columns._get_indexer_strict(key, "columns")[1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\coldm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pandas\core\indexes\base.py", line 6200, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "C:\Users\coldm\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pandas\core\indexes\base.py", line 6252, in _raise_if_missing
raise KeyError(f"{not_found} not in index")
KeyError: "['speed_ekf'] not in index"
================================================================================
And I think we have to use 'v_efk' insted speed_ekf'.
So I changed it and it seems works very well.
Did I misunderstand something while reading the document?
Or was it just a mistake that occurred while writing the script?