Skip to content

Commit

Permalink
allow user to choose between coordinate transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-a-cox committed Oct 8, 2024
1 parent 8457b34 commit 6ab3e29
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion fftvis/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from matvis.core.beams import prepare_beam_unpolarized
from matvis.cpu.coords import CoordinateRotationAstropy, CoordinateRotationERFA
from matvis.core.coords import CoordinateRotation
from typing import Callable, Literal

from astropy.coordinates import EarthLocation, SkyCoord
from astropy import units as un
Expand Down Expand Up @@ -51,6 +52,10 @@ def simulate_vis(
flat_array_tol: float = 0.0,
interpolation_function: str = "az_za_map_coordinates",
nprocesses: int | None = 1,
coord_method: Literal[
"CoordinateRotationAstropy", "CoordinateRotationERFA"
] = "CoordinateRotationERFA",
coord_method_params: dict | None = None,
):
"""
Parameters:
Expand Down Expand Up @@ -139,6 +144,8 @@ def simulate_vis(
flat_array_tol=flat_array_tol,
interpolation_function=interpolation_function,
nprocesses=nprocesses,
coord_method=coord_method,
coord_method_params=coord_method_params,
)


Expand All @@ -159,6 +166,10 @@ def simulate(
flat_array_tol: float = 0.0,
interpolation_function: str = "az_za_map_coordinates",
nprocesses: int | None = 1,
coord_method: Literal[
"CoordinateRotationAstropy", "CoordinateRotationERFA"
] = "CoordinateRotationERFA",
coord_method_params: dict | None = None,
):
"""
Parameters:
Expand Down Expand Up @@ -290,13 +301,17 @@ def simulate(
if nprocesses is None:
nprocesses = cpu_count()

Check warning on line 302 in fftvis/simulate.py

View check run for this annotation

Codecov / codecov/patch

fftvis/simulate.py#L302

Added line #L302 was not covered by tests

coord_mgr = CoordinateRotationERFA(
coord_method = CoordinateRotation._methods[coord_method]
coord_method_params = coord_method_params or {}
coord_mgr = coord_method(
flux=Isky,
times=Time(times, format='jd'),
telescope_loc=telescope_loc,
skycoords=SkyCoord(ra=ra * un.rad, dec=dec * un.rad, frame='icrs'),
source_buffer=1.0,
precision=precision,
**coord_method_params,
#update_bcrs_every=np.inf, # Don't update BCRS
)

nprocesses, freq_chunks, time_chunks, nf, nt = utils.get_task_chunks(nprocesses, nfreqs, ntimes)
Expand Down

0 comments on commit 6ab3e29

Please sign in to comment.