-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add ROIFilter #173
base: main
Are you sure you want to change the base?
Add ROIFilter #173
Conversation
counts = data.bins.size().to(dtype='int32', copy=False) | ||
counts.unit = 'counts' | ||
self._add_counts(counts) | ||
|
||
def add_counts(self, data: Sequence[int]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not be used by Beamlime anymore, keeping it for backwards compatibility.
size = _noise_size | ||
position = sc.empty(sizes={'position': size}, unit='m', dtype=sc.DType.vector3) | ||
position.values = np.random.default_rng().normal(0, sigma.value, size=(size, 3)) | ||
position.values = np.random.default_rng(seed=1234).normal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to turn the centers of the pixel positions into small gaussian clouds of points?
I was thinking maybe it should be random.uniform
instead to avoid spill-over from one pixel over to the next?
But maybe using a normal distribution is better as it makes the clouds spherical, and they then look the same from any line-of-sight? Using uniform also suggests that the pixels are square in shape, but this is not really true for tubes...
Is the sigma approximately equal to half the width of the pixel?
indices will be returned concatenated into a dense array. | ||
""" | ||
out_dim = 'index' | ||
for dim, (low, high) in intervals.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, we may be hooking this up to a graphical interface where a user will draw a rectangle by hand.
In some plotting libraries (e.g. MPL), when you request the bounds of a rectangle, the order of the bounds depends on how the user drew the rectangle.
If they started from the left and dragged towards the right, you get [left, right]
as the bounds.
They they started from the right, you get [right, left]
instead.
The same goes fro top/bottom.
We could end up in a situation where some of the tuples contain 2 values but the second one is lower than the first. The slicing below would then select nothing.
I recommend we add something like low, high = sorted(low, high)
to make sure that does not happen further down the line.
This will be used by Beamlime to make time-of-arrival histograms of counts within an ROI. Currently this only supports axis-aligned rectangle selections.