Skip to content

Instantly share code, notes, and snippets.

View jkfurtney's full-sized avatar

Jason Furtney jkfurtney

  • St. Paul, Minnesota
View GitHub Profile
@jkfurtney
jkfurtney / up-goer-five.el
Created January 18, 2013 01:59
Emacs mode for writing with only the thousand most common English words. Inspired by http://xkcd.com/1133/
(defvar upgoer-five-keywords (split-string "a able about above accept across
act actually add admit afraid after afternoon again against age
ago agree ah ahead air all allow almost alone along already
alright also although always am amaze an and anger angry animal
annoy another answer any anymore anyone anything anyway apartment
apparently appear approach are area aren't arm around arrive as
ask asleep ass at attack attempt attention aunt avoid away baby
back bad bag ball band bar barely bathroom be beat beautiful
became because become bed bedroom been before began begin behind
import fipy.tools.numerix as np
from fipy.terms import VanLeerConvectionTerm
import fipy as fp
import pylab as plt
# monkey patch VanLeerConvectionTerm so we can override
# __getGradient in the derived class
VanLeerConvectionTerm._getGradient = VanLeerConvectionTerm._VanLeerConvectionTerm__getGradient
VanLeerConvectionTerm._VanLeerConvectionTerm__getGradient = \
lambda self, a, b: self._getGradient(a, b)
; call trello2org interactively
; or pragmatically like this: (trello2org "c:/Users/jfurtney/blo-up-2-7.json")
(require 'json)
(defun convert-trello-json-file-to-org (trello-json-file)
(let* ((board (json-read-file trello-json-file))
(board-name (cdr (assoc 'name (cdr board))))
(lists (cdr (assoc 'lists (cdr board))))
@jkfurtney
jkfurtney / b.py
Last active August 10, 2016 18:52
Exact solution for path finding example.
import numpy as np
import pylab as plt
from skfmm import travel_time, distance
from scipy.interpolate import RectBivariateSpline
from scipy.optimize import fminbound
from math import sin
# Brachistochrone curve
# see: http://mathworld.wolfram.com/BrachistochroneProblem.html
b=1/np.pi
import numpy as np
import pylab as plt
from sys import float_info
from math import sqrt
from skfmm import distance
N=11
phi = np.ones((N,N))
phi[5,5] = -1
@jkfurtney
jkfurtney / strain_from_disp.py
Created May 25, 2021 15:29
Equivalent strain tensors from displacement field using the Strain at Stations algorithm described in the Cardozo (2009), for use with DEM PFC
import numpy as np
import pandas as pd
import matplotlib; matplotlib.rcParams["savefig.directory"] = "."
from matplotlib import pyplot as plt
from scipy.spatial import cKDTree
from numpy.linalg import lstsq
data0 = np.loadtxt("S1-1_0m.log")
data1 = np.loadtxt("S1-1_3000m.log")
assert (data0[:,0] == data1[:,0]).all()
@jkfurtney
jkfurtney / map_pp_positive.py
Created May 3, 2022 22:49
Map porepressure from a csv file with only positive values to FLAC3D gridpoints.
import itasca as it
from itasca import gpa
import numpy as np
from scipy.constants import foot
from collections import defaultdict
import os
from scipy.spatial import cKDTree
import scipy
if os.path.exists("data.npy"):
# This file was written by Jason Furtney and Wei Fu
# This file is an example of how to generate a surface mesh from lines
# in a DXF file. A vtk file is created of the mesh.
# you may have to install some Python packages to get this to work
import numpy as np
import ezdxf
import time
import itasca as it
it.command("python-reset-state false")
import numpy as np
from itasca import zonearray as za
zid = za.ids()
zz_faces = set()
for i, neighbors in enumerate(za.neighbors()):
this_zone_id = zid[i]
@jkfurtney
jkfurtney / PFC3D_mesh_fragment.py
Created May 17, 2022 13:36
Plot PFC3D fragments as polygons
import numpy as np
import scipy.spatial
import networkx as nx
import itasca as it
from itasca import ballarray as ba
from collections import defaultdict
import itertools
def draw_fragment(points,faces,i):
gname = "tmp{}.geom".format(i)