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
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import montage | |
>>> montage.mArchiveList('2MASS', 'K', 'm31', 0.5, 0.5, 'm31_list.tbl') | |
count : 18 | |
stat : OK | |
>>> montage.mMakeHdr('m31_list.tbl', 'header.hdr', north_aligned=True) | |
count : 18 | |
lat4 : 41.744136 |
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
# The purpose of this script is to automatically install APLpy and all | |
# the dependencies (except numpy and matplotlib), either using the latest | |
# stable versions of packages, or the latest unstable versions from svn or | |
# git repositories. | |
import os | |
import getopt | |
import sys | |
import tempfile | |
import urllib |
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 io | |
import numpy as np | |
import atpy | |
def chunk(string, n): | |
return [string[i*n:i*n+n] for i in range(len(string) / n)] | |
# Open file |
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
# Pipe text into this to get a word count list in decreasing order, e.g.: | |
# | |
# $ detex ms.tex | python wordcount.py | |
# model:9 | |
# star:8 | |
# formation:7 | |
# YSOs:7 | |
# ... | |
import sys |
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 h5py | |
def parse_multi_tuple(string): | |
string = string.replace(' ', '') | |
string = string.replace(')(', '), (') | |
return eval(string) | |
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 glob | |
import sys | |
def extract_doi(filename): | |
f = open(filename,'rb') | |
text = f.read() | |
f.close() | |
start = text.find('URI(') | |
if start > 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
from mendeley_client import MendeleyClient | |
mendeley = MendeleyClient(..., ...) # Fill out API keys here | |
try: | |
mendeley.load_keys() | |
except IOError: | |
mendeley.get_required_keys() | |
mendeley.save_keys() |
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 cloud | |
cloud.setkey('...','...') | |
def square(x): | |
return x*x | |
jid = cloud.call(square,3) | |
cloud.result(jid) |
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 sys | |
import os | |
from hashlib import md5 | |
def dir_size(directory): | |
"Find the total size of a directory" | |
folder_size = 0 | |
for (path, dirs, files) in os.walk(directory): | |
for filename in files: |
OlderNewer