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 time | |
import multiprocessing as mp | |
import numpy as np | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy.ma as ma | |
import matplotlib.pyplot as plt | |
import matplotlib.colors as colors | |
def make_colormap(color): | |
r, g, b = colors.colorConverter.to_rgb(color) |
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
# Remove all but the latest N versions from wheels on Anaconda.org | |
# Usefult to avoid building up too many files when uploading | |
# developer wheels. | |
from binstar_client.utils import get_server_api | |
KEEP_N_LATEST = 10 | |
api = get_server_api(token=<TOKEN>) | |
package = api.package("astropy", "astropy") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Object-oriented API | |
# | |
# Memory usage (iteration, object count, memory size) | |
# 100 5637 1562216 | |
# 200 5529 1491528 | |
# 300 5422 1426264 | |
# 400 5758 1587376 | |
# 500 5422 1426288 | |
# 600 5416 1440456 | |
# 700 5610 1515056 |
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 os | |
import random | |
import string | |
import tempfile | |
import subprocess | |
def random_id(length=8): | |
return ''.join(random.sample(string.ascii_letters + string.digits, length)) | |
TEMPLATE_SERIAL = """ |
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 merge_structured_arrays(array1, array2): | |
n1 = len(array1) | |
n2 = len(array2) | |
array_out = array1.copy() | |
array_out.resize(n1 + n2) | |
array_out[n1:] = array2 | |
return array_out |
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
# Convert 2MASS ATLAS images into MJy/sr, and subtract background value | |
# estimated by 2MASS pipeline. | |
# | |
# Example: | |
# | |
# >>> atlas_to_MJysr('glimpse_k_test.fits', 'glimpse_k_cal.fits') | |
# | |
import pyfits | |
import pywcs |
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 sample_dask_array_chunks(array, n_chunks): | |
""" | |
Return an 1-d array which contains the data values from n_chunks randomly | |
sampled from the chunks in the array (without replacement) | |
""" | |
# Find the indices of the chunks to extract | |
indices = [np.random.randint(dimsize, size=n_chunks) for dimsize in array.numblocks] | |
# Determine the boundaries of chunks along each dimension |
NewerOlder