Skip to content

Commit 48c25c2

Browse files
committed
if statement for number of ones
1 parent c4dfd49 commit 48c25c2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

stingray/simulator/simulator.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,21 @@ def simple_ir(self, start=0, width=1000, intensity=1):
283283
impulse_train = np.append(h_zeros, (self.dt - (start % self.dt)) * intensity / self.dt)
284284

285285
# Define constant impulse response
286-
h_ones = (
287-
np.ones(
288-
int((width - (self.dt - (start % self.dt) + (start + width) % self.dt)) / self.dt)
286+
287+
if start % self.dt:
288+
h_ones = (
289+
np.ones(
290+
int(
291+
(width - (self.dt - (start % self.dt) + (start + width) % self.dt))
292+
/ self.dt
293+
)
294+
)
295+
* intensity
289296
)
290-
* intensity
291-
)
297+
298+
else:
299+
h_ones = np.ones(int((width - ((start + width) % self.dt)) / self.dt)) * intensity
300+
292301
impulse_train = np.append(impulse_train, h_ones)
293302

294303
# Last Bin

0 commit comments

Comments
 (0)