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.

Making the str equivalent of the dimensionless_unscaled unit more discoverable

See original GitHub issue

We’re using astropy.unit in a context where we want every value to be an astropy Quantity. We’re also serializing definitions of the things we’re measuring in YAML, so we’re making heavy use of the string representations of astropy Units. Some of these things have intrinsically dimensionless_unscaled units, so we’re seeing a lot of:

unit: ''

in our YAML files. While unit: 'mmag'Unit('mmag') is easy to understand, my colleagues have asked a lot of questions about these “empty string” units.

So I’m wondering if we can improve the UX of the string representations of dimensionless_unscaled units a bit. I have two ideas:

What does astropy think about these proposals? I’m happy to turn this into a PR if one or both of these ideas seem useful.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
tcjansencommented, May 16, 2019

@pllim - Yes, I actually had a similar confusion with the documentation recently so I’d be happy to give it a shot!

2reactions
jonathansickcommented, Feb 28, 2017

Thanks @pllim, I didn’t realized that Unit('1') also worked, not just Unit(1). It’d be worth adding that to the “documentation improvement” aspect of this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Standard Units — Astropy v5.2
units includes the concept of the dimensionless unit, used to indicate quantities that do not have a physical dimension.
Read more >
Standard units — Astropy v0.4.2
Standard units are defined in the astropy.units package as object instances. All units are defined in term of basic 'irreducible' units. The irreducible...
Read more >
Untitled
"string") { throw new Error("name isn't a string: " + name); } if (name != ... dimensionally dimensioned dimensioning dimensionless dimensions dimer dimers ......
Read more >
python - Spectrum1D does not recognize u. ...
I think you're making things more complicated for yourself than ... It is basically syntactic sugar equivalent to Quantity(array, unit) .
Read more >
arXiv:1303.6575v1 [hep-ph] 26 Mar 2013
As most sensible theories of low-energy physics arising from string compactification contain supersymmetry in four dimen-.
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