jeanluc-auge / gpsanapy

gps speed trace analysis for nautic sports
Apache License 2.0
4 stars 2 forks source link

erreur d'execution #1

Closed jbeaurepaire closed 3 years ago

jbeaurepaire commented 3 years ago

Salut Jean-Luc, J'ai une erreur en exécutant le script. Je n'ai pas pris le temps de regarder le code plus en détail. Lien vers le fichier gpx

Et le résultat :

juju@LAPTOP-VHJF8OSV:~/gpsanapy/gpsanapy$ python3 src/core/gps_analysis.py -f Move_2020_07_31_16_24_42_Kitesurf_Cerf-volant.gpx INFO:root:

CALLING FUNCTION load_gpx_file_to_html

INFO:root:

CALLING FUNCTION format_html_to_gpx

INFO:root:

CALLING FUNCTION to_pandas

WARNING:root: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Doppler speed is not available on all sampling points Only 99% of the points have doppler data !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

INFO:root: FUNCTION to_pandas ENDS with result: lon lat time speed speed_no_doppler course has_doppler delta_dist 0 -4.056408 47.854212 2020-07-31 15:24:42+00:00 7.300000 7.030450 NaN True 0.000000 1 -4.056586 47.854253 2020-07-31 15:24:44+00:00 7.000000 7.039041 108.945530 True 14.057689 2 -4.056676 47.854272 2020-07-31 15:24:45+00:00 7.000000 7.136410 107.464246 True 7.047635 3 -4.056767 47.854294 2020-07-31 15:24:46+00:00 7.100000 7.349490 109.813358 True 7.225183 4 -4.056861 47.854317 2020-07-31 15:24:47+00:00 7.300000 7.631906 110.033938 True 7.473794 ... ... ... ... ... ... ... ... ... 3454 -4.054326 47.854633 2020-07-31 16:23:30+00:00 1.000000 0.740606 191.381766 True 2.271052 3455 -4.054350 47.854654 2020-07-31 16:23:39+00:00 0.699928 0.823065 142.516380 True 2.945972 3456 -4.054359 47.854664 2020-07-31 16:23:40+00:00 0.699641 0.875399 148.871709 True 1.300443 3457 -4.040446 47.851520 2020-07-31 17:04:15+00:00 0.260717 0.260717 288.611340 False 1096.667458 3458 -4.040445 47.851519 2020-07-31 17:04:17+00:00 0.023577 0.071056 326.136248 True 0.134061

[3459 rows x 8 columns]

INFO:root: init TraceAnalysis with file Move_2020_07_31_16_24_42_Kitesurf_Cerf-volant.gpx creator Movescount - http://www.movescount.com author Move

WARNING:root: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! deactivating doppler for Movescount watches !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

INFO:root:

CALLING FUNCTION clean_df

INFO:root:

CALLING FUNCTION call_gps_func_from_yaml

INFO:root:with args: {'config_file': 'config.yaml'}

INFO:root:loading yaml config from file config.yaml {'speed_xs': [{'args': {'s': 1, 'n': 1}, 'description': 'vmax_1s', 'ranking_group': 'vmax'}, {'args': {'s': 10, 'n': 5}, 'description': 'vmax_10s', 'ranking_group': 'vmax'}], 'speed_dist': [{'args': {'dist': 500, 'n': 1}, 'description': 'vmax_500m', 'ranking_group': 'vmax'}, {'args': {'dist': 1000, 'n': 1}, 'description': 'vmax_1000m', 'ranking_group': 'vmax'}], 'planning_ratio': [{'args': {'v_min': 12}, 'description': 'planning_ratio>12', 'ranking_group': 'rendement'}], 'v_moy': [{'args': {'v_min': 12}, 'description': 'Vmoy>12', 'ranking_group': 'rendement'}], 'speed_jibe': [{'args': {'n': 5}, 'description': 'vmax_jibe', 'ranking_group': 'jibe'}], 'planning_distance': [{'args': {'v_min': 12}, 'description': 'planning_distance>12', 'ranking_group': 'endurance'}]} INFO:root:

CALLING FUNCTION speed_xs

INFO:root:with args: {'description': 'vmax_1s', 's': 1, 'n': 1}

Traceback (most recent call last): File "src/core/gps_analysis.py", line 810, in gpx_results = gpx_jla.call_gps_func_from_yaml(config_filename) File "/home/juju/gpsanapy/gpsanapy/src/core/utils.py", line 52, in wrapper result = fn(self, *args, *kwargs) File "src/core/gps_analysis.py", line 671, in call_gps_func_from_yaml results += getattr(self, gps_func)( File "/home/juju/gpsanapy/gpsanapy/src/core/utils.py", line 52, in wrapper result = fn(self, args, **kwargs) File "src/core/gps_analysis.py", line 583, in speed_xs confidence_report = self.append_result_debug( File "src/core/gps_analysis.py", line 634, in append_result_debug

  • len(self.thd[self.thd > 0][item_range].dropna()) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/series.py", line 848, in getitem return self._get_with(key) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/series.py", line 888, in _get_with return self.loc[key] File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 894, in getitem return self._getitem_axis(maybe_callable, axis=axis) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1112, in _getitem_axis return self._getitem_iterable(key, axis=axis) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1052, in _getitem_iterable keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1265, in _get_listlike_indexer self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing) File "/home/juju/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1307, in _validate_read_indexer raise KeyError(f"None of [{key}] are in the [{axis_name}]") KeyError: 'None of [DatetimeIndex([\'2020-07-31 16:19:06+00:00\'], dtype=\'datetime64[ns, SimpleTZ("Z")]\', name=\'time\', freq=\'S\')] are in the [index]'
jeanluc-auge commented 3 years ago

Bonjour et merci beaucoup d'avoir regardé et pris le temps de charger le code, et de faire une issue! Je suis désolé pour cette erreur, et je vais regarder. Pourrais tu m'envoyer le fichier gpx à cette adresse email: jl.auge@yahoo.com car ton lien est bloqué par mon proxy? Encore merci!

jeanluc-auge commented 3 years ago

I disabled the proxy and managed to retrieve your file: it runs fine with me... I will investigate. Meanwhile I have pushed a tag v1.0 and a master branch to ensure that we know which version is running. Please try again with the latest version. Maybe I need to put a version for the libraries used in the requirements. Meanwhile, here are your results by the way description result n doppler_ratio sampling_ratio std vmax_1s 25 1 0 100 vmax_10s 24,7 1 0 100 0,09 vmax_10s 24,6 2 0 100 0,28 vmax_10s 24,5 3 0 100 0,15 vmax_10s 24,4 4 0 100 0,24 vmax_10s 24,4 5 0 100 0,16 vmax_500m 24,5 1 0 100 0,29 vmax_1000m 24,2 1 0 100 0,36 planning_ratio>12 93 1
Vmoy>12 19,4 1
vmax_jibe 12 1 0 100 2,29 vmax_jibe 11,2 2 0 100 1,82 vmax_jibe 11,1 3 0 100 2,02 vmax_jibe 0 4 0 100 2,02 vmax_jibe 0 5 0 100 2,02 planning_distance>12 31,9 1

jeanluc-auge commented 3 years ago

But please try again with code from tag v1.0 or master branch. I see you are not using the latest code. Thanks!

jeanluc-auge commented 3 years ago

After looking at the code, I may have an explanation for the error, though it's not clear why it's working on my machine, but possibly a different version of pandas that is less touchy. Pandas is a great framework but very difficult to master... I think I was wrong when doing this:

        doppler_ratio = int(
            100
            * len(self.thd[self.thd > 0][item_range].dropna())
            / len(self.thd[item_range])
        )

which means I'm 1st selecting parts of the thd (has_doppler? time serie) on thd>1 (has_doppler=yes) before applying a restrictive time item_range. I should rather invert and do that: self.thd[item_range][self.thd > 0] I will push this change.

jbeaurepaire commented 3 years ago

It works !

Some smalls fixes : requirements.txt : yaml->pyyaml readme.md : use, remove one python3

First run, if all_results.csv does not exist : CALLING FUNCTION compile_results

ERROR:root: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! all_results.csv is missing => a new file will be created !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Traceback (most recent call last): File "/home/juju/gpsanapy/gpsanapy/src/core/utils.py", line 116, in load_results all_results = pd.read_csv(all_results_filename) File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 605, in read_csv return _read(filepath_or_buffer, kwds) File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 457, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 814, in init self._engine = self._make_engine(self.engine) File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 1045, in _make_engine return mapping[engine](self.f, self.options) # type: ignore[call-arg] File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 1862, in init self._open_handles(src, kwds) File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/parsers.py", line 1357, in _open_handles self.handles = get_handle( File "/home/juju/.local/lib/python3.8/site-packages/pandas/io/common.py", line 639, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'all_results.csv'

OK, if the file exist !

jeanluc-auge commented 3 years ago

Thanks! ok for pyyaml: sorry I should have checked and test it in a venv or docker. For the error traceback: it's not a bug, it's a feature :) I have a try/except but I wanted to report the original exception, however it's true that the full traceback is too much. I used "logger.exception" that I will replace with a "logger.error(str(e))": str(e) only reports "FileNotFoundError: [Errno 2] No such file or directory: 'all_results.csv'" instead of the full traceback that we don't really need. Encore merci d'avoir regardé et testé et n'hesite pas à soumettre des pull request sur le code pour de nouvelles features par exemple, elles seront bien accueillies!

jeanluc-auge commented 3 years ago

issue solved