Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
MetinSa committed Apr 28, 2024
1 parent b85fa59 commit 805f0ab
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions docs/examples/get_emission_ang.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
from multiprocessing import cpu_count

import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from astropy.coordinates import BarycentricMeanEcliptic, SkyCoord
from astropy.time import Time

from zodipy import Zodipy

model = Zodipy("dirbe", n_proc=cpu_count())
model = Zodipy()

# Longitude and Latitude values corresponding to a scan through the eclitpic plane
lats = np.linspace(-90, 90, 100) * u.deg
lons = np.zeros_like(lats)

latitudes = np.linspace(-90, 90, 10000) * u.deg
longitudes = np.zeros_like(latitudes)
obs_time = Time("2022-06-14")

emission = model.get_emission_ang(
theta=longitudes,
phi=latitudes,
freq=30 * u.micron,
lonlat=True,
obs_time=Time("2022-06-14"),
obs_pos="earth",
# The SkyCoord object needs to include the coordinate frame and time of observation
coords = SkyCoord(
lons,
lats,
frame=BarycentricMeanEcliptic,
obstime=obs_time,
)

emission = model.get_emission_skycoord(coords, freq=30 * u.micron)

plt.plot(latitudes, emission)
plt.plot(lats, emission)
plt.xlabel("Latitude [deg]")
plt.ylabel("Emission [MJy/sr]")
plt.show()

0 comments on commit 805f0ab

Please sign in to comment.