This file contains hidden or 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 pathlib import Path | |
from difflib import SequenceMatcher | |
import re | |
# Some example dataset templates from policy/datasets.yaml in obs_base | |
templates = {'deepCoadd_obj': 'deepCoadd-results/merged/%(tract)d/%(patch)s/obj-%(tract)d-%(patch)s.parq', | |
'deepCoadd_qa': 'deepCoadd-results/qa/%(tract)d/%(patch)s/qa-%(tract)d-%(patch)s.parq', | |
'analysisVisitTable': 'plots/%(filter)s/tract-%(tract)d/visit-%(visit)d/%(tract)d_%(visit)d.parq', | |
'analysisVisitTable_commonZp': 'plots/%(filter)s/tract-%(tract)d/visit-%(visit)d/%(tract)d_%(visit)d_commonZp.parq', | |
'analysisCoaddTable_forced': 'plots/%(filter)s/tract-%(tract)d/%(tract)d_forced.parq', |
This file contains hidden or 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
# Need to run this with 'bolo' branch from github.com/timothydmorton/isochrones | |
from isochrones.mist.isochrone import MIST_BasicIsochrone | |
from isochrones import StarModel | |
iso = MIST_BasicIsochrone() | |
iso.initialize() # This will take a few minutes the first time you run this. | |
mags = {'J': (10.14, 0.02), | |
'H': (9.81, 0.02), |
This file contains hidden or 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 holoviews as hv | |
from bokeh.io import curdoc | |
from bokeh.layouts import layout | |
from bokeh.models.widgets import Panel, Tabs | |
import holoviews as hv | |
renderer = hv.renderer('bokeh').instance(mode='server') |
This file contains hidden or 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 holoviews as hv | |
hv.notebook_extension('bokeh') | |
import param | |
from holoviews.operation.datashader import datashade, dynspread | |
import colorcet as cc | |
import datashader | |
import numpy as np | |
import pandas as pd |
This file contains hidden or 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 holoviews as hv | |
import pandas as pd | |
from bokeh.application.handlers import FunctionHandler | |
from bokeh.application import Application | |
from bokeh.io import show | |
from bokeh.layouts import layout | |
from bokeh.plotting import curdoc |
This file contains hidden or 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 scipy.optimize import root | |
import numpy as np | |
from scipy.special import spherical_jn | |
import matplotlib.pyplot as plt | |
def spherical_jn_sensible_grid(n, m, ngrid=100): | |
"""Returns a grid of x values that should contain the first m zeros, but not too many. | |
""" | |
return np.linspace(n, n + 2*m*(np.pi * (np.log(n)+1)), ngrid) | |
This file contains hidden or 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 model(p, x): | |
""" | |
p are parameters of the model, in this case C, alpha | |
where y = C*x^alpha | |
""" | |
return p[0]*x**p[1] | |
def lnlike(p, xdata, ydata, yerr=1.): |