Conversation
| container[c.name]['data'] = self.source.data.copy(deep=False) | ||
| t = birth_time + (c.distance / speed).to(unit=birth_time.unit, copy=False) | ||
| container[c.name]['data'].coords['toa'] = t | ||
| container[c.name]['data'].coords['eto'] = t % ( |
There was a problem hiding this comment.
I guess in principle, since the user is free to define their own time distribution for a pulse, t could be negative?
It is also possible to edit the data in the source before running the model.
E.g.
source = tof.Source(facility='ESS', neutrons=1_000_000)
source.data.coords['birth_time'] -= sc.scalar(1000, unit='us')makes a source that starts at -1000 us instead of 0.
Should the eto then be (t - birth_time.min()) % period?
How do we solve the potential case where, if we have low statistics, the first pulse may not have any neutrons at the very start (because of sampling), but the second pulse does. This would attribute the early neutrons in the second pulse to the wrong period?
There was a problem hiding this comment.
Not sure, but my point was that mod will give a negative result in those cases, which is not what you want, right?
There was a problem hiding this comment.
Not sure I follow the negative result part... -3 % 10 gives 7.
The period will always be positive.
There was a problem hiding this comment.
Right, I was mixing things up!
Co-authored-by: Simon Heybrock <12912489+SimonHeybrock@users.noreply.github.com>
Co-authored-by: Simon Heybrock <12912489+SimonHeybrock@users.noreply.github.com>
Can now to
results['detector'].eto.plot()to plot theevent_time_offsetof the neutrons at the component.event_time_offsetis just defined by time-of-arrival modulo source period.Based on #96