Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: numpy2 has different casting apparently #17

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading