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

Orientational sites #307

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Orientational sites #307

wants to merge 6 commits into from

Conversation

SCiarella
Copy link
Contributor

This PR uses blob_dog to identify the orientations which are explored more often.

Now running plot_rectilinear(add_peaks=True) you can obtain figures like this one:
a

The calculation of the peaks has been implemented by introducing an OrientationalVolume class, inherited from Volume.


This PR may be redundant once #306 is implemented

Copy link
Contributor

@stefsmeets stefsmeets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments on this PR. I'm not entirely sure why we need to have a subclass of Volume for what is essentially peakfinding a 2D histogram. It's a lot to go through to understand what is going on, especially because in the plots, the code also goes through the OrientationalVolume. Conceptually, I think it would be easier to understand this if all the methods were self-contained on Orientations. This is mostly about rearranging bits, other than that it looks pretty good 😅

Comment on lines 447 to 451
class OrientationalVolume(Volume):
"""Container for orientational volume data, that are in spherical
coordinates."""
shape: tuple[int, int]
radii: np.ndarray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that subclassing Volume makes sense here. The other methods on Volume will not work with the data being passed for the OrientationalVolume.

Comment on lines +478 to +481
theta, phi, values = self.data.T

x = theta
y = phi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theta, phi, values = self.data.T
x = theta
y = phi
theta, phi, values = self.data.T

Comment on lines 486 to 487
peaks = [(y[int(i), int(j)], x[int(i), int(j)])
for i, j, sigma in blobs]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
peaks = [(y[int(i), int(j)], x[int(i), int(j)])
for i, j, sigma in blobs]
peaks = [(phi[int(i), int(j)], theta[int(i), int(j)])
for i, j, _ in blobs]

Comment on lines 41 to 42
ov = orientations.to_volume(shape=shape, normalize_area=normalize_histo)
theta, phi, values = ov.data.T
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this something like:

Suggested change
ov = orientations.to_volume(shape=shape, normalize_area=normalize_histo)
theta, phi, values = ov.data.T
theta, phi, values = orientations.histogram(normalize=True)

The histogram can be re-used to get the peaks.

self.shape = shape
self.radii = radii

def orientational_peaks(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have find_peaks on Volume, this extra method could be a bit confusing. If going down this route, have you considered overwriting the original method?

Suggested change
def orientational_peaks(
def find_peaks(

Comment on lines +450 to +451
shape: tuple[int, int]
radii: np.ndarray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Radii and shape are not used, I'd recommend removing them from this class.

Suggested change
shape: tuple[int, int]
radii: np.ndarray

@stefsmeets
Copy link
Contributor

I fixed all the merge conflicts with main in this PR

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

Successfully merging this pull request may close these issues.

2 participants