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

Make sure that time > 0 #182

Open
mhliu0001 opened this issue Mar 28, 2024 · 2 comments
Open

Make sure that time > 0 #182

mhliu0001 opened this issue Mar 28, 2024 · 2 comments

Comments

@mhliu0001
Copy link
Contributor

In the current fuse framework, the time of the event is determined either from a csv file, or from source_rate. In the latter case, the time is determined by:

event_times = self.rng.uniform(
    low=start / self.event_rate, high=stop / self.event_rate, size=stop - start
).astype(np.int64)

This time is normally larger than 0. However, if the time is very close to 0 (it might happen), fuse will create a chunk with a start time smaller than 0 because the first_chunk_left(1e6) is subtracted from the event time.

This is potentially dangerous because people always assume time>0 when coding. I don't know whether this will create any real problems, but we should avoid this kind of situation that is very hard to debug. An easy solution is to add a constant shift to all times of the event simulated; maybe the user can configure it.

@mhliu0001
Copy link
Contributor Author

Another motivation is for my sprinkling PR (#181). I need to include waveforms that extend ~0.01s to the left of the simulated events.

@HenningSE
Copy link
Collaborator

Hi @mhliu0001, thanks for bringing this up. We should fix this problem! I think we have to touch the event timing when making fuse ready for mc_chain use as there we want to combine multiple simulation runs into a single run. This can only work if the runs cover different times so we would need something like a time offset that can be set by the user. Maybe we can do this in one go then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants