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:

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]
\chapter{Synthesis Database}
\section{Building the Corpus}
A corpus of articles was constructed by first creating search queries using information from the Materials Project (MP) article database \cite{Jain2013}, and then running these queries against various published Application Programming Interfaces (APIs) \cite{ElsevierAPI} or direct-downloading articles in the case where an API was not available. The MP database consisted of a table of approximately 30 000 articles, with each row containing an article's title, author list, abstract and DOI.
For each article's title in the MP database, common words (e.g. a, the) were omitted and the remaining words were used to form a boolean search query (e.g. query=synthesis+zeolite\&count=5). Here, the `count' parameter specified how many related articles to retrieve for each query. These queries were used to download article identification numbers (either DOIs or PIIs) from various publishers, with the majority of articles retrieved from Elsevier using the text mi
@eddotman
eddotman / math_thing.js
Created January 6, 2015 01:08
JS math thing
var accelX = Accel.getX //Assuming Accel.getX can read from Pebble or whatever
var accelY = Accel.getY
var accelZ = Accel.getZ
var threshold = 14.5 //total accel bigger than this means seizure
//METHOD 1: Checking xyz individually
if (accelX > threshold || accelY > threshold || accelZ > threshold ) {
console.log('seizure')
@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)