These are chat archives for SHTOOLS/SHTOOLS

3rd
Nov 2016
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 10:27
@MMesch I am going to go with 'per_dlogl'. Also, what should we use for the default base? e? or 10?
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 10:47
And here is my attempt at standardizing the powerspectrum method:
``````        Return the power spectrum of the function.

Usage
-----
power = x.powerspectrum([unit, energy, base])

Returns
-------
power : ndarray, shape (lmax+1)
1-D numpy ndarray of the power spectrum, where lmax is the maximum
spherical harmonic degree.

Parameters
----------
unit : str, optional, default = 'per_l'
If 'per_l', return the total power for each spherical harmonic
degree l. If 'per_lm', return the average contribution to the power
for each coefficient at spherical harmonic degree l. If
energy : bool, optional, default = False
Return the energy spectrum instead of the power spectrum.
base : float, optional, default = e
The logarithm base when calculating the 'per_dlogl' power spectrum.

Description
-----------
Total power is defined as the integral of the function squared over all
space, divided by the area the function spans. The total energy is the
integral of the function squared over all space and is 4pi times the
total power.

The output power spectrum can be one of three types. 'per_l' returns
the contribution to the total power from all angular orders at degree
l. 'per_lm' returns the average contribution from a single coefficient
at degree l to the total power spectrum, assuming that the power is
isotropic. The power 'per_lm' is equal to the power 'per_l' divided by
(2l+1). 'per_dlogl' returns the contribution to the total power from
all angular orders over an infinitessimal logarthmic degree band. The
power in the band dlog_a(l) is power(l, 'per_dlogl')*dlog_a(l), where a
is the base, and where power(l, 'per_dlogl) is equal to
power(l, 'per_l')*l*log(a).``````
MMesch
@MMesch
Nov 03 2016 11:10

@MMesch I am going to go with 'per_dlogl'. Also, what should we use for the default base? e? or 10?

excellent!

, assuming that the power is isotropic

I think you can remove this

the average is always the average, no matter how the coefficients are distributed
typo: 'logarthmic' should be logarithmic
MMesch
@MMesch
Nov 03 2016 11:16
Just to make things complete: should we add that the power equals the variance if the function is zero mean, i.e. for l>0?
For the default base, we should use 2 in my opinion. There are several reasons for this:
1. it is the standard in acoustics etc...
2. an octave bandwidth corresponds to the minimum bandwidth of a function that is localized on the scale of its wavelength.
This means that the energy in an octave band is what we would intuitively call the energy in local features with a certain size and it is therefore directly interpretable.
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 11:25
is this good enough?
``````        Total power is defined as the integral of the function squared over all
space, divided by the area the function spans. If the mean of the
function is zero, this is equivalent to the variance of the function.
The total energy is the integral of the function squared over all space
and is 4pi times the total power.``````
no problem with base 2 if that is what people use.
MMesch
@MMesch
Nov 03 2016 11:28
Looks good
One more thing: this is a purely spatial interpretation of power. We should somehow introduce the L2 norm of the coefficients
E.g. people would just want the L2 norm of the coefficients in whatever normalization they have chosen
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 12:05
I'm not sure if we want to put this in the powerspectrum method though, because it is not power or energy, and the value will depend on the assumed normalization. I understand why people might want to do this though...
MMesch
@MMesch
Nov 03 2016 13:10
yes, maybe a different method
I was even thinking about using a 'get_spectrum' method
that can return 'power', 'energy' or just the norm
without any restriction on the unit
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 13:25
For plot_powerspectrum, I am using base=10 as the default for the log-log plot. But for consistency, when plotting 'per_dlogl', I also have to use base 10. Does this bother you that the default for powerspectrum is base=2? It is hard for me to justify base=2 for the log-log plots....
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 15:32
OK: Here is the powerspectrum PR: SHTOOLS/SHTOOLS#65
The only thing that I would like to add is a routine that plots the "triangle" plot of the power, which is the contribution to the power for each coefficient.
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 15:40
something like that (from Goosens et al. 2011). Not really sure what to call it though. We called it a "triangle plot", but that's not very informative.
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 15:50
perhaps this could be `plot_coeffs(unit)`, where `unit` is `power`, or `abs`
Mark Wieczorek
@MarkWieczorek
Nov 03 2016 22:23
I am proposing to rename several of the class methods for consistence and clarity: SHTOOLS/SHTOOLS#66
I only want to do this once, so let's try to get this right the first time! Comments welcome