Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions anisoap/representations/ellipsoidal_density_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,12 @@ def transform(
return features

def power_spectrum(
self, frames, mean_over_samples=True, show_progress=False, rust_moments=True
self,
frames,
mean_over_samples=True,
show_progress=False,
rust_moments=True,
return_tensormap=False,
):
"""Helper function to compute the power spectrum of AniSOAP

Expand Down Expand Up @@ -711,6 +716,10 @@ def power_spectrum(

"""

# if mean over samples == return tmap then error out - return tmap can only be true when mean-over-samples is false.
assert not (
mean_over_samples and return_tensormap
), "cannot set return_tensormap to true if mean_over_samples is true"
# Initialize the Clebsch Gordan calculator for the angular component.
mycg = ClebschGordanReal(self.max_angular)

Expand All @@ -725,7 +734,6 @@ def power_spectrum(
"positions",
"numbers",
]

# Checks if the sample contains all necessary information for computation of power spectrum
for index, frame in enumerate(frames):
array = frame.arrays
Expand Down Expand Up @@ -760,5 +768,7 @@ def power_spectrum(
[block.values.squeeze() for block in x_asoap_raw.blocks()]
)
return x_asoap_raw
else:
elif return_tensormap:
return mvg_nu2
else:
return mvg_nu2.block().values.squeeze()
Loading