glad94 / infotennis

Python for scraping and processing tennis match data from the ATP Tour website.
MIT License
12 stars 0 forks source link

Question: How do we decide serve placement from court-vision raw data or pandas df? #6

Open kiszk opened 2 months ago

kiszk commented 2 months ago

While I quickly browsed a json file with court vision results at ATP site, I cannot find how to know the serve placement from a json file or processed pandas df.

The use cases of the serve replacements are as follows:

Although I thought x_bounce or y_bounce at stroke_idx==1 in the processed df may be related to the serve placement, I think that it does not make sense.

@glad94 Could you please share your approach?

kiszk commented 2 months ago

Sorry for bothering you.

Is the function categorise_serve_direction() in the jupyter file still valid for this pipeline?

glad94 commented 2 months ago

Hi @kiszk thanks for the interest and question , I didn't use the above function from Peter's repo but wrote something separately that's probably similar:

def serve_dir(y_bounce):
    '''
    Returns serve direction
    '''
    width = 8.23/2
    if abs(y_bounce) < width/3:
        dir = "T"
    elif abs(y_bounce) <= width*2/3:
        dir = "M"
    else:
        dir = "W"
    return dir

My bad for not documenting the processed ball coordinate (x,y,z) columns as well, this is what they're meant to be:

If the value is -999, then either the value is missing in the raw data, or that part of the ball trajectory didn't happen e.g. bounce values could be -999 if the next shot was a volley.

kiszk commented 2 months ago

@glad94 Thank you for your response. It makes sense. And, you function is equal to Peter' function. Also, thank you for documenting the ball coordinate columns.

This pipeline is a very useful framework to process court vision data on pandas.