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

Bugfix issue#851 #855

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/changes/851.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `simple_ir` method in class `simulator` now takes into account phase and edge cases.
32 changes: 29 additions & 3 deletions stingray/simulator/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,38 @@ def simple_ir(self, start=0, width=1000, intensity=1):
"""

# Fill in 0 entries until the start time
h_zeros = np.zeros(int(start / self.dt))
h_zeros = np.zeros(int(np.ceil((start / self.dt))))
impulse_train = h_zeros

# First Bin
if start % self.dt:
impulse_train = np.append(h_zeros, (self.dt - (start % self.dt)) * intensity / self.dt)

# Define constant impulse response
h_ones = np.ones(int(width / self.dt)) * intensity

return np.append(h_zeros, h_ones)
if start % self.dt:
h_ones = (
np.ones(
int(
(width - (self.dt - (start % self.dt) + (start + width) % self.dt))
/ self.dt
)
)
* intensity
)

else:
h_ones = np.ones(int((width - ((start + width) % self.dt)) / self.dt)) * intensity

impulse_train = np.append(impulse_train, h_ones)

# Last Bin
if (start + width) % self.dt:
impulse_train = np.append(
impulse_train, ((start + width) % self.dt) * intensity / self.dt
)

return impulse_train

def relativistic_ir(self, t1=3, t2=4, t3=10, p1=1, p2=1.4, rise=0.6, decay=0.1):
"""
Expand Down
Loading