Skip to content

Instantly share code, notes, and snippets.

View alexrudy's full-sized avatar

Alex Rudy alexrudy

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexrudy
alexrudy / matplotlib-fonts-osx.md
Last active July 12, 2022 13:16
Adding custom fonts to Matplotlib on OS X

How to add custom (or system) fonts to matplotlib on OS X

Matplotlib expects to find .ttf fonts on your system. Newer versions of OS X use .dfont files. Converting them is easy, and putting them in a proper font path is also easy. The user font path on OS X is ~/Library/Fonts/, and matplotlib will find fonts here.

  1. First, install what you'll need:
  • matplotlib
  • fondu (port install fondu, or brew install fondu)
  1. Then find your desired font file. For system font files, the easiest way to do this is in the FontBook application. You can open FontBook in your utlities folder. Then select your font of choice, right click on it, and select "Show in Finder". You'll need to know where it is. Many system fonts are in places like /System/Library/Fonts/...
  2. Move to your user's font directory ~/Library/Fonts/.
  3. Use fondu to convert the OS-X specific font file (ends with .dfont) to .ttf.
@alexrudy
alexrudy / telemetry.rst
Last active November 4, 2015 18:05
Telemetry for ShaneAO Documentation

Telemetry recorder tools.

The interface for the telemetry recorder is only available in the ShaneAO command line interface for now. Please use the box next to the >>> symbol in ShaneAO to enter telemetry commands.

The telemetry recorder will:

  • Only record closed loop telemetry when the system appears settled.
  • Only start once the user calls telemetry.start().
@alexrudy
alexrudy / ipydb.py
Created September 20, 2015 20:17
IPython Debugger
# -*- coding: utf-8 -*-
import sys
import warnings
_ipydb_active = False
def ipydb():
"""Try to use the iPython debugger on program failures."""
global _ipydb_active
@alexrudy
alexrudy / Compound Models.ipynb
Created May 5, 2015 22:07
Compound Astropy Models
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexrudy
alexrudy / tmux_funcs.sh
Last active August 29, 2015 14:19
tmux shell scripting functions
#
# tmux_funcs.sh
#
# This file provides some basic helper functions for
# working with TMUX from a shell script.
#
# Copyright (c) 2015, Alexander Rudy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@alexrudy
alexrudy / submit.pl
Last active August 29, 2015 14:19
Prepare LaTeX Manuscripts for Submission
#!/usr/bin/env perl
#
# submit.pl
# A simple tool to prepare .tex manuscirpts for submission.
#
# Copyright (c) 2015, Alexander Rudy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@alexrudy
alexrudy / flipaxes.py
Last active August 29, 2015 14:17
Flip OSIRIS Datacube axes.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""OSIRIS Datacubes have axes which are (WAVE, RA, DEC) in FITS files. Most programs
for reading and analyzing data cubes expect to have axes which are (RA, DEC, ...).
This script moves the (RA, DEC) axes to the front of the data cube.
The data is transformed using :func:`numpy.rollaxis` and the WCS solution is transformed
using :meth:`~astropy.wcs.WCS.reorient_celestial_first`. All other FITS header keywords
remain unchanged.
@alexrudy
alexrudy / starlist.py
Last active August 29, 2015 14:14
Starlist Parsing Tools
"""
This is a parser for the Keck starlist format.
The format is documented at the Keck website: <https://www2.keck.hawaii.edu/observing/starlist.html>
Author: Alex Rudy, UCSC
Date: 2015-01-24
License: BSD
"""
import warnings
@alexrudy
alexrudy / MeetingNotes-6-17.md
Created June 18, 2014 04:32
Meeting Notes from 2014/6/17

First Group Meeting

Evan and I met to discuss the start of his SIP work. We are currently persuing three projects:

  1. Learning Python
  2. Exploring images of the Crab Nebula
  3. Reading the Schweitzer et. al. Paper

We also talked briefly about stellar evolution, and how Pulsars form.