Skip to content

Commit

Permalink
TF : dreambeam, defaraday, dedisperse
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Oct 25, 2023
1 parent 885a739 commit 6b7fe5b
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 152 deletions.
2 changes: 1 addition & 1 deletion nenupy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__copyright__ = "Copyright 2023, nenupy"
__credits__ = ["Alan Loh"]
__license__ = "MIT"
__version__ = "2.4.3"
__version__ = "2.4.4"
__maintainer__ = "Alan Loh"
__email__ = "alan.loh@obspm.fr"

Expand Down
5 changes: 5 additions & 0 deletions nenupy/astro/astro_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,11 @@ def faraday_angle(frequency: u.Quantity, rotation_measure: u.Quantity, inverse:
:rtype:
:class:`~astropy.units.Quantity`
"""
# Check that the unit is correct
try:
rotation_measure = rotation_measure.to(u.rad/u.m**2)
except:
raise
wavelength = frequency.to(u.m, equivalencies=u.spectral())
angle = rotation_measure * wavelength**2
if inverse:
Expand Down
45 changes: 26 additions & 19 deletions nenupy/astro/beam_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@

try:
from dreambeam.rime.scenarios import on_pointing_axis_tracking
except ImportError:
log.error(
"DreamBeam is not installed. "
"See installation instructions https://github.com/2baOrNot2ba/dreamBeam"
)
raise

except ModuleNotFoundError:
# This will raise an error eventually with an appropriate message
pass

# ============================================================= #
# ------------------ compute_jones_matrices ------------------- #
Expand All @@ -39,18 +35,29 @@ def compute_jones_matrices(
) -> Tuple[Time, u.Quantity, JonesMatrix]:
"""
"""
log.info("Computing Jones matrices using DreamBeam...")
times, frequencies, Jn, _ = on_pointing_axis_tracking(
telescopename="NenuFAR",
stnid="NenuFAR",
band="LBA",
antmodel="Hamaker-NEC4_Charrier_v1r1",
obstimebeg=start_time.datetime,
obsdur=duration.datetime,
obstimestp=time_step.datetime,
pointingdir=(skycoord.ra.rad, skycoord.dec.rad, "J2000"),
do_parallactic_rot=parallactic
)
log.info("\tComputing Jones matrices using DreamBeam...")

if time_step.sec <= 1.:
raise ValueError("DreamBeam does not allow for time intervals lesser than 1 sec.")

try:
times, frequencies, Jn, _ = on_pointing_axis_tracking(
telescopename="NenuFAR",
stnid="NenuFAR",
band="LBA",
antmodel="Hamaker-NEC4_Charrier_v1r1",
obstimebeg=start_time.datetime,
obsdur=duration.datetime,
obstimestp=time_step.datetime,
pointingdir=(skycoord.ra.rad, skycoord.dec.rad, "J2000"),
do_parallactic_rot=parallactic
)
except NameError:
log.error(
"DreamBeam is not installed. "
"See installation instructions https://github.com/2baOrNot2ba/dreamBeam"
)
raise
# import numpy as np
# times = start_time + TimeDelta(3600, format="sec")*np.arange(12)
# frequencies = np.array([30e6, 50e6])*u.MHz
Expand Down
Loading

0 comments on commit 6b7fe5b

Please sign in to comment.