Skip to content

Instantly share code, notes, and snippets.

@telegraphic
telegraphic / fpga_mmap.py
Created February 19, 2015 17:20
ROACH2-MMAP: Access ROACH2 FPGA data from the PowerPC
"""
fpga_mmap.py
------------
Utilities for reading FPGA data via the memory-mapped /dev/roach/mem file
on the ROACH2 filesystem. This file needs to be run from the ROACH2, and
is an alternative to reading data via KATCP. This provides access only;
you'll need to write your own functions for transferring / storing data.
"""
@telegraphic
telegraphic / spherical_coords.py
Created December 29, 2015 21:04
Conversion between (theta, phi) and (azimuth, elevation) coordinate systems
"""
# spherical_coords.py
Convert between (theta, phi) and (azimuth, elevation) coordinate systems.
Author: Danny Price
License: MIT
## Overview
"""
grid_utils
----------
Utilities for gridding and ungridding data efficiently in Numpy.
"""
import numpy as np
from scipy.interpolate import griddata
@telegraphic
telegraphic / parse_nvidia_smi.py
Created September 23, 2016 00:37
Parse nvidia-smi from python
"""
Parse output of nvidia-smi into a python dictionary.
This is very basic!
"""
import subprocess
import pprint
sp = subprocess.Popen(['nvidia-smi', '-q'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@telegraphic
telegraphic / quantization_efficiency.py
Created May 10, 2017 21:13
ADC quantization efficiency calculations for radio astronomy
"""
# quantization_efficiency.py
This script implements the formulas for quantization efficiency
as used in radio astronomy. The formulas appear in:
Thompson, A. R., D. T. Emerson, and F. R. Schwab (2007),
"Convenient formulas for quantization efficiency",
Radio Sci., 42, RS3022, doi:10.1029/2006RS003585.
@telegraphic
telegraphic / tutorial.ipynb
Last active June 6, 2017 16:43
BL Python tutorial
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@telegraphic
telegraphic / vizier_test.ipynb
Created March 30, 2018 07:25
breakthrough_listen_vizier.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@telegraphic
telegraphic / app.py
Created June 3, 2018 05:07
Example bottle.py app showing how to embed Bokeh plots that update dynamically with AJAX, using AjaxDataSource.
"""
# app.py -- Example bottle.py app showing how to embed AJAX Bokeh plots that update automatically.
"""
from bottle import *
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.resources import CDN
from bokeh.models.sources import AjaxDataSource
#!/usr/bin/env python
from astroquery.jplhorizons import Horizons
from datetime import datetime, timedelta
import pylab as plt
srclist = [
'2015 BZ509',
'2011 SP25',
'2017 RR2',
@telegraphic
telegraphic / app.py
Last active January 12, 2023 02:01
Dash (plot.ly) with ZMQ PubSub, sending numpy arrays with msgpack
"""
# app.py - example Dash + ZMQ + msgpack + numpy monitor
This app receives data from zmq_pub.py, and plots it.
Run the app, browse to localhost:8085 in your web browser, and run zmq_pub.py in a different terminal.
"""
import dash
import dash_core_components as dcc
import dash_html_components as html