Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am eddotman on github.
  • I am eddotman (https://keybase.io/eddotman) on keybase.
  • I have a public key ASBLYCW4pmszS-fxMnn3rn1yyhFpn0M9ID-KVrps-Af-qwo

To claim this, I am signing this object:

@eddotman
eddotman / copy_file_loop.py
Last active December 17, 2015 10:39
Copies a file repeatedly on a timed loop. Useful for saving 'snapshots' of self-updating files (e.g. configurations of Monte Carlo simulations).
from time import sleep
from shutil import copyfile
import os
def copy_loop(total_loops, interval, src_file, dst_file):
for x in range(total_loops):
f_name = dst_file + "_" + str(x)
@eddotman
eddotman / contour_plot.py
Last active December 16, 2015 11:29
Example of a contour plotting function with a test data set
import matplotlib.pyplot as plt
from numpy import *
def draw_contour (data, xlabel, ylabel):
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.contourf(data) #use plt.contour() for non-filled contours; plt.contourf() for filled
plt.show()
def run_test(): #plots a 'checkerboard' in 2D
@eddotman
eddotman / sciencefrontend_planning.md
Last active December 16, 2015 11:19
ScienceFrontend Planning Doc

ScienceFrontend

Abstract

ScienceFrontend aims to improve the front-end user experience for command-line-interface (CLI) scientific scripts. Scientific CLI scripts often require a number of dependencies and can be difficult for users unfamiliar with CLI. The goal of ScienceFrontend is to provide a simple, uniform front-end experience while also eliminating end-user software dependencies (besides having a web browser). Naturally, ScienceFrontend is open-source.

Objective & Scope

NORTHWEST-THIRTYFIVE-FIVE-NINETY-THREE:iesl-pdf-to-text eddie$ bin/run.js --svg -i test.pdf -o out.svg
Warning: Setting up fake worker.
# End of Document
/Users/eddie/Documents/programming/iesl-pdf-to-text/src/main/js/pdf.combined.js:3276
var canvas = document.createElement('canvas');
^
TypeError: Object #<Object> has no method 'createElement'
at createScratchCanvas (/Users/eddie/Documents/programming/iesl-pdf-to-text/src/main/js/pdf.combined.js:3276:25)
at img.onload (/Users/eddie/Documents/programming/iesl-pdf-to-text/src/main/js/pdf.combined.js:2768:29)
#e.g. sentence = "To confirm recent reports [7, 8, 9] that human EB-1 is a plus-tip-tracking protein in vitro,
# we visualized EB1 interacting with microtubules [2, 35] polymerizing from stabilized seeds using 2-color TIRF microscopy."
def get_connotation(word):
# some black magic
return score #(1 = positive, -1 = negative, 0 = neutral)
def find_features(sentence):
@eddotman
eddotman / after_script.py
Created February 24, 2015 20:39
after_script
#This script will sit in synthesis-database
from subprocess import call
from os import listdir
from models import Paper
pdf_list = []
pdf_dir = 'files/pdfs/'
xml_dir = 'files/xmls/'
tagged_xml_dir = 'files/tagged_xmls/'
tag_list = 'files/to-tag-list.txt'
def bin_search(f, y, lo, hi, tol, nmax):
if f(lo) < y < f(hi) or f(lo) > y > f(hi):
for i in range(nmax):
mid = (hi+lo)/2.
fmid = f(mid)
if abs(fmid - y) <= tol: break
if (fmid < y and f(lo) < f(hi)) or (fmid > y and f(lo)>f(hi)):
#going right
lo = mid
else:
def bin_search(f, y, lo, hi, tol, nmax):
mid = (hi + lo)/2.
if f(lo) < y < f(hi) or f(lo) > y > f(hi):
for i in range(nmax):
fmid = f(mid)
if abs(fmid - y) <= tol: break
if (fmid < y and f(lo) < f(hi)) or (fmid > y and f(lo)>f(hi)):
#going right
lo = mid
else:
ComputedEntry Fe1 O1
Energy = -12.4718
Correction = -3.4353
Parameters:
run_type = GGA+U
is_hubbard = True
potcar_symbols = [u'pbe O', u'pbe Fe_pv']
hubbards = {u'Fe': 5.3, u'O': 0.0}
Data:
icsd_ids = [633029, 633031, 31081, 60683, 180972, 180973, 180974, 53519, 27856, 633036, 633038, 82233, 76639]