GithubHelp home page GithubHelp logo

hofmannmartin / sphericalharmonicexpansions.jl Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 4.0 148 KB

A Julia package to handle spherical harmonic functions

License: Other

Julia 100.00%
julia spherical-harmonics polynomials

sphericalharmonicexpansions.jl's People

Contributors

github-actions[bot] avatar hofmannmartin avatar jagho avatar mboberg avatar tknopp avatar torb3n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sphericalharmonicexpansions.jl's Issues

Unknown package

julia> Pkg.add("SphericalHarmonics")

ERROR: unknown package SphericalHarmonics
macro expansion at .\pkg\entry.jl:53 [inlined]
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at .\task.jl:335
Stacktrace:
 [1] sync_end() at .\task.jl:287
 [2] macro expansion at .\task.jl:303 [inlined]
 [3] add(::String, ::Base.Pkg.Types.VersionSet) at .\pkg\entry.jl:51
 [4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at .\pkg\dir.jl:36
 [5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at .\file.jl:59
 [6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at .\pkg\dir.jl:36
 [7] add(::String) at .\pkg\pkg.jl:117

Earth spherical harmonics

Is it possible to calculate the acceleration due to the Earth spherical harmonics (J2,J22,..)?

As I know, the acceleration is the derivative from the Earth gravity potential.

Rational result

I noticed that the Polyvar expression of Spherical Harmonics generated from rlylm uses float numbers as coefficients.
Is there possible to add support for using rational number as expression coeffient to get accurate symbolic result?

3//5  # Rational
0.6   # Float64

@fastfunc does only work in top level scope

Describe the bug
The @fastfunc macro can not be used inside the scope of a function.

The environment (please complete the following information):

  • julia version 1.5
  • OS ubuntu
  • package version 0.0.0

To Reproduce
Steps to reproduce the behavior:

function useFastFuncInsideFunction()
	polynomial = 3*z^2 + 2*y*x
	g = @fastfunc polynomial
	
	t1,t2,t3 = randn(3)
	return g(t1,t2,t3)
end
useFastFuncInsideFunction()

throws Error

  Expression: g(t1, t2, t3)
  MethodError: no method matching (::SphericalHarmonics.var"#34#35")(::Float64, ::Float64, ::Float64)
  The applicable method may be too new: running in world age 27832, while current world is 27833.
  Closest candidates are:
    #34(::Any, ::Any, ::Any) at none:1 (method too new to be called from this world context.)
  Stacktrace:
   [1] (::var"#useInsideFunction1#4"{Float64,var"#f#3",Variable{:x},Variable{:y},Variable{:z}})() at /home/moeddel/.julia/dev/SphericalHarmonics/test/fastfunc.jl:14
   [2] top-level scope at /home/moeddel/.julia/dev/SphericalHarmonics/test/fastfunc.jl:17
   [3] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1115
   [4] top-level scope at /home/moeddel/.julia/dev/SphericalHarmonics/test/fastfunc.jl:2

Expected behavior
The method should work within function scope.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Avoid the change of # of args after @fastfunc

Thank you for developing such a useful library.

Currently, I am using @fastfunc to calculate spherical harmonics.

Current

  • If you call ylm(0, 0, x, y, z) and pass it to @fastfunc, it is converted to a function whose args are (::Any) like below.
    Screen Shot 2020-10-15 at 16 44 59
  • On the other hand, if you call ylm(2,1, x, y, z) and do the same, it will be a function whose args are (::Any, ::Any, ::Any).
    Screen Shot 2020-10-15 at 16 48 19

Expected

However, I believe that in both cases it would be better to be able to call functions with the same # of args,
say, pp(1.0, 1.0, 1.0).

What do you think about this?
Thanks.

Refactoring package

Hi Martin,

I have worked with a previous version of your package and extended it a bit (different norms possible, arbitrary datatypes) during my PhD thesis. It's now in a separate repository: CartesianSphericalHarmonics.jl, as I had no need for the expansion and evaluation of the polynomials. It's not documented nor tested properly. I'd be happy to make this eventually merge with your package or to make the two packages built on each other, any thoughts on this?

Cheers,
Felix

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.