Skip to content

Commit

Permalink
perf(BeamForm): 2x speed up to beamforming code
Browse files Browse the repository at this point in the history
  • Loading branch information
jrs65 committed Oct 16, 2020
1 parent abdb5fd commit 8945ee4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions draco/analysis/beamform.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,15 @@ def process(self):
f_local_indices = np.arange(self.ls, dtype=np.int32)
f_mask = np.zeros(self.ls, dtype=bool)

fbb = formed_beam.beam[:]
fbw = formed_beam.weight[:]

# For each source, beamform and populate container.
for src in range(self.nsource):

if src % 1000 == 0:
self.log.debug(f"Source {src}/{self.nsource}")

# Declination of this source
dec = np.radians(self.sdec[src])

Expand All @@ -167,10 +173,10 @@ def process(self):
# in this rank. I am getting a NaN error, however.
# I may need an mpiutil.barrier() call before the
# return statement.
# if f_mask.all():
# # If there are no indices to be processed in
# #the local frequency range, skip source.
# continue
if f_mask.all():
# If there are no indices to be processed in
# the local frequency range, skip source.
continue

# Frequency indices to process in local range
f_local_indices = np.arange(self.ls, dtype=np.int32)[np.invert(f_mask)]
Expand Down Expand Up @@ -312,8 +318,8 @@ def process(self):
pass

# Populate container.
formed_beam.beam[src] = formed_beam_full
formed_beam.weight[src] = weight_full
fbb[src] = formed_beam_full
fbw[src] = weight_full
if not self.collapse_ha:
if self.is_sstream:
formed_beam.ha[src, :] = ha_array
Expand Down

0 comments on commit 8945ee4

Please sign in to comment.