Skip to content

Instantly share code, notes, and snippets.

(function () {
d3.analog= function() {
var height = 100, gap=10,
xValue = function(d) { return d[0]; },
xScale = null,
color = d3.scale.category10();
function chart(selection) {
selection.each(function(d) {
var g = d3.select(this);
# Intended to convert a typical radar lla and az el to a cesium quaternion orientation for CZML
# Uses numpy, transformations.py (http://www.lfd.uci.edu/~gohlke/code/transformations.py.html),
# and ecef.py (https://code.google.com/p/pysatel/source/browse/trunk/coord.py?r=22)
def azEl2Quaternion(lat, lon, alt, az, el):
rotZ = rotation_matrix(math.radians(180+az), [0,0,1])
rotY = rotation_matrix(math.radians(-(90+el)), [0,1,0])
rotM = np.dot(rotZ, rotY)
origin = geodetic2ecef(lat, lon, alt)
origin = np.multiply(origin, 1000)
@rothnic
rothnic / example_class_diagram.dot
Created September 1, 2014 07:14
Example Matlab Class Diagram GraphViz File
digraph MatlabClassDiagram {
fontname = "Bitstream Vera Sans"
fontsize = 8
rankdir = BT
node [
shape = "record"
fontsize = 8
]
graph [
splines = ortho
@rothnic
rothnic / dashboard.jsx
Last active August 29, 2015 14:12
react-grid-layout component
'use strict';
var React = require('react/addons');
var _ = require('lodash');
var ResponsiveReactGridLayout = require('react-grid-layout').Responsive;
var Dashboard = React.createClass({
mixins: [React.addons.PureRenderMixin],
getDefaultProps() {
return {
@rothnic
rothnic / bokeh_alpha_testing.py
Last active August 29, 2015 14:20
Bokeh Alpha Testing
import bokeh.plotting as plt
from itertools import product
plt.output_file('test.html')
alpha = 0.5
circle_size = 50
line_size = 5
cats = ['RGB', 'RGBA', 'Alpha+RGB', 'Alpha+RGBA']
p = plt.figure(x_range=cats, y_range=cats)
@rothnic
rothnic / pyenv_3.4.3_build_log.log
Last active August 29, 2015 14:24
pyenv 3.4.3 failed build in alpine linux
→ docker run --rm -v "$(pwd)"/.python:/root/.pyenv/versions -v "$(pwd)"/.cache/python:/root/.pyenv/cache -it python-builder install -v 3.4.3
Downloading Python-3.4.3.tgz...
/tmp/python-build.20150709235551.45 /
-> https://yyuu.github.io/pythons/4281ff86778db65892c05151d5de738d
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: application/octet-stream
Last-Modified: Sun, 24 May 2015 02:07:15 GMT
Access-Control-Allow-Origin: *
Expires: Fri, 10 Jul 2015 00:05:56 GMT
@rothnic
rothnic / bokeh_chart_props.py
Last active July 27, 2017 01:40
Modeling chart properties
from bokeh.properties import HasProps, List, String, Either, Instance, Bool
from bokeh.models.widgets import Select, Widget, Toggle
import pandas as pd
from blaze.interactive import InteractiveSymbol, Data
from odo import odo
from bokeh.io import vform
from bokeh.plotting import output_file, show
from bokeh.plotting import figure, Figure
@rothnic
rothnic / .gitignore
Last active August 29, 2015 14:26
Generic Assignment of Chart Attributes Based on Columns using Pandas DataFrame
.ipynb_checkpoints
@rothnic
rothnic / collect_articles.py
Created September 25, 2015 00:42
Asyncio with ProcessPool to collect and process data about urls, using Newspaper
"""Collect article metadata and associate it with url dimension.
Currently the url dimension includes a domain and url, but there is
a higher level grouping that we care about. What is the outlet,
who authored the article, what kind of site is it, when was
it published, etc.
"""
import os
@rothnic
rothnic / chart_app.py
Created October 23, 2015 15:10
Prototype Interactive Bokeh Chart
from bokeh.models import Plot, ColumnDataSource, GlyphRenderer
from bokeh.properties import Instance, Dict, String, Any
from bokeh.server.app import bokeh_app
from bokeh.server.utils.plugins import object_page
from bokeh.models.widgets import HBox, TextInput, VBoxForm, Select
from bokeh.charts import Bar
class ChartApp(HBox):
"""An example of a browser-based, interactive plot with column selection controls."""