<jupyter_start><jupyter_text>The rv_histogram plot in the paper<jupyter_code>%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib

# import starspot as ss

plotpar = {'axes.labelsize': 30,
           'font.size': 22,
           'legend.fontsize': 10,
           'xtick.labelsize': 30,
           'ytick.labelsize': 30,
           'text.usetex': True}
plt.rcParams.update(plotpar)<jupyter_output><empty_output><jupyter_text>Load the data.<jupyter_code># df0 = pd.read_csv("../kepler_kinematics/gaia_kepler_lamost.csv")
df0 = pd.read_csv("../data/data.csv")
print(len(df0))
f = np.isfinite(df0.color_teffs.values) & (df0.color_teffs.values > 2000) & (df0.color_teffs.values < 10000)
df = df0.iloc[f]
print("removing stars with weird teffs")
print(len(df))
m = np.isfinite(df.rv.values)
fig = plt.figure(figsize=(8, 5), dpi=200)

ax1 = fig.add_subplot(111)
n, bins = np.histogram(df.phot_g_mean_mag, 40)
# ax1.step(bins[:-1], n, color="C0", lw="2", where="post", label="$\mathrm{All~stars}$");
h = ax1.hist(df.phot_g_mean_mag, 40, color="C0", histtype="step", lw="2", label="$\mathrm{All~stars}$");
ax1.hist(df.phot_g_mean_mag.values[m], bins=h[1], color="C0", alpha=.5,
         label="$\mathrm{Stars~with~RVs}$", rasterized=True);
n, bins = np.histogram(df.phot_g_mean_mag.values, bins=bins)
ax1.set_xlabel("$\mathrm{Gaia~G~mag~[dex]}$");
ax1.set_ylabel("$\mathrm{Number~of~stars}$")
ax1.set_yscale("log")
ax1.legend(loc="upper left", fontsize=18);

plt.tight_layout()
plt.savefig("../plots/rv_histogram")
plt.savefig("../paper/rv_histogram.pdf")

print("minimum teff star with RV = ", min(df.color_teffs.values[m]))
print(sum(df.color_teffs.values[m] < 5000)/sum(df.color_teffs.values < 5000), "of stars cooler than 5000 K have RVs")
print(sum(df.color_teffs.values[m] > 5000)/sum(df.color_teffs.values > 5000), "of stars hotter than 5000 K have RVs")

print("faintest star with RV = ", max(df.phot_g_mean_mag.values[m]))
print(f"Median mag of stars with RVs = {np.median(df.phot_g_mean_mag.values[m])}")
print(f"Median mag of stars without RVs = {np.median(df.phot_g_mean_mag.values[~m])}")
print(sum(df.phot_g_mean_mag.values[m] > np.median(df.phot_g_mean_mag.values[~m])), "stars with RVs fainter than 15th")<jupyter_output>minimum teff star with RV =  3144.0356025005176
0.4628153536604241 of stars cooler than 5000 K have RVs
0.21401159467624725 of stars hotter than 5000 K have RVs
faintest star with RV =  16.930299758911133
Median mag of stars with RVs = 12.874732971191404
Median mag of stars without RVs = 15.013710021972654
1580 stars with RVs fainter than 15th
{'fraction_non_alphanumeric': 0.16178149980966883, 'fraction_numerical': 0.07575180814617434, 'mean_word_length': 5.378640776699029, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '553192', 'license': 'MIT', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1047, 'n_words': 208, 'path': 'notebooks/Plot_rv_histogram.ipynb', 'repo_name': 'RuthAngus/kepler_kinematics', 'size': '2627'}