<jupyter_start><jupyter_text>Problem 1I will be critiquing the plots from <NAME>'s seminal publication on the discovery of steadily increasing redshift. The following plot is what he used to determine a good estimate for the expansion constant of the universe:The one I want to comment on is the conclusion that he derives from this graph:Here he illustrates the different options that expansion constants imply. I believe that the use of shading to illustrate the confidence levels of the different regions is very clever and the colors are clear and distinct. Overall, it is an excellent plot. That being said, I'm not sure the confidence intervals were necessary and could have been ommitted in order to make the plot cleaner and perhaps more room to label other interesting regions. Furthermore, it is not immediately obvious without reading the caption how the red contour is related to the others and I firmly believe that there is a more subtle way to imply that it is the convolution of the the two sets of data.  Problem 2Here, I've recalled an old plot that was related to the trigger efficiency of our detector. The method to finding the efficiency was complicated but we essentially ended up with the following graph of the minimum input signal in count samples in order to achieve 98% efficiency for every run. Each of these points, comes from a separate graph, which it can be useful to see if anything looks weird or off. So my improvement is simply to find a convenient and intuitive way to see the underlying plot to each point.<jupyter_code>#here I copy some old python code. It's ugly because it's like 3 years old and I was a lot worse back then
import numpy as np
import scipy as sp
import re
from matplotlib import rc, gridspec, cm
import matplotlib.pylab as plt

rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
rc('text', usetex=True)

# Read in sets of data from file using "loadtxt()".
run, source, capacitor = np.genfromtxt('./RunSourcesCamp6.txt', unpack=True, skip_header=2, delimiter = ' | ',dtype = 'str')
effrun, eff10, eff50, eff95, eff98, asy, asyerr = sp.loadtxt('./effic_rates_asym_list6008_to_7592.txt', unpack = True, skiprows = 1,delimiter = '\t')

#datatype because everything sucks
run = run.astype(np.int)

#First find the intersecting values
commonruns = np.intersect1d(run, effrun)

#Now alter the lists to be only the common runs (first alter the spemeans and stuff)
eff10 = [eff10[x] for x in [np.where(effrun==commonruns[i])[0][0] for i in range(0,len(commonruns))]]
eff50 = [eff50[x] for x in [np.where(effrun==commonruns[i])[0][0] for i in range(0,len(commonruns))]]
eff95 = [eff95[x] for x in [np.where(effrun==commonruns[i])[0][0] for i in range(0,len(commonruns))]]
eff98 = [eff98[x] for x in [np.where(effrun==commonruns[i])[0][0] for i in range(0,len(commonruns))]]

source = [source[x] for x in [np.where(run==commonruns[i])[0][0] for i in range(0,len(commonruns))]]
capacitor = [capacitor[x] for x in [np.where(run==commonruns[i])[0][0] for i in range(0,len(commonruns))]]

trigg10_avg = np.mean(eff10)
trigg50_avg = np.mean(eff50)
trigg95_avg = np.mean(eff95)
trigg98_avg = np.mean(eff98)

#Get all the different sources
sources = []
for i in range(0,len(effrun)):
    if (source[i].find("YBe + strong 57Co") !=-1) or (source[i].find("YBe  ")!= -1):
        source[i] = "YBe + strong Co57 + 2 Pb sheets"
    if source[i].find("YAl  ") !=-1:
        source[i] = "YAl + strong Co57 + 2 Pb sheets"
    if source[i].find("strong 57Co + 2 Pb sheets") !=-1:
        source[i] = "strong Co57 + 2 Pb sheets"
for i in range(0,len(effrun)):
    if not source[i] in sources:
        sources.append(source[i])

#arrange by sources
sourceinfo = []
for m in range(0,len(sources)):
    sourcex = []
    sourceff = []
    for q in range(0,len(effrun)):
        if source[q] == sources[m]:
            sourcex.append(effrun[q]) #run[q]
            sourceff.append(eff98[q])
    myvec = []
    myvec.append(sourcex)
    myvec.append(sourceff)
    myvec.append(sources[m])
    sourceinfo.append(myvec)
from ipywidgets import interact
from bokeh.io import push_notebook, show, output_notebook
from bokeh.layouts import widgetbox
from bokeh.models.widgets import Panel, Tabs, TextInput
from bokeh.plotting import figure
import seaborn.apionly as sns
import itertools

output_notebook()

ncolors = len(sources) + 1
palette = sns.palettes.color_palette('viridis', ncolors)
colors = itertools.cycle(palette.as_hex())

p = figure(title="Trigger Efficiencies", plot_height=600, plot_width=600, x_axis_label='Run Number', y_axis_label='Minimum Charge Required to Achieve 98% Efficiency')


for i,c in zip(range(0,len(sources)), colors):
    datalabel = sourceinfo[i][2]
    p.scatter(sourceinfo[i][0],sourceinfo[i][1],color = c, legend = datalabel)<jupyter_output>/media/shared/Public/anaconda3/lib/python3.6/site-packages/seaborn/apionly.py:6: UserWarning: As seaborn no longer sets a default style on import, the seaborn.apionly module is deprecated. It will be removed in a future version.
  warnings.warn(msg, UserWarning)<jupyter_text>Below is the interactive plot. The "Plot" tab corresponds to the interactive version of first plot shown and the "Raw" tab corresponds to the input data for each point. You can change which plot is being viewed by selecting a different run from the drop down menu.<jupyter_code>#add in the sweet interactions
output_notebook()

val = 6008
path = "./ohlord/run_" + str(val) + ".txt"

x,y = sp.loadtxt(path, unpack = True, skiprows = 0,delimiter = '\t')
p2 = figure(title="Raw Efficiency", plot_height=600, plot_width=600, x_axis_label='Integrated Charge (Count*Samples)', y_axis_label='Trigger Efficiency')
r = p2.scatter(x,y,color = 'red')

tab1 = Panel(child=p, title="Plot")
tab2 = Panel(child=p2, title="Raw")

tabs = Tabs(tabs=[ tab1, tab2 ])
def raw(Run):
    path = "./ohlord/run_" + str(Run).rstrip(".0") + ".txt"
    x,y = sp.loadtxt(path, unpack = True, skiprows = 0,delimiter = '\t')
    r.data_source.data['x'] = x
    r.data_source.data['y'] = y
    push_notebook()

show(tabs, notebook_handle=True)

interact(raw,Run = effrun)<jupyter_output><empty_output><jupyter_text>Problem 3Recreated below with the code.<jupyter_code>#moving on to the last one

nyd, temp = sp.loadtxt('./hw_2_data/ny_temps.txt', unpack = True, skiprows = 1,delimiter = '\t')
yd, ystock = sp.loadtxt('./hw_2_data/yahoo_data.txt', unpack = True, skiprows = 1,delimiter = '\t')
gd, gstock = sp.loadtxt('./hw_2_data/google_data.txt', unpack = True, skiprows = 1,delimiter = '\t')
fig, ax1 = plt.subplots()
fig.suptitle("New York Temperature, Google, and Yahoo!")
ax1.plot(yd,ystock,'m-')
ax1.plot(gd,gstock,'b-')
ax1.set_xlabel("Date (MJD)")
ax1.set_ylabel("Value (Dollars)")

ax2 = ax1.twinx()
ax2.plot(nyd,temp, 'r--')
ax2.set_ylim([-150,100])
ax2.set_ylabel("Temperature ($^\circ$F)")

plt.show()<jupyter_output><input>:16: DeprecationWarning: invalid escape sequence \c
<input>:16: DeprecationWarning: invalid escape sequence \c
<input>:16: DeprecationWarning: invalid escape sequence \c
<ipython-input-137-d1189685a656>:16: DeprecationWarning: invalid escape sequence \c
  ax2.set_ylabel("Temperature ($^\circ$F)")
{'fraction_non_alphanumeric': 0.12357361536320624, 'fraction_numerical': 0.025187865293626495, 'mean_word_length': 4.93476465730801, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '542476', 'license': 'MIT', 'n_tokens_mistral': 2510, 'n_tokens_neox': 2376, 'n_words': 805, 'path': 'roglans_hw_2/hw2_bokeh.ipynb', 'repo_name': 'roglans/roglans_ay250_hw', 'size': '7195'}