Skip to content

Instantly share code, notes, and snippets.

@cwebber314
cwebber314 / psspy_redirect.py
Last active August 29, 2015 14:15
Capture output from psspy commands
import pssepath
pssepath.add_pssepath()
import psspy
import redirect
redirect.psse2py()
import sys
# This command prints results to console
@cwebber314
cwebber314 / find_bad_inservice.py
Created March 23, 2012 00:35
Find not Inservice buses attached to InService branches
"""
Find not Inservice buses attached to InService branches
"""
try:
import pssepath #Daniel Hiller's awesome PSSE environment setup module
pssepath.add_pssepath()
import psspy
except:
# Until i get this solved the right way this will have to do
PSSE_LOCATION = r"C:\Program Files\PTI\PSSE32\PSSBIN"
"""
Show legend to left outside of plot area.
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.pyplot import show
from matplotlib.ticker import MaxNLocator
import matplotlib.gridspec as gridspec
from jinja2 import Template
f = open('template.html')
html = f.read()
f.close()
template = Template(html)
signals = {'s1': 0.0,
's2': 1.0,
's3': 'up',
@cwebber314
cwebber314 / build_pandas_hdf5
Last active December 24, 2015 01:29
Build a pandas hdf store up a little at a time. This is useful for large data sets which do not fit in memory.
"""
References
--------------
[1] http://stackoverflow.com/questions/16997048/how-does-one-append-large-amounts-of-data-to-a-pandas-hdfstore-and-get-a-natural/16999397#16999397
[2] http://stackoverflow.com/questions/19036380/filtering-a-pytables-table-on-pandas-import
[4] http://pandas.pydata.org/pandas-docs/dev/cookbook.html#hdfstore
"""
# Build pandas dataframe on disk
/ -------------------------------------------------
// Setup run folders
// -------------------------------------------------
def getRunFoldersFromRootDir(): List[String] = {
val rootDir = new File(getSingleInput(Option("Path to the run folder root dir")))
require(rootDir.isDirectory(), rootDir + " was not a directory.")
rootDir.listFiles().toList.map(f => f.getAbsolutePath())
}
@cwebber314
cwebber314 / demote_html.py
Created November 12, 2013 03:34
I use this gist to concatenate stand-along html files or embed one html file in a master html file.
from bs4 import BeautifulSoup
fn = r'solution1_printed.htm'
f = open(fn, 'r')
html = f.read()
f.close()
soup = BeautifulSoup(html)
body = soup.body
replaces = [
@cwebber314
cwebber314 / olvDemo_image.py
Created November 18, 2013 06:52
object list view demo with added image. I can't get the AddNamedImages() to work so I use the AddImages() method.
#####################################################################
# olvDemo.py
#
# Created 12/2009 by Mike Driscoll
#
# Based on example code from source and
# http://objectlistview.sourceforge.net/python/cellEditing.html
#
#####################################################################
import wx
@cwebber314
cwebber314 / tree_table
Last active December 29, 2015 11:59
quick and dirty static tree using a table in html. It's not a real tree, but I want a grid that hints at hierarchy.
<!DOCTYPE html>
<html>
<script>
var folder="https://lh3.googleusercontent.com/-oV4dZvrGpyA/UpYSO1u-fjI/AAAAAAAAJRI/PO6Bq3aYtS0/s16-no/page.png"
var page="https://lh3.googleusercontent.com/-oV4dZvrGpyA/UpYSO1u-fjI/AAAAAAAAJRI/PO6Bq3aYtS0/s16-no/page.png"
</script>
<head>
<style>
table {
border-collapse:collapse;
"""
TODO: Please Give me a name
======================
And a brief description.
Input files:
- DIFF: file with a set of instruction which area applied to the dna sequences in
the REFERENCE file.
- REFERENCE: File with reference DNA sequences.