Skip to content

Commit c136b98

Browse files
committed
get correct beam indicies
1 parent 552cc7f commit c136b98

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/fftvis/cpu/beams.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,15 @@ def prepare_beam_evaluation(antnums, baselines, beam_idx):
9898

9999
# Get number of beams: use max index + 1 so non-contiguous indices
100100
# (e.g. [0, 2, 2]) still produce the correct set of beam pairs.
101-
nbeams = int(np.max(beam_idx)) + 1
101+
unique_beam_idx = np.unique(beam_idx)
102+
nbeams = len(unique_beam_idx)
102103

103104
# Get the unique beam pairs that we need to evaluate the apparent flux for
104-
unique_beam_pairs = [(bi, bj) for bi in range(nbeams) for bj in range(bi, nbeams)]
105+
unique_beam_pairs = [
106+
(unique_beam_idx[bi], unique_beam_idx[bj])
107+
for bi in range(nbeams)
108+
for bj in range(bi, nbeams)
109+
]
105110

106111
# Determine which baselines correspond to which beam pairs, and whether they need to be flipped
107112
antnum_to_beam_idx = {ai: bidx for ai, bidx in zip(antnums, beam_idx)}

src/fftvis/cpu/cpu_simulate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,7 @@ def simulate(
271271
required_shm += val.nbytes
272272

273273
for beam in beam_list:
274-
if isinstance(beam, UVBeam):
275-
required_shm += beam.data_array.nbytes
276-
elif isinstance(beam, BeamInterface) and getattr(beam, "_isuvbeam", False):
274+
if isinstance(beam, BeamInterface) and getattr(beam, "_isuvbeam", False):
277275
required_shm += beam.beam.data_array.nbytes
278276

279277
# Add visibility memory

0 commit comments

Comments
 (0)