Skip to content

Instantly share code, notes, and snippets.

View Chandler's full-sized avatar

Chandler Abraham Chandler

View GitHub Profile
import igl
import numpy as np
import polyscope as ps
import scipy
from sklearn.preprocessing import normalize
import robust_laplacian
from scipy.sparse import linalg as sla
path = "scan_007.obj"
import matplotlib.pyplot as plt
import csv
import datetime
import pandas as pd
from matplotlib.colors import ListedColormap
# from lyft data download
ebikes_path = "lyft_bike_scooters.csv"
cars_path = "passenger_rides.csv"
# from strava data download
import igl
import numpy as np
import polyscope as ps
import scipy
# https://www.cs.cmu.edu/~kmcrane/Projects/ModelRepository/spot.zip
path = "/Users/cbabraham/data/mesh/spot/spot_triangulated.obj"
verts,faces = igl.read_triangle_mesh(path)
ps.init()
@Chandler
Chandler / normals.py
Created April 10, 2020 02:48
Normals w/ jax
# 3D Surface normals with JAX
import matplotlib.pyplot as plt
from jax import vmap, jacfwd, np
# Simple Torus surface parameterization f(u,v) -> (x,y,z)
# The multivariable analytic function to be differentiated
def _f(uv):
u,v = uv
x = (8 + 2 * np.cos(v)) * np.cos(u)
from astroquery.jplhorizons import Horizons
pluto = 999
jupiter = 599
mu69 = 486958
new_horizons = -98
paths = []
for body_name in [jupiter, pluto, new_horizons, mu69]:
obj = \
@Chandler
Chandler / download.py
Last active December 20, 2018 09:06
Download Swarm Data
# pip install requests
import requests
import json
url_template = 'https://api.foursquare.com/v2/users/self/checkins?limit=250&oauth_token={}&v=20131026&offset={}'
# to find your oauth token you need to visit the swarm webapp and inspect your network requests, it will be attached
# to XHR requests once you scroll and it starts fetching timeline activity.
# https://www.swarmapp.com/activity
oauth_token = ""
;
; Single target image series plan, created by chandler abraham on Wed, 28 Mar 2018 18:43:08 UTC
; Generated by iTelescope.Net Offline Plan Generator
;
#tiff
#count 2,2,2,3
#interval 200,200,200,200
#binning 1,1,1,1
#filter Red,Green,Blue,Luminance
m83 13.6167 -29.867
import gpxpy
def load_gpx_file(path):
gpx = gpxpy.parse(open(path, 'r'))
points = []
for track in gpx.tracks:
for segment in track.segments:
for point in segment.points:
points.append([point.longitude, point.latitude])
return points
@Chandler
Chandler / client.py
Created December 21, 2017 03:11
Echo Server Client
# Echo client program
import socket
HOST = '127.0.0.1' # The remote host
PORT = 50007 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send('Hello, world')
data = s.recv(1024)
s.close()
import numpy as np
import rasterio
original = rasterio.open("original.tif").read()
# cmd:
# convert -compress LZW -type TrueColor original.tif lossless.tif
lossless = rasterio.open("lossless.tif").read()
# cmd: