Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hiding import_from preamble to a submodule? #385

Open
mmikhasenko opened this issue Nov 14, 2020 · 3 comments
Open

hiding import_from preamble to a submodule? #385

mmikhasenko opened this issue Nov 14, 2020 · 3 comments

Comments

@mmikhasenko
Copy link
Contributor

mmikhasenko commented Nov 14, 2020

In order to use Clebsch-Gordan coefficients (clebsch_gordan) and Wigner D (WignerD), I have to start my notebook with the 8 lines block.

using SymPy
import PyCall
#
PyCall.pyimport_conda("sympy.physics.quantum.spin", "sympy")
PyCall.pyimport_conda("sympy.physics.wigner",       "sympy")

import_from(sympy.physics.quantum.spin, (:WignerD,), typ=:Any)
import_from(sympy.physics.wigner)
import_from(sympy.physics.quantum.spin)

I would love to have it defined in the package and just use using SymPy.Physics or using SymPy.Spin, or something similar.
Any good suggestions?

@jverzani
Copy link
Collaborator

We have https://github.com/JuliaPy/SymPy.jl/blob/master/src/physics.jl but that is just a start. What might be best would be to make that a submodule (so it has its own namespace, as you suggest) and add more conveniences in that.

@mmikhasenko
Copy link
Contributor Author

mmikhasenko commented Nov 14, 2020

great. Accept PR?
Something in this spirit?

module Spin

using SymPy
import PyCall
#
# include("wigner_functions.jl")
PyCall.pyimport_conda("sympy.physics.quantum.spin", "sympy")
import_from(sympy.physics.quantum.spin, (:WignerD,), typ=:Any)
#
export clebsch_gordan
#
# include("clebshes.jl")
PyCall.pyimport_conda("sympy.physics.wigner",       "sympy")
import_from(sympy.physics.wigner)
#
wignerD(j,m1,m2,alpha,beta,gamma) = WignerD(j,m1,m2,alpha,beta,gamma).doit()
wignerd(j,m1,m2,theta) = WignerD(j,m1,m2,0,theta,0).doit()
#
export wignerD, wignerd

end

@jverzani
Copy link
Collaborator

jverzani commented Nov 14, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants