Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C/Python library to work with spherical harmonics up to almost arbitrarily high degrees

License

BSD-3-Clause, GPL-2.0 licenses found

Licenses found

BSD-3-Clause
LICENSE
GPL-2.0
COPYING
NotificationsYou must be signed in to change notification settings

blazej-bucha/charm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CHarm is a C library to work with spherical harmonics up to almost arbitrarilyhigh degrees. The library is accompanied by a Python wrapper called PyHarm.

Features

  • Supports real-valued fully-normalized surface and solid spherical harmonics(the geodetic norm).
  • Performs FFT-based surface spherical harmonic analysis and solid sphericalharmonic synthesis with minimized memory requirements.
  • Stable up to high degrees and orders (tens of thousands and beyond).
  • Available in single, double and quadruple precision.
  • Supports point and mean data values (both analysis and synthesis).
  • Supports synthesis at grids and at scattered points/cells. Grid-wisecomputations are done by FFT whenever possible. If FFT cannot be applied,the less efficient Chebyshev recurrences are used along the latitudeparallels instead.
  • Computes the full first- and second-order gradients at evaluation points(e.g., the gravitational vector and the gravitational tensor).
  • Supports the Gauss--Legendre and Driscoll--Healy quadratures.
  • Integrates solid spherical harmonic expansions (e.g., of the gravitationalpotential) on band-limited irregular surfaces (e.g., on the Earth'ssurface).[1]
  • Computes Fourier coefficients of fully-normalized associated Legendrefunctions of the first kind up to ultra-high harmonic degrees.
  • Supports SIMD parallelization on the level of a single CPU core (SSE4.1, AVX,AVX2, AVX-512 and NEON).
  • SupportsOpenMP parallelization forshared-memory architectures.
  • SupportsMPI parallelization for shared- anddistributed-memory architectures.
  • Performs discrete FFT byFFTW.
  • Ships with a Python wrapper to enable high-level programming while retainingthe efficiency of the C language. The wrapper, called PyHarm, wraps CHarmusingctypes and is fullyintegrated withnumpy.
[1]This routine is unique to CHarm.

Installation

  • PyHarm (Python wrapper): On Linux (x86_64), macOS (x86_64, ARM64) andWindows (x86_64), install PyHarm usingpip:

    pip install pyharm

    This will install PyHarm together will all the dependencies. These includea pre-compiled CHarm library, which is internally called by PyHarm, someother C libraries (FFTW and OpenMP library) and the Python package NumPy.

  • CHarm (C library): If you are interested in the C API, you have to buildCHarm from source. This step is not required if you plan to use the Pythoninterface only.

Further installation details athttps://www.charmlib.org/build/html/install.html.

Source code

GitHub:https://github.com/blazej-bucha/charm

Documentation

The documentation of the latest version from themaster branch is availableathttps://www.charmlib.org.

A pre-compiled HTML documentation is also available indocs/build/html.Alternatively, it can be built by executingmake html after theconfigure call (requires--enable-python,--enable-mpi,doxygenand Python modulessphinx,sphinx_book_theme andbreathe). Otherformats of the documentation, for instance, a PDF file, can be built withcddocs && make latexpdf, etc. To list all available formats, executecd docs&& make help.

Contact

Should you have any comments, questions, bug report or criticism, please feelfree to contact the author, Blažej Bucha, atblazej.bucha@stuba.sk. Furtherproducts developed by the author can be found athttps://www.blazejbucha.com.

Pronunciation

We prefer to pronounce CHarm and PyHarm like the wordssee harm andpieharm. But it is indeed quite charming to pronounce CHarm like the wordcharm, especially when the library works like a charm.

Other spherical-harmonic-based libraries

Many other libraries for working with spherical harmonics are available, eachhaving its pros and cons. Explore! A few examples are:

  • SHTOOLS: Fortran95 library with Python API,
  • SHTns: a C library for sphericalharmonic transforms,
  • ISPACK: a Fortran library forspherical harmonic transforms,
  • Libsharp: a C99 library forspherical harmonic transforms,
  • healpy: a Pythonpackage to handle pixelated data on the sphere building on theHEALPix C++ library,
  • HARMONIC_SYNTH: a Fortrancode for spherical harmonic synthesis written by the EGM2008 developmentteam.
  • SPHEREPACK: a Fortranlibrary of spherical harmonic transforms,
  • SHAVEL: a program for thespherical harmonic analysis of a horizontal vector field sampled in anequiangular grid on a sphere
  • ICGEM: Online calculation service forworking with Earth and celestial gravitational models,
  • FaVeST: Fast Vector SphericalHarmonic Transforms in MATLAB.
  • SHBundle:Spherical harmonic analysis and synthesis in MATLAB up to high degrees andorders,
  • Spherical Harmonics Manipulator: Spherical harmonicsynthesis in sparse points and grids (no longer maintained),
  • GrafLab andisGrafLab: MATLAB-based software packagesfor spherical harmonic synthesis of gravity field functionals up to highdegrees and orders (tens of thousands and well beyond).

[8]ページ先頭

©2009-2025 Movatter.jp