Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Baseball Seam visualizer</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
margin: 0;
@903124
903124 / UMBA_statcast.py
Last active September 7, 2025 15:29
Updating https://github.com/AndRoo88/Baseball-Flight-Calculator to use real Statcast data as input
# Updating https://github.com/AndRoo88/Baseball-Flight-Calculator to use real Statcast data as input
# Modify processing.py to change scipy deprecated rotation
# Here one pitch is randomly selected from each pitch typea and calculate its trajectory using different seam orientation
#from scipy.spatial.transform import Rotation as R
def _create_rotation_from_matrix(matrix):
# """
# Create a scipy Rotation object from a rotation matrix.
# Handles compatibility between old (from_dcm) and new (from_matrix) scipy versions.
# """
import os
from typing import Dict, List
import numpy as np
import pandas as pd
DRS_DIR = os.path.join("Statcast_data", "DRS")
#Adapt from github.com/HKUNLP/Dream and github.com/ML-GSAI/LLaDA
import torch
import numpy as np
import gradio as gr
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
import time
import re
import traceback
@903124
903124 / s1.py
Created February 6, 2025 16:58
# outlines/processor/structured.py
...
class GuideLogitsProcessor(OutlinesLogitsProcessor):
"""Bias generation using a finite
Attributes
----------
tokenizer
The tokenizer used to convert tokens to ids.
guide
import chess
import re
import outlines.text.generate as generate
import outlines.models as models
import chess.engine
import chessboard.display
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.