<jupyter_start><jupyter_text>---Pick some values of the total mass, eccentricity, and semi-major axis<jupyter_code>totalMass = 4e12 # total mass of LG or so in Msun
eccentricity = 0.9  # make it big
semiMajorAxis = 5 # in kpc
eccAnoms = np.linspace(0, 2*np.pi,100) # eta between 0 and 2pi
# create instance of observables for a range of eccentric anomalies
obsInst = observables(semiMajorAxis, eccentricity, eccAnoms, totalMass)<jupyter_output><empty_output><jupyter_text>---<jupyter_code>xs, ys = obsInst.xy
vxs, vys = obsInst.vxy
vrad = obsInst.vrad_kepler
vtan = obsInst.vtan_kepler
trueAnomaly = obsInst.trueAnomaly
seps = obsInst.separation

# want true anomaly to increase from 0 to 2pi as well
trueAnomalyCorrected = np.where(trueAnomaly<0,trueAnomaly+2*np.pi,trueAnomaly)
# eccentric anomaly vs true anomaly to check intuition

fig, ax = plt.subplots(figsize=(8,8))
plt.scatter(eccAnoms, trueAnomalyCorrected)
plt.xlabel(r"Eccentric Anomaly ($\eta$)")
plt.ylabel(r"True Anomaly ($f$)")
ax.axhline(np.pi/2)
ax.axvline(np.pi/8)
ax.set_aspect("equal")
plt.show()
fig, ax = plt.subplots(figsize=(8,8),subplot_kw={'projection': 'polar'})
plt.plot(eccAnoms, seps)
origin = ([0,1],[0,1])
plt.title("Eccentric Anomaly vs. separation")
plt.show()

fig, ax = plt.subplots(figsize=(8,8),subplot_kw={'projection': 'polar'})
plt.plot(trueAnomaly, seps)
origin = ([0,1],[0,1])
plt.title("True Anomaly vs. separation")
plt.show()<jupyter_output><empty_output><jupyter_text>___Plots of x & y and velocities<jupyter_code>fig, ax = plt.subplots(1,2, figsize=(12,10))
scatterEcc = ax[0].scatter(xs, ys, c = eccAnoms/np.pi, cmap = "cool")
scatterTrue = ax[1].scatter(xs, ys, c = trueAnomalyCorrected/np.pi, cmap = "cool")
plt.colorbar(scatterEcc,ax=ax, label=r" Anomaly / $\pi$",location="bottom")
ax[0].set_title("Eccentric")
ax[1].set_title("True")
for axx in ax:
    axx.set_aspect("equal")
    axx.axhline(0,c="black",lw=0.5)
    axx.axvline(0,c="black",lw=0.5)
plt.show()
fig, ax = plt.subplots(1,2, figsize=(12,10),sharey=True)
plt.subplots_adjust(wspace=0.1)
scatterEcc = ax[0].scatter(vrad.to(u.km/u.s), vtan.to(u.km/u.s), c= eccAnoms/np.pi, cmap = "cool")
scatterTrue = ax[1].scatter(vrad.to(u.km/u.s), vtan.to(u.km/u.s), c=trueAnomalyCorrected/np.pi, cmap = "cool")
plt.colorbar(scatterEcc,ax=ax, label=r" Anomaly / $\pi$",location="bottom")
ax[0].set_title("Eccentric")
ax[1].set_title("True")
ax[0].set_ylabel(r"$v_{\rm tan}$")

for axx in ax:
    axx.set_aspect("equal")
    axx.set_xlabel(r"$v_{\rm rad}$")
#     axx.axhline(0,c="black",lw=0.5)
#     axx.axvline(0,c="black",lw=0.5)
plt.show()


# fig, ax = plt.subplots(figsize=(8,8))
# scatter = ax.scatter(vrad.to(u.km/u.s), vtan.to(u.km/u.s), c=trueAnomalyCorrected/np.pi)
# ax.xlabel = ()
# ax.set_aspect("equal")
# ax.set_xlabel(r"$v_{\rm rad}$")
# ax.set_xlabel(r"$v_{\rm tan}$")
# plt.colorbar(scatter, label=r"Eccentric Anomaly / $\pi$")
# plt.show()
fig, ax = plt.subplots(1,2, figsize=(12,10),sharey=True)
plt.subplots_adjust(wspace=0.1)
scatterEcc = ax[0].scatter(vxs.to(u.km/u.s), vys.to(u.km/u.s), c=eccAnoms/np.pi, cmap = "cool")
scatterTrue = ax[1].scatter(vxs.to(u.km/u.s), vys.to(u.km/u.s), c=trueAnomalyCorrected/np.pi, cmap = "cool")
plt.colorbar(scatterEcc,ax=ax, label=r" Anomaly / $\pi$",location="bottom")
ax[0].set_title("Eccentric")
ax[1].set_title("True")
ax[0].set_ylabel(r"$v_{\rm y}$")

for axx in ax:
#     axx.set_aspect("equal")
    axx.set_xlabel(r"$v_{\rm x}$")
    axx.axhline(0,c="black",lw=0.5)
    axx.axvline(0,c="black",lw=0.5)
plt.show()

# create instance of observables for a range of eccentric anomalies
singleInst = observables(semiMajorAxis, eccentricity, np.array([0,np.pi/2, np.pi, 3*np.pi/2, 2*np.pi]), totalMass)

singleInst.trueAnomaly
singleInst.vrad_kepler.to(u.km/u.s)
singleInst.vtan_kepler.to(u.km/u.s)
x, y = singleInst.xy
vx, vy = singleInst.vxy
vx.to(u.km/u.s)
vy.to(u.km/u.s)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19576314446145993, 'fraction_numerical': 0.02399183256763655, 'mean_word_length': 5.65365025466893, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, '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': '602734', 'license': 'MIT', 'n_tokens_mistral': 1846, 'n_tokens_neox': 1742, 'n_words': 281, 'path': 'notebooks/observables_class.ipynb', 'repo_name': 'katiechambe/yellowCard', 'size': '3918'}