Announcement

Collapse
No announcement yet.

Pitch F/X help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pitch F/X help

    Hey guys I was wondering if any can help with me something. I've read an article on Mike Fast's website about how to download the pitch f/x data. What im wondering is if there's someway to get pitchers for just one team instead of every pitcher. I have the perl codes from baseball hacks and let me fetch the data and I change Line 63 from

    while($html =~ m/<a href=\”(gid_\w+\/)\”/g ) {
    push @games, $1;
    }

    to

    while($html =~ m/<a href=\”(gid_\w+_nynmlb_\w+\/)\”/g ) {
    push @games, $1;
    }


    However the problem is that still gives me pitchers from the opposing team so I was wondering if there was anything else I needed to modify to make it work so that I just get Mets Pitchers.......thanks.

  • #2
    Originally posted by TheAnswer1313 View Post
    Hey guys I was wondering if any can help with me something. I've read an article on Mike Fast's website about how to download the pitch f/x data. What im wondering is if there's someway to get pitchers for just one team instead of every pitcher. I have the perl codes from baseball hacks and let me fetch the data and I change Line 63 from

    while($html =~ m/<a href=\”(gid_\w+\/)\”/g ) {
    push @games, $1;
    }

    to

    while($html =~ m/<a href=\”(gid_\w+_nynmlb_\w+\/)\”/g ) {
    push @games, $1;
    }


    However the problem is that still gives me pitchers from the opposing team so I was wondering if there was anything else I needed to modify to make it work so that I just get Mets Pitchers.......thanks.
    The way I would probably approach it is to record whether the Mets are the home or away team, which my parser script stores into the variables $home and $away, and then construct an if statement to only parse either the info from the top or bottom of the inning, as appropriate, in this section of the code:

    Code:
    				# Parse the at-bat and pitch data for the top and bottom halves of each inning
    				foreach $atbat (@{$inning->{inning}->[0]->{top}->[0]->{atbat}}) {
    				    parse_at_bats_and_pitches($atbat, $dbh, $select_game_id, $inning_num);
    				}
    				foreach $atbat (@{$inning->{inning}->[0]->{bottom}->[0]->{atbat}}) {
    				    parse_at_bats_and_pitches($atbat, $dbh, $select_game_id, $inning_num);
    				}

    Comment


    • #3
      Thanks Mike.

      I have one last question.

      How do I modify the spider.pl file so that it gives me games up until yesterday? What im wanting to do is include the spider.pl in scheduled tasks in windows and have it update each night. I see where I can modify the start date and end date but im not wanting to do that everyday obviously so I was wondering how to modify it so that it downloads the days games at nighttime.

      Comment


      • #4
        Originally posted by TheAnswer1313 View Post
        Thanks Mike.

        I have one last question.

        How do I modify the spider.pl file so that it gives me games up until yesterday? What im wanting to do is include the spider.pl in scheduled tasks in windows and have it update each night. I see where I can modify the start date and end date but im not wanting to do that everyday obviously so I was wondering how to modify it so that it downloads the days games at nighttime.
        I haven't tried this out, but if you only wanted the current day's game, I think it would work if you changed this line:
        for ($t = $start; $t < $now; $t += 60*60*24) {

        to this:
        for ($t = $now; $t = $now; $t += 60*60*24) {

        If that doesn't work, you've got all the variables in the section immediately proceeding, and you can work with them to get what you need.

        Comment


        • #5
          I've had some successful test runs of spidering the Gameday data.

          Is there an equivalent perl script for getting the minor league data from milb.com? As their Gameday looks the same onscreen, I'm assuming they have the same file structure, just a different url.
          Baseball Prospectus articles
          FanGraphs articles
          MVN Statistically Speaking articles
          Seam Heads articles

          Comment


          • #6
            Originally posted by StillFlash View Post
            I've had some successful test runs of spidering the Gameday data.

            Is there an equivalent perl script for getting the minor league data from milb.com? As their Gameday looks the same onscreen, I'm assuming they have the same file structure, just a different url.
            I don't think it would be that hard to modify the Perl script to spider the MiLB data, but I'm not aware of an existing script that anyone has made available for that purpose.

            Comment


            • #7
              Here are MiLB Gameday urls - note that in 2008 files are still being kept in the y2007 folder.

              Minorleaguesplits.com has data for 2005, so I assume that info is around somewhere, but I couldn't find it poking around right now. I would think baseballcube.com also spiders as he updates minor league stats every couple days in season.





              Baseball Prospectus articles
              FanGraphs articles
              MVN Statistically Speaking articles
              Seam Heads articles

              Comment


              • #8
                Any way to use Pitch F/X to find out how many times the Sox have taken a first pitch strike this year compared to the norm?

                Comment


                • #9
                  The minor league Gameday files are in the same URL as the major league files. Just go to a current major league game file and keep searching for the root directories and you will find them. They do use the same structure so it should only take some minor modifications to download them.

                  Comment


                  • #10
                    If you can give me the url for the minor league files, I can put it into the perl script.

                    Are there pitch location codes in the major league files for 2005 & 2006? In 2007-08 they are in the inning files, not in 2005-06. From memory, I thought they drew the location of the pitch in the box (and I was able to find that displayed in '06 minor games) but the current client can't display the 2005-06 files as the file structure was changed going into '07. If the pitch location codes are present, but in a different file in the old structure, then they are not being downloaded with the Adler/Fast spider script.
                    Baseball Prospectus articles
                    FanGraphs articles
                    MVN Statistically Speaking articles
                    Seam Heads articles

                    Comment

                    Ad Widget

                    Collapse
                    Working...
                    X