beam-tracing / Scotty

Beam tracing code for diagnostics
https://scotty.readthedocs.io/en/latest/
GNU General Public License v3.0
7 stars 4 forks source link

Inconsistent return type for EFITField #144

Open valerian-chen opened 2 months ago

valerian-chen commented 2 months ago

I've been trying to run some old simulations with the UDA_saved find_B_method. I've uncovered a nest of bugs; I think it's related to the self.B_R, self.B_T, and self.B_Z methods.

Am I correct that these methods should return floats or arrays? When UDA_saved is used, they return xarrays instead, which results in a bunch of errors downstream.

Since EFITField relies on q_R to calculate the components of B, when q_R is an xarray, the field becomes an xarray.

Should I ensure that q_R is always an ndarray, or should I always cast the components of B to ndarray?

ZedThree commented 1 month ago

They should return arrays the same length as their inputs (although note that it's fine to pass scalars, you get a length one array).

Do you have a simple example with this problem? From a quick look, it's not immediately obvious where this would be coming from