freegs-plasma / freegs

Free boundary Grad-Shafranov solver

Home Page:http://freegs.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`AttributeError` when writing to geqdsk using `ProfilesPprimeFfprime`

timothy-nunn opened this issue · comments

When using geqdsk.write on an equilibrium that has been created with ProfilesPprimeFfprime, the following error occurs:

Traceback (most recent call last):
  File "/Users/timothynunn/st-equilibrium-sim/scripts/example.py", line 66, in <module>
    geqdsk.write(eq, f)
  File "/Users/timothynunn/st-equilibrium-sim/.venv/lib/python3.10/site-packages/freegs/geqdsk.py", line 101, in write
    data["fpol"] = eq.fpol(psinorm)
  File "/Users/timothynunn/st-equilibrium-sim/.venv/lib/python3.10/site-packages/freegs/equilibrium.py", line 319, in fpol
    return self._profiles.fpol(psinorm)
  File "/Users/timothynunn/st-equilibrium-sim/.venv/lib/python3.10/site-packages/freegs/jtor.py", line 517, in fpol
    return super(ProfilesPprimeFfprime, self).fpol(psinorm, out)
AttributeError: 'super' object has no attribute 'fpol'

I believe a fix for this looks like https://github.com/timothy-nunn/freegs/blob/profiles_pprime_ffprime/freegs/jtor.py#L440, I am happy to raise a PR with this change if you would like.

This script demonstrates the error (I had to upload it as a .py.txt).
example.py.txt

Thanks,
Tim

Thanks @timothy-nunn, if you could raise a PR that would be lovely!