Skip to content

Instantly share code, notes, and snippets.

@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')
\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
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]
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:
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:
@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'
#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):
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)
@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

@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