I am attempting to use ExternalEvaluate to use some python packages (ARC) to save me some effort in performing the calculations in Mathematica, and for the most part I think it works as intended. The issue is not with the specific python package, but I will keep it here for the example.
I am having an issue with calling one class function which throws an error about the positional arguments. In python the code would look just like this:
atom = arc.Rubidium87()
groundState = arc.DynamicPolarizability(atom, 5, 0, 0.5)
groundState.defineBasis(5, 25)
And it runs flawlessly.
In Mathematica I have the following:
session = StartExternalSession["Python"];
ExternalEvaluate[session, {"atom = arc.Rubidium87()","atom=arc.Rubidium87()"}]
setDynamicPolarizability[n_, l_, j_] := ExternalEvaluate[session, <|"Command" -> "gs=arc.DynamicPolarizability","Arguments" -> {"atom", n, l, j}|>]
setDynamicPolarizability[5, 0, 0.5];
setBasis[n_, nmax_] := ExternalEvaluate[session, <|"Command" -> "gs.defineBasis","Arguments" -> {n, nmax}|>]
setBasis[5, 25]
however the final line of code throws an error
I clearly have both of the required arguments for the function, and the previous things I have tried have worked perfectly fine. I have a feeling that it is due to the fact that it is a class function (docs, source) and the missing self
is the cause of the problem.
I hope the problem I'm having is clear, any tips would be greatly appreciated.