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 UDFMeta.coordinates available in get_results #1609

Open
sivborg opened this issue Mar 8, 2024 · 0 comments
Open

Make UDFMeta.coordinates available in get_results #1609

sivborg opened this issue Mar 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sivborg
Copy link

sivborg commented Mar 8, 2024

Hello, one useful feature that's missing is access to the _slice in the get_results member function in UDFMeta.
One use case I am currently working with is using the coordinates there in order to calculate regression at their positions:

File ~\Prog\LiberTEM\LiberTEM\src\libertem\udf\raw.py:104, in PickCorrectedUDF.get_results(self)
    103 def get_results(self):
--> 104     coords = self.meta.coordinates
    106     coords = np.concatenate((np.ones((*coords.shape[:-1], 1)), coords), axis = -1)
    107     shifts = np.dot( self.regression_coefficients, coords) + 128 # In pixel space

File ~\Prog\LiberTEM\LiberTEM\src\libertem\udf\base.py:502, in UDFMeta.coordinates(self)
    494 @property
    495 def coordinates(self) -> np.ndarray:
    496     """
    497     np.ndarray : Array of coordinates that correspond to the frames in the actual
    498     navigation space which are part of the current tile or partition.
    499 
    500     .. versionadded:: 0.6.0
    501     """
--> 502     assert self._slice is not None
    503     assert self._partition_slice is not None
    504     if self._cached_coordinates is None:

AssertionError:
@sk1p sk1p added the bug Something isn't working label Mar 8, 2024
@sk1p sk1p changed the title _slice available in get_results Make UDFMeta.coordinates available in get_results Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants