Skip to content

UnivariateSpline not happy #8

Description

@jcwright77

in the wham jupyter example,
running
write_eqdsk(R,Z,psi,plas_currents,"wham_eqdsk.txt","/content/WHAM_Mirror Equilib")
produces this error:


ValueError Traceback (most recent call last)
in ()
----> 1 write_eqdsk(R,Z,psi,plas_currents,"wham_eqdsk.txt","/content/WHAM_Mirror Equilib")

1 frames
/usr/local/lib/python3.6/dist-packages/scipy/interpolate/fitpack2.py in init(self, x, y, w, bbox, k, s, ext, check_finite)
180 else:
181 if not np.all(diff(x) > 0.0):
--> 182 raise ValueError("x must be strictly increasing if s = 0")
183
184 # _data == x,y,w,xb,xe,k,s,n,t,c,fp,fpint,nrdata,ier

ValueError: x must be strictly increasing if s = 0

The plot shows indeed that z is not monotonic.
The problem is lines 50/51 in write_eqdsk()

spl = UnivariateSpline(z,r,k=1,s=0)
fl_spl = UnivariateSpline(fl_dist,z,k=1)#,s=0)

Removing s=0 to use the default gets rid of the error.

scipy.version
1.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions