Skip to content

Add milli- prefix to Angstrom unit #11745

Closed

Description

@roytsmart

Description

Is there a particular reason that SI prefixes are disabled for the Angstrom unit?
I am working on a project that prefers to describe the dispersion of a spectrograph in milliangstroms per pixel, and not having this unit is becoming tedious.
I realize the Angstrom is not an SI unit, but I think there is an argument to be made to add at least the milli- prefix.

Activity

  1. github-actions commented on May 17, 2021

    @github-actions
    Contributor

    Welcome to Astropy 👋 and thank you for your first issue!

    A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.

    If you feel that this issue has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].

  2. embray commented on May 17, 2021

    @embray
    Member

    I do believe this is pretty non-standard, though I also see it is used in some papers, especially related to x-ray spectroscopy.

    I'd lean against allowing arbitrary SI units with Angstrom, but I'll let the experts bikeshed over that. However, in the meantime, you can define your own like:

    mAA = def_unit(['milliAngstrom', 'mAA', 'milliangstrom'], 1e-3 * u.AA,
                   format={'latex': r'm\mathring{A}', 'unicode': 'mÅ'})

    Now you can use mAA in any calculations with units, and it will work as expected. However, if you want to do reductions to units of mÅ it might take a bit more finessing.

  3. dhomeier commented on May 25, 2021

    @dhomeier
    Contributor

    I'd lean against allowing arbitrary SI units with Angstrom, but I'll let the experts bikeshed over that.

    I don't think this is arbitrary at all, in my experience it is (or historically has been) fairly standard use in any contexts with corresponding spectral resolution. Might perhaps need some justification why we allow one specific SI prefix, but no others (but certainly would not want to open this to abuse like DÅ or cÅ ;-).

  4. mhvk commented on May 25, 2021

    @mhvk
    Contributor

    I've seen it too, which I think makes enough of us to enable just the milli prefix. @byrdie - would you be willing to make a PR? Just change the angstrom definition in astropy/units/si.py to have the same prefix definition as bar in astropy/units/misc.py.

    EDIT: I guess bar is pretty good precedent too - I've never seen any other prefix than milli.

  5. added a commit that references this issue on May 26, 2021
  6. added a commit that references this issue on May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions