This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is useful if you need to output a float to a string to a given length | |
but don't know what that length is ahead of time. | |
Hence, you can use | |
>>> "%.*f" % (x, 3.1415) | |
instead of | |
>>> str(round(3.1415, x)) | |
where `x` is the number of decimal places you need. | |
The main difference is that the former will pad the end with zeros |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BasicDendrogramViewer(object): | |
def __init__(self, dendrogram, galactic=False): | |
if galactic: | |
self.ax1_limits = [0.1, 0.5, 0.8, 0.4] # image | |
self.slice_slider_ax_limits = [0.05, 0.2, 0.25, 0.03] | |
self.vmin_slider_ax_limits = [0.05, 0.15, 0.25, 0.03] | |
self.vmax_slider_ax_limits = [0.05, 0.1, 0.25, 0.03] | |
self.ax2_limits = [0.4, 0.1, 0.5, 0.35] # dendrogram | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
# Let's make some "dummy" data -- a time coordinate "x" and corresponding data "y". | |
x = np.arange(500) | |
y = np.sin(x/20.) + x/250. | |
period= 20 * 2*np.pi | |
# And then fold it on the period. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Astro501 Project. Tom Rice" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Response to swolk email" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def mad(x): | |
""" | |
Calculates the median absolute deviation of an array. | |
See http://en.wikipedia.org/wiki/Median_absolute_deviation | |
Parameters | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generating dendrogram using 307,278 of 5,296,671 pixels (5% of data) | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% | |
[> ] 0% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def recenter_wcs_header(input_header, central_value=0): | |
""" | |
Sets the header CRVAL on zero if it's not already. | |
A quick-and-dirty implementation. | |
""" | |
new_header = input_header.copy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:bdad813af58e34dc0582a258505db7bd92308dfcb54d7e5edcf2a1dc2e24cfd1" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:101a92bab1e51ebbcfae72e79a03dc466e53ce36a04ab6fab03dd96b2e2f2770" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
OlderNewer