-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import neospy | ||
|
||
lon_steps = np.linspace(0, 360, 1000) | ||
equatorial = [neospy.Vector.from_ra_dec(step, 0) for step in lon_steps] | ||
ecliptic = [neospy.Vector.from_lat_lon(0, step) for step in lon_steps] | ||
galactic = [ | ||
neospy.Vector.from_el_az(0, step, 1, frame=neospy.Frames.Galactic) | ||
for step in lon_steps | ||
] | ||
|
||
vectors_frames = [equatorial, ecliptic, galactic] | ||
|
||
fig = plt.figure(figsize=(6, 8)) | ||
plt.subplot(3, 1, 1, projection="mollweide") | ||
plt.title("Equatorial Frame") | ||
for vectors in vectors_frames: | ||
frame = str(vectors[0].frame).split(".")[1] | ||
vecs = [v.as_equatorial for v in vectors] | ||
pos = np.array([[v.az, v.el] for v in vecs]) | ||
|
||
# roll the indices so that it plots pretty | ||
# this is just to make the visualization nice | ||
pos[:, 0] = (pos[:, 0] + 180) % 360 - 180 | ||
idx = np.argmax(abs(np.diff(pos[:, 0]))) | ||
pos = np.roll(pos, -idx - 1, axis=0) | ||
pos = np.radians(pos) | ||
|
||
# plot the results | ||
plt.plot(*pos.T, label=frame) | ||
plt.grid() | ||
|
||
|
||
plt.subplot(3, 1, 2, projection="mollweide") | ||
plt.title("Ecliptic Frame") | ||
for vectors in vectors_frames: | ||
frame = str(vectors[0].frame).split(".")[1] | ||
vecs = [v.as_ecliptic for v in vectors] | ||
pos = np.array([[v.az, v.el] for v in vecs]) | ||
|
||
# roll the indices so that it plots pretty | ||
# this is just to make the visualization nice | ||
pos[:, 0] = (pos[:, 0] + 180) % 360 - 180 | ||
idx = np.argmax(abs(np.diff(pos[:, 0]))) | ||
pos = np.roll(pos, -idx - 1, axis=0) | ||
pos = np.radians(pos) | ||
|
||
# plot the results | ||
plt.plot(*pos.T, label=frame) | ||
plt.grid() | ||
|
||
|
||
plt.subplot(3, 1, 3, projection="mollweide") | ||
plt.title("Galactic Frame") | ||
for vectors in vectors_frames: | ||
frame = str(vectors[0].frame).split(".")[1] | ||
vecs = [v.as_galactic for v in vectors] | ||
pos = np.array([[v.az, v.el] for v in vecs]) | ||
|
||
# roll the indices so that it plots pretty | ||
# this is just to make the visualization nice | ||
pos[:, 0] = (pos[:, 0] + 180) % 360 - 180 | ||
idx = np.argmax(abs(np.diff(pos[:, 0]))) | ||
pos = np.roll(pos, -idx - 1, axis=0) | ||
pos = np.radians(pos) | ||
|
||
# plot the results | ||
plt.plot(*pos.T, label=frame) | ||
plt.grid() | ||
plt.tight_layout() | ||
plt.legend(bbox_to_anchor=(1.05, 1.29), framealpha=1) | ||
plt.savefig("data/background_frames.png") |