Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas A Caswell tacaswell

View GitHub Profile
View mixin_demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / handler_xoffset.py
Created Aug 2, 2013
Line2D handler which lets you tweak the x location of the markers.
View handler_xoffset.py
from matplotlib.legend_handler import HandlerLine2D
class HandlerXoffset(HandlerLine2D):
def __init__(self, marker_pad=0.3, numpoints=1, x_offset=0, **kw):
HandlerLine2D.__init__(self, marker_pad=marker_pad, numpoints=numpoints, **kw)
self._xoffset = x_offset
def get_xdata(self, legend, xdescent, ydescent, width, height, fontsize):
numpoints = self.get_numpoints(legend)
if numpoints > 1:
@tacaswell
tacaswell / hough.py
Last active Dec 21, 2015
Tweaked version of code at http://mail.scipy.org/pipermail/scipy-user/attachments/20060803/ad246212/attachment.py with minor bug fix and improved documentation.
View hough.py
## Copyright (C) 2006 Stefan van der Walt <stefan@sun.ac.za>
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are
## met:
##
## 1. Redistributions of source code must retain the above copyright
## notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimer in
@tacaswell
tacaswell / annotate_range.py
Created Aug 26, 2013
gist for working on annotation range function
View annotate_range.py
def add_range_annotation(ax, start, end, txt_str, y_height=.5, txt_kwargs=None, arrow_kwargs=None):
"""
Adds horizontal arrow annotation with text in the middle
Parameters
----------
ax : matplotlib.Axes
The axes to draw to
start : float
View snippits.el
(defun tac-python-header ()
(interactive "*")
(occur "^\\s-*\\(\\(class\\)\\|\\(def\\)\\)\\|\\(@\\)")
)
(define-skeleton py-np-def
"Skeleton for function definition that includes numppydoc style "
"Name: "
"def " str "(" ("Parameter, %s: " (unless (equal ?\( (char-before)) ", ")
str) "):" \n
View dummy.py
from ophyd import SimDetector
from ophyd.areadetector.plugins import ProcessPlugin, TIFFPlugin
from ophyd.areadetector.filestore_mixins import FileStoreBase
from ophyd.areadetector.trigger_mixins import SingleTrigger
from ophyd.device import (Component as C)
prefix = 'XF:31IDA-BI{Cam:Tbl}'
class LocalTiff(TIFFPlugin, FileStoreBase):
pass
View gist:d9fa54d2005f54174548
tcaswell@xf23id1-srv2:~/bnl_source/conda-prescriptions$ conda create -n dl_test matplotlib=1.3.1
Fetching package metadata: /home/tcaswell/mc3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py:266: SubjectAltNameWarning: Certificate for pergamon.cs.nsls2.local has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
SubjectAltNameWarning
....
Solving package specifications: ....................
Package plan for installation in environment /home/tcaswell/mc3/envs/dl_test:
The following packages will be downloaded:
package | build
View pygotham_state_of_matplotlib.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / install-mongodb.sh
Created Apr 29, 2016 — forked from w0rldart/install-mongodb.sh
Installing MongoDB on Ubuntu 15.04
View install-mongodb.sh
#!/bin/sh
##
## Bash install script for mongo 3.2 for Ubuntu 15.04, because of
## the replacement of upstart with systemd
##
## - AUTHOR: Alexandru Budurovici <https://w0rldart.com>
## - VERSION: 1.0
##
View state_of_the_library_mpl.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.