Skip to content

Instantly share code, notes, and snippets.

View jlaura's full-sized avatar
🏠
Working from home

Jay Laura jlaura

🏠
Working from home
View GitHub Profile
@jlaura
jlaura / gist:6223127
Created August 13, 2013 16:49
VBA map generation using arcpy
import arcpy
import pythonaddins
class LayerList(object):
"""Implementation for valuebyalpha_addin.combobox (ComboBox)"""
def __init__(self):
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
import math
%pylab inline
def createhex(xoff=1,yoff=1):
A = (math.cos(math.radians(30)), math.sin(math.radians(30)))
B = (math.cos(math.radians(90)), sin(math.radians(90)))
C = (math.cos(math.radians(150)), sin(math.radians(150)))
D = (math.cos(math.radians(210)), sin(math.radians(210)))
E = (math.cos(math.radians(270)), sin(math.radians(270)))
F = (math.cos(math.radians(330)), sin(math.radians(330)))
@jlaura
jlaura / osrmparser.py
Last active August 29, 2015 14:00
Parse the OSRM data file into NumPy objects.
from struct import unpack
import numpy as np
import sys
#OSRM data type - nodes
node_dtype = np.dtype([('lat', '<i'), ('long', '<i'), ('id', '<I'), ('Flags', '<i')])
#Reading the .osrm file
f = open(sys.argv[1])
f.seek(156) # Skip the header
@jlaura
jlaura / testcKDTree.py
Created July 8, 2014 19:49
Test the cKDTree in scipy.spatial for replacement in the PySAL library
import os
from subprocess import call
import sys
import pysal
from numpy.testing import assert_equal
shps_to_test = []
examplesdir = 'examples/'
@jlaura
jlaura / index.html
Last active August 29, 2015 14:06
PySAL Tree
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
cursor: pointer;
}
.node circle {
fill: #fff;
@jlaura
jlaura / pysalmap.json
Created September 5, 2014 20:10
PySAL JSON
{"name": "PySAL", "children": [{"name": "spatial_dynamics", "children": [{"name": "Tau", "children": []}, {"name": "ergodic", "children": [{"name": "steady_state", "children": []}, {"name": "var_fmpt", "children": []}, {"name": "fmpt", "children": []}]}, {"name": "interaction", "children": [{"name": "modified_knox", "children": []}, {"name": "mantel", "children": []}, {"name": "SpaceTimeEvents", "children": []}, {"name": "jacquez", "children": []}, {"name": "date", "children": []}, {"name": "knox", "children": []}]}, {"name": "mantel", "children": []}, {"name": "directional", "children": [{"name": "rose", "children": []}]}, {"name": "util", "children": [{"name": "get_lower", "children": []}, {"name": "shuffle_matrix", "children": []}]}, {"name": "rose", "children": []}, {"name": "Spatial_Markov", "children": []}, {"name": "rank", "children": [{"name": "SpatialTau", "children": []}, {"name": "Tau", "children": []}, {"name": "rankdata", "children": []}, {"name": "pseudop", "children": []}, {"name": "Theta", "ch
@jlaura
jlaura / gist:634b708101adef1a9258
Created January 14, 2015 14:38
PySAL 1.9 Dev. Documentation parsing issues
pysal.spatial_dynamics.interaction.SpaceTimeEvents: Misalignment / Error in arguments.
<function rose at 0x7fe3b5c9a668>: Misalignment / Error in arguments.
<function pseudop at 0x7fe3b5c9a140>: No documentation.
<function shuffle_matrix at 0x7fe3b5c9a8c0>: Misalignment / Error in arguments.
pysal.spatial_dynamics.markov.Spatial_Markov: Misalignment / Error in arguments.
<function homogeneity at 0x7fe3b5c9a0c8>: Misalignment / Error in arguments.
pysal.spatial_dynamics.markov.Homogeneity_Results: Misalignment / Error in arguments.
pysal.core.util.shapefile.MultiPoint: No documentation.
pysal.core.util.shapefile.NullShape: No documentation.
pysal.core.util.shapefile.shp_file: Misalignment / Error in arguments.
@jlaura
jlaura / gist:cb4d7af59e5e9a2824a4
Created January 20, 2015 22:24
Vispy selection example
import sys
import numpy as np
from PySide import QtGui, QtCore
from vispy import app, scene
from vispy.scene import visuals
from vispy.geometry import generation as gen, create_sphere
app.use_app('pyside')
@jlaura
jlaura / gist:583defa279c340f12181
Created January 21, 2015 15:27
VisPy Context Menu Items
import sys
import numpy as np
import sip
sip.setapi('QString', 2)
from PyQt4 import QtGui, QtCore
from vispy import app, scene
from vispy.scene import visuals
from vispy.geometry import generation as gen, create_sphere
@jlaura
jlaura / error.log
Created March 13, 2015 17:29
Sphinx 1.3 Error Log
# Sphinx version: 1.3
# Python version: 2.7.9 (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.7.3
# Last messages:
# reading sources... [ 19%] library/cg/index
# reading sources... [ 20%] library/cg/kdtree
# reading sources... [ 20%] library/cg/locators
# reading sources... [ 21%] library/cg/rtree
# reading sources... [ 22%] library/cg/shapes