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
# Imports | |
from __future__ import print_function, division,with_statement | |
import sys | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
args = sys.argv[1] | |
ifile, c0, c1 = args.split(' ') | |
c0 = int(c0) |
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 pandas as pd | |
class display(object): | |
"""Display HTML representation of multiple objects | |
Usage: display('df', "df.groupby('key').std()") | |
""" | |
template = """<div style="float: left; padding: 10px;"> | |
<p style='font-family:"Courier New", Courier, monospace'>{0}</p>{1} | |
</div>""" |
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 pandas as pd | |
import numpy as np | |
class display(object): | |
"""Display HTML representation of multiple objects""" | |
template = """<div style="float: left; padding: 10px;"> | |
<p style='font-family:"Courier New", Courier, monospace'>{0}</p>{1} | |
</div>""" | |
def __init__(self, *args): | |
self.args = args |
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
# %%writefile compare_plots_for_txt_with_comment_head.py | |
# Plot the files | |
# Date: Jul 10, 2018 | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import os,sys,argparse | |
import glob | |
""" |
The DMSTACK module obs_file will ingest a cluster fitsfile and do the CCD processing to give the fits table output src.fits with 77 parameters.
id (0) coord_ra (1)
coord_dec (2) parent (3)
deblend_nChild (4) deblend_psfCenter_x (5)
deblend_psfCenter_y (6) deblend_psfFlux (7)
base_GaussianCentroid_x (8) base_GaussianCentroid_y (9)
base_NaiveCentroid_x (10) base_NaiveCentroid_y (11)
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 norm_scale(X, axis=0): | |
mx = np.max(X, axis=axis) | |
mi = np.min(X, axis=axis) | |
epsilon = 10**-32 | |
return (X — mi) / (np.abs(mi) + mx + epsilon) | |
norm = norm_scale(X) | |
assert np.min(norm) >= 0 | |
assert np.max(norm) <= 1 |
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 sklearn.externals.joblib import Memory | |
memory = Memory(cachedir='/tmp', verbose=0) | |
@memory.cache | |
def computation(p1, p2): | |
return p1 * p2 | |
# example 2 |
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 IPython.core.interactiveshell import InteractiveShell | |
# pretty print all cell's output and not just the last one | |
InteractiveShell.ast_node_interactivity = "all" | |
# pretty print only the last output of the cell | |
# InteractiveShell.ast_node_interactivity = "last_expr" |
OlderNewer