Skip to content

Commit

Permalink
Merge pull request #17 from steven-murray/numpy2
Browse files Browse the repository at this point in the history
fix: numpy2 has different casting apparently
  • Loading branch information
tyler-a-cox authored Jul 18, 2024
2 parents d8d89cf + e09c171 commit c7116c9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions fftvis/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def simulate(
baselines: list[tuple] = None,
precision: int = 2,
polarized: bool = False,
eps: float = None,
eps: float | None = None,
beam_spline_opts: dict = None,
):
"""
Expand Down Expand Up @@ -182,6 +182,9 @@ def simulate(
if eps is None:
eps = default_accuracy_dict[precision]

freqs = freqs.astype(real_dtype)
fluxes = fluxes.astype(real_dtype)

# Get the redundant groups - TODO handle this better
if not baselines:
reds = utils.get_pos_reds(ants, include_autos=True)
Expand Down Expand Up @@ -219,6 +222,12 @@ def simulate(
else:
vis = np.zeros((ntimes, nbls, nfeeds, nfeeds, nfreqs), dtype=complex_dtype)

blx /= utils.speed_of_light
bly /= utils.speed_of_light

u = np.zeros_like(blx)
v = np.zeros_like(blx)

# Loop over time samples
for ti, eq2top in enumerate(eq2tops):
# Convert to topocentric coordinates
Expand Down Expand Up @@ -248,11 +257,8 @@ def simulate(

for fi in range(nfreqs):
# Compute uv coordinates
u, v = (
blx * freqs[fi] / utils.speed_of_light,
bly * freqs[fi] / utils.speed_of_light,
)

u[:], v[:] = blx * freqs[fi], bly * freqs[fi],

# Compute beams - only single beam is supported
A_s = np.zeros((nax, nfeeds, nsim_sources), dtype=complex_dtype)
A_s = beams._evaluate_beam(
Expand Down

0 comments on commit c7116c9

Please sign in to comment.