question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unicode support for astropy units

See original GitHub issue

Dealing with unit strings received from somewhere, it would be nice if astropy supported common unicode symbols.

E.g.

import astropy.units as u

u.Unit('µg')  # MICRO SIGN (U+00B5)
u.Unit('μm') # GREEK SMALL LETTER MU (U+03BC)
u.Unit('m²')  # SUPERSCRIPT TWO (U+00B2)
u.Unit('m³') # SUPERSCRIPT THREE (U+00B3)
u.Unit('s⁻¹') # SUPERSCRIPT MINUS  (U+207B) + SUPERSCRIPT 1 (U+00B9) 

Probably there is more…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
maxnoecommented, Oct 9, 2019

Ok, the micro part was quite easy, see https://github.com/astropy/astropy/pull/9348

0reactions
bsipoczcommented, Oct 29, 2019

#9348 has implemented this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unicode — Astropy v5.2
Bases: astropy.units.format.console.Console. Output-only format to display pretty formatting at the console using Unicode characters. For example:.
Read more >
Unicode — Astropy v1.0.4
Bases: astropy.units.format.Console. Output-only format to display pretty formatting at the console using Unicode characters. For example:.
Read more >
Units and Quantities (astropy.units) — Astropy v1.2.dev14793
Support the units in Office of Guest Investigator Programs (OGIP) FITS files. Unicode, Output-only format to display pretty formatting at the console using ......
Read more >
Units and Quantities (astropy.units) — Astropy v3.0.dev19489
LatexInline, Output LaTeX to display the unit based on IAU style guidelines with negative powers. ; OGIP, Support the units in Office of...
Read more >
Unit formats — Astropy v0.3.dev3797
astropy.units includes support for parsing and writing the following formats: ... "unicode": Same as "console", except uses Unicode characters: >>> print u.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found