This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
# Make dummy data with different ranges... | |
datas = [np.random.random() * np.random.random((10, 10)) for _ in range(6)] | |
fig, axes = plt.subplots(ncols=len(datas), figsize=(30, 5)) | |
for i, (data, ax) in enumerate(zip(datas, axes.flat)): | |
# It's important that we explicitly set vmin and vmax so they're the same |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# Copyright 2023 Planet Labs, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# There are two ways to clip data to irregular boundaries. | |
# One uses a masked array (and is most useful for "real" data) | |
# The other uses set_clip_path (and is most useful for graphics) | |
# This demonstrates the first (masked array) | |
import matplotlib.pyplot as plt | |
import scipy.ndimage | |
import numpy as np | |
import skimage.draw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
# Copyright 2019 Planet Labs, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Silly auto-generated art. Meant to look like some sort of mold spores. | |
Deliberately slow to render -- meant to look good at high-res. | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.colors as mcolors | |
from matplotlib.collections import LineCollection | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Converts one or more zmap grids to ascii x,y,z tab-delimited files. Exported | |
files will be saved to the current directory with a ".xyz" extension and the | |
same file name as the original. Null grid values will not be included unless | |
the "--with_nulls" option is specified. | |
Usage: | |
zmap2xyz.py [options] INPUT_FILES... | |
Options: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
# https://mtgjson.com/v4/json/AllCards.json.zip | |
with open('AllCards.json', 'r') as infile: | |
data = json.load(infile) | |
for name in data: | |
card = data[name] | |
cost = card.get('manaCost', '') | |
if cost.count('{') > 6: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.interpolate import Rbf | |
import matplotlib.pyplot as plt | |
from matplotlib.colors import LinearSegmentedColormap | |
from mpl_toolkits.axes_grid1 import inset_locator | |
from matplotlib.projections.polar import PolarAxes | |
np.random.seed(1977) | |
def main(): | |
x, y, z = generate_surface() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Tkinter as tk | |
import numpy as np | |
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg | |
from matplotlib.figure import Figure | |
def main(): | |
root = tk.Tk() | |
app = Application(root) | |
tk.mainloop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Our input data... | |
x = np.random.randint(0, 3200, (1000,1000)) | |
# We're replacing something like | |
# struct.pack(">"+"hB"*x.size) | |
# Note that that's a 2-byte signed int followed by 1-byte unsigned | |
# We'll need to create the output 1D array and assign manually: |
NewerOlder