Closed JasonMendoza2008 closed 2 years ago
Catching the exception IndexError
or checking the length of the list beforehand is probably the way to go (and returning the coordinates of the spawn because we don't have any more information yet) but as pointed out in the other issue (https://github.com/meraki-analytics/cassiopeia/issues/424) I would prefer interacting with someone that knows a bit about the source code of cassiopeia
before making a pull request to fix those problems.
I'm going to say this is intentional. There isn't a valid Position that can be returned this early in the game since there is no data for it, so throwing an IndexError seems reasonable. Like you said, you can catch the exception if you want.
Fair enough!
Quick question @jjmaldonis, what triggers data to be filled in with Position? I'm not sure I fully understand that.
@JasonMendoza2008 I dug into this more. The position data is filled by the position.x
and position.y
values in the timeline's participant frames, or by the latest event in the cumulative timeline that has both a position and a timestamp. It looks like a frame always exists, regardless of the time when the cumulative timeline is queried. I fixed the bug where an IndexError is thrown, so now this method should never throw an error. See https://github.com/meraki-analytics/cassiopeia/pull/430/files#diff-ab73563069f209cd2b1cf65668f8e114081b54556c707a69b71790b8731da890R1039 for details.
To reproduce the bug, make a virtual environment under
Python 3.10.2
. Installcassiopeia
withpip install cassiopeia
. And run the following script https://github.com/meraki-analytics/cassiopeia/blob/master/examples/timeline.py but at time00:10
.Traceback: