Giter VIP home page Giter VIP logo

Comments (8)

MarkWieczorek avatar MarkWieczorek commented on September 25, 2024

Unfortunately, you will need to reorder to the coefficients to be in the [2, L_max+1, L_max+1 format. I understand that this is not an efficient storage scheme, but it would be nontrivial to modify all the code to accept a different format.

What we could do is the following:

  1. Create some kind of helper function that reorders the coeffiecients to the expected format. We could put it in the utils subpackage.
  2. Add some kind of flag to the from_array method allowing the user to specify the format of the array and then convert internally.

I won't have time to work on this for the next couple of months, so if this is something that interests, please put in a PR!

from shtools.

qzhu2017 avatar qzhu2017 commented on September 25, 2024

@MarkWieczorek
Thanks for you prompt reply. I am happy to create some helper function to transform the data format.
However, I am not sure how to do such reorder. If we follow the eq(1), there should be only (l_max+1)**2 complex numbers. Can you instruct how to convert them to 2(l_max+1)^2 numbers and then [2, L_max+1, L_max+1] array?

from shtools.

MarkWieczorek avatar MarkWieczorek commented on September 25, 2024

The coeffs array is formatted as [i, l, m] where i=0 is for positive m and i=1 is for negative m. I'll try to add this into the docstrings to make it more obvious.

from shtools.

qzhu2017 avatar qzhu2017 commented on September 25, 2024

sorry, I am still confused. If I have 4 coefficients when l_max = 1.
$f_0^0, f_1^{-1}, f_1^{0}, f_1^{1}$,

How shall I arrange them into a [2, 2, 2] array?

from shtools.

MarkWieczorek avatar MarkWieczorek commented on September 25, 2024

$\mbox{coeffs}[0, 0, 0] = f_0^0 $
$\mbox{coeffs}[0, 1, 0] = f_1^0 $
$\mbox{coeffs}[0, 1, 1] = f_1^1 $
$\mbox{coeffs}[1, 1, 1] = f_1^{-1} $

from shtools.

qzhu2017 avatar qzhu2017 commented on September 25, 2024

How about the rest elements in the array, e.g. coeffs[1, 0, 0]? Shall we just set them as zero or any number?

from shtools.

MarkWieczorek avatar MarkWieczorek commented on September 25, 2024

Just set them to zero (or any other value you want, it really doesn't matter as these spherical harmonics don't exist...).

from shtools.

MarkWieczorek avatar MarkWieczorek commented on September 25, 2024

I have added additional documentation to the SHCoeffs, SHGravCoeffs and SHMagCoeffs classes as to how the array coeffs is formatted. Hopefully this helps. If you still have questions, feel free to open this issue. (The PR should be merged into develop by the end of the day).

from shtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.