Comments (3)
Thanks for the detailed thoughts, @neutrinoceros ! And searching back through issues and PRs, I see now that there's been a lot of related discussion and attempts circling around this problem (should have searched a bit more before posting my question...). In any case, it does seem like a bigger refactor is needed... I do have more thoughts on this, will try to come back later today or tomorrow to type them up!
from yt.
Related to #4362
This has been a problem for as long as spherical coordinates have been supported. To me, the issue is primarily that the API, which was originally designed for cartesian coordinates only, is ill suited for non-cartesian geometries; in particular, specifying a {center, width} combo is ambiguous in spherical geometries: does it result in a spherical selection (possibly off-center), or does it really just select a slab in the data cube1 ? what coordinates is center
in ? native, or cartesian2 ? is the width akin to a radius, a diameter, an azimuth, a latitude ? Combined with the fact that angular coordinates are, under the hood, represented as length dimensions, none of these questions have obvious answers to me.
So far, my approach has been very conservative, but I think we can't really beat this problem without a broader redesign of non-cartesian coordinates.
I think we'd need a couple fundamental changes:
- stop representing all coordinates as lengths. This means in particular that coord triplets returned by, e.g.,
ds.find_max
, need to be tuples of scalarunyt_quantity
3 instead of a singleunyt_quantity
(which cannot have more than 1 dimensionality) NormalPlot
API:- elect a coordinate system (Cartesian or data-native) that the
center
. I don't think it matters much what we choose to support as long as it's explicit. I do have a slight preference for choosing data-native because it's a bit easier to convert to cartesian than the other way around, which might avoid some foot guns to users. - forbid passing a scalar
width
for non-cartesian geometries3: only triplets should be accepted (or pairs in 2D) - clarify, in docs, that
center
+width
always selects a slab in data-native coordinates
- elect a coordinate system (Cartesian or data-native) that the
Footnotes
-
currently, the latter is true ↩
-
the current default, (0,0,0), is ambiguous but degenerate, which is why it "works" by default, but user-provided value are ignored. Also note that this ambiguity+degeneracy is intrinsic in cartesian coordinates, which is why it was never a problem there. ↩
-
That would be a major breaking API change. So, time for yt 5.0 ?? ↩ ↩2
from yt.
I wanted to mention two things -- the first is that I think we could absolutely explore a new method of designing these slices and whatnot.
The second is that we should explore how we could revive the "IndexArray" type that @jzuhone worked on a few years ago in unyt. This would be a big change, and we may decide it's too much. But the idea there is twofold -- one is to make all of the arrays used for indexing read-only -- which could be a huge performance increase in some areas of the code that constantly do conversions or checks that arrays are in code-length
. But the other part is to make some types of arrays non-broadcastable along all dimensions, and allow for non-homogeneous units. (Making this a general purpose solution in unyt would likely be a lot harder than making it work in yt, to be clear. So it's also possible that we could implement it in yt for that one specific use case.)
from yt.
Related Issues (20)
- How to change the particle size in function "ParticlePhasePlot" HOT 2
- BUG: Multiple fields break sanitization HOT 2
- BUG: segault on manylinux2014 image HOT 5
- Deprecation warning in GDF (and maybe more?) HOT 3
- Try to project gas particles (SPH) to a mesh with octree structure HOT 2
- ImportError when compiling with gcc 14.1.1 and conda HOT 6
- DOC: docs builds are failing HOT 7
- Incorrect parameter sanitation to np.logspace HOT 2
- CPython 3.13 support (tracker issue)
- Question: How the weight field operates to an yt.create_profile average? HOT 6
- BUG: segfault on macOS (amr64) HOT 11
- Nose testing image comparison: label which image is which? HOT 3
- Editable Installations may be broken in conda environment HOT 7
- BUG: Segfault in smoothing length calculation on Mac HOT 9
- Tipsy Frontend BUG?: oddities with smoothing lengths/positions and bounding box HOT 8
- failing enzo answer tests HOT 6
- CI: test_geo_projection failing on main
- BLD/TST: building fails on `windows-latest` HOT 3
- BLD: can we remove dev-only extra targets ? HOT 3
- DEP: can we drop support for Python 3.9 now ? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yt.