GithubHelp home page GithubHelp logo

Comments (2)

nden avatar nden commented on September 27, 2024

@eteq I am using frame.representation_component_names to get the default names of the frame axes but this includes also distance. What is the correct way to get the default axes names in a frame?

Also gwcs.CelestialFrame.naxes is hardcoded as 2. This isn't always correct (e.g. Galactocentric ). Is there a way to get the number of axes in an instance of one of the builtin_frames?

from gwcs.

eteq avatar eteq commented on September 27, 2024

@nden - if what you want is the names specifically for the default representation (as opposed to the current one for a particular object, which can change at runtime), then this is probably the way to go:

>>> g = coordinates.Galactic()
>>> g.default_representation
astropy.coordinates.representation.SphericalRepresentation
>>> g.representation_info[g.default_representation]
{u'names': (u'l', u'b', u'distance'),
 u'units': (Unit("deg"), Unit("deg"), None)}
>>> g.representation_info[g.default_representation]['names']
(u'l', u'b', u'distance')

Internally, that's basically what representation_component_names does, but it gives you the names for the current representation, which is not necessarily always the default. (But maybe that's actually what you want?)

@nden @mdboom - As for CelestialFrame.naxes, I would think it should be hardcoded to 3. All coordinate frame objects by design are 3-dimensional: they use the representation heirarchy, and currently those are all 3D. UnitSphericalRepresentation is a bit subtle in that it seems to be 2D, but in fact it's interpreted as points on the unit sphere. So you can do this:

>>> s = UnitSphericalRepresentation(10*u.deg, 42*u.deg)
>>> s.to_cartesian()
<CartesianRepresentation (x, y, z) [dimensionless]
    (0.73185479, 0.12904574, 0.66913061)>

And you can see that it's actually 3D.

from gwcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.