Skip to content
Snippets Groups Projects
Commit 90a4f0f7 authored by Patrick Godwin's avatar Patrick Godwin
Browse files

snax/waveforms.py: avoid issues where a single waveform falls in a rate/bin combo

parent 7e32cf3f
No related branches found
No related tags found
1 merge request!41DAG Workflow Overhaul + OSG DAG support
......@@ -107,6 +107,28 @@ class TemplateGenerator(object):
self._index_by_bin[rate][freq_idx].append(idx)
self._idx_to_waveform[rate][freq_idx].append(waveform)
# if a single waveform happens to fall within a rate/bin,
# remove that waveform to avoid unnecessary splitting
# FIXME: it would be better to move the waveform to a different
# bin rather than removing it, but it's not clear how to
# do this in a way that will always guarantee the new location
# doesn't also end up falling in the same situation
redo_index = False
for freq_idx, _ in enumerate(self._index_by_bin[rate]):
if len(self._index_by_bin[rate][freq_idx]) == 1:
this_idx = self._index_by_bin[rate][freq_idx][0]
self.parameter_grid[rate].pop(this_idx)
redo_index = True
# redo the indexing if required
if redo_index:
self._index_by_bin[rate] = [[] for bin_ in range(len(self.bins))]
self._idx_to_waveform[rate] = [[] for bin_ in range(len(self.bins))]
for idx, waveform in enumerate(self.parameter_grid[rate]):
freq_idx = self.bins[waveform['frequency']]
self._index_by_bin[rate][freq_idx].append(idx)
self._idx_to_waveform[rate][freq_idx].append(waveform)
# set up mixing coefficients
for rate in self.rates:
for bin_idx in range(len(self.bins)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment