Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

%load_ext autoreload
%autoreload 1
%config InlineBackend.figure_format = 'retina'
%load_ext rich
import datetime
import hashlib
import json
import os
import re
import sys
@jbwhit
jbwhit / Resources.md
Last active January 8, 2024 21:16
Jonathan Whitmore's resource links for AAS 2024 talk
@jbwhit
jbwhit / example-ruff-formatting.ipynb
Last active April 23, 2024 14:25
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbwhit
jbwhit / PlanetAnimation3.py
Last active August 10, 2023 09:47
Plotting Separation between prediction and observation
%%manim -qm PlanetAnimation3
df2 = pd.read_csv(
"https://gist.githubusercontent.com/jbwhit/8c745f8e6d814651a2254b3509e3d17c/raw/2e2457ee96dd8268f419fd842cdfb6e345b8ed22/uranus-example.csv"
)
class PlanetAnimation3(Scene):
def construct(self):
times = np.array(df2["date_frac"].values)
uranus_positions_1 = np.hstack(
df = pd.read_parquet("plotme.parquet")
class PlanetAnimation2(Scene):
def construct(self):
my_template = TexTemplate()
my_template.add_to_preamble(r"\usepackage{mathabx}")
Tex.set_default(tex_template=my_template)
scale = 12
shift = np.array([-4, -1])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbwhit
jbwhit / scene.py
Last active June 8, 2023 17:20
This code creates this video here: https://youtu.be/g5QsoVxFSx0
import numpy as np
import pandas as pd
from manim import *
class SolarSystem(ThreeDScene):
def construct(self):
# Set the initial camera position
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
colors = {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbwhit
jbwhit / Fixing matplotlib transparent label problems.ipynb
Last active May 26, 2023 22:50
Matplotlib label transparency problems
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbwhit
jbwhit / Brewfile
Last active February 21, 2024 08:12
My default Brewfile.
tap "homebrew/bundle"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "jesseduffield/lazygit"
tap "textualize/rich"
# set arguments for all 'brew install --cask' commands
cask_args appdir: "~/Applications", require_sha: true
# brew "awscli"