sunpy / sunkit-magex

A package for magnetic field extrapolation.
https://docs.sunpy.org/projects/sunkit-magex/
4 stars 2 forks source link

Automatically pick working/best Tracer #37

Open jgieseler opened 2 months ago

jgieseler commented 2 months ago

Describe the feature

Currently, the user has to manually define the tracer to use with, e.g., tracer = pfss.tracing.FortranTracer(), where FortranTracer requires the (optional) streamtracer package; the built-in alternative is PythonTracer. I'd suggest to add a general function pfss.tracing.Tracer() that tries to load the more performant tracer (Fortran/rust), and if it fails, falls back to the Python one (maybe giving a warning/info).

This would be obsolete if streamtracer were a non-optional a dependency.

Proposed solution

No response

Cadair commented 1 month ago

What do you and @STBadman think about making streamtracer a required dependency and removing the built-in python tracer?

STBadman commented 1 month ago

Will users need to install rust themselves (or fortran as of right now) or is it taken care of by installing streamtracer? I'm just wondering if there's a possibility a user could end up with sunkit-magex and streamtracer installed but it not working due to not having the low level language set up and in that case having the python tracer as a fallback still being useful.

Cadair commented 1 month ago

We will provide binaries for the most common platforms both on pypi and conda. So unless you are a) trying to install on a too new or too old python (i.e. one where we haven't built for) or b) are running on a very odd architecture you shouldn't need a functioning rust toolchain.

STBadman commented 1 month ago

ok got it, then i think ok for me for streamtracer to be required here and the python version to be removed. It will live on in the pfsspy archive in any case - it is neat to see the algorithm written out in pure python

jgieseler commented 1 month ago

Yes, I think it's appropriate to have streamtracer as a requirement. Solves some problems/inconsistencies. And so far no one opposed the idea.