4 ms·
For people in Python-world, I've tried many units packages and tend to prefer https://pint.readthedocs.io https://pint.readthedocs.io For the bedroom example s
by heisenzombie 8y ago
For people in Python-world, I've tried many units packages and tend to prefer https://pint.readthedocs.io https://pint.readthedocs.io
For the bedroom example someone posted, here's the equivalent in pint:
import pint
# Possibly my least favorite thing about Pint is
# the verbose importing/instantiating dance
u = pint.UnitRegistry()
q = u.quantity()
# there are multiple ways of making <Quantity> objects:
volume = q('10 feet') * q(10, 'feet') * (10 * u.feet)
volume.to('gallons)
# How deep could you fill the room?
(q('2 tons') / (q('10 feet') * q('12 feet') * u.water/u.gravity)).to('feet')
Notes:
- Pint has far fewer material property entries in its database (though one can make arbitrary unit registries --- I'm wondering about an importer for the Frink ones... but https://frinklang.org/frinkdata/units.txt https://frinklang.org/frinkdata/units.txt doesn't seem to have a license?)
- That said, I'm not wild about Frink's treatment of material properties: Why is the constant `butter` a density, but `eggwhite` a mass, and `naturalgas` a specific energy?
- Pint works (mostly) nicely with numpy and can (sometimes) drop into existing code, since <Quantity> objects quack like builtin numbers.
- ModernMech 8y ago> I'm wondering about an importer for the Frink ones... but https://frinklang.org/frinkdata/units.txt https://frinklang.org/frinkdata/units.txt doesn't seem to have a license?) This is just a list of facts, no? You can't really copyright such a thing.
- sllabres 8y agoDon't know if this holds water... E.g. a cartographic map: just a "diagram" of facts? Why not ask if there is a license for this file? Edit: And as I see in this thread there is gnu-units (https://en.wikipedia.org/wiki/GNU_Units https://en.wikipedia.org/wiki/GNU_Units) probably there is something with a license.
- jchw 8y agoThe expression of facts is copyrightable, not the facts though. So importing it is water tight.
- mmanfrin 8y agoA map is not copyrightable. It is just a diagram of facts. Mapmakers protect themselves by inserting fake data which they can then use to claim copyright.
- duckerude 8y agoIt looks like it's the other way around: https://en.wikipedia.org/wiki/Trap_street#Legal_issues https://en.wikipedia.org/wiki/Trap_street#Legal_issues >In Alexandria Drafting Co. v. Andrew H. Amsterdam dba Franklin Maps, the court ruled that "fictitious names may not be copyrighted" and "the existence, or non-existence, of a road is a non-copyrightable fact". Maps are copyrightable (I think?), but the trap streets themselves aren't. They're only there to detect when someone is copying the map.
- ModernMech 8y agoHeh, I actually learned about trap streets when talking to a cartographer who made the muni map of SF you find at all the bus stops (much like this one: http://www.mobilemaplets.com/thumbnails/261_thumbnail-1024.jpg http://www.mobilemaplets.com/thumbnails/261_thumbnail-1024.j...). He told me he added a small alleyway in the map named after his family that doesn't actually exist, and they catch people violating their copyright all the time with it.
- jchw 8y agoAs far as I know, facts and information can't be copyrighted, which means at the very least the raw data in units.txt can be used freely with flagrant disregard for licensing.
- gnud 8y agoCareful! Collections (databases) of fact can often be copyrighted.
- kwhitefoot 8y agoThe artistic expression of the collection is protected not the facts themselves.
- occamrazor 8y agoDepends on the jurisdiction. In the EU databases can be copyrighted under some conditions.
- phiresky 8y ago> I'm wondering about an importer for the Frink ones... but https://frinklang.org/frinkdata/units.txt https://frinklang.org/frinkdata/units.txt doesn't seem to have a license?) That data is almost all taken from GNU Units, including the descriptions, which means it might be under the GPL. Frink itself doesn't seem to be open source at all? I wrote a parser and interpreter [1] for the GNU units descriptions a while ago, you can see the parsed json here [2] (kg! are base unit definitions, "micro_" are prefixes) [1] https://github.com/phiresky/qalc-react https://github.com/phiresky/qalc-react [2] https://github.com/phiresky/qalc-react/blob/master/data/gnu-units.json https://github.com/phiresky/qalc-react/blob/master/data/gnu-...
- dwheeler 8y agoAs far as I can tell there's no license. No thank you, I don't need a legal headache.
- duckerude 8y ago>https://frinklang.org/frinkdata/units.txt https://frinklang.org/frinkdata/units.txt I haven't even tried the software yet, but that file is a great read. An excerpt (part of a rant about the definition of the candela): // What really annoys me is that the official definitions // don't come right out and say, "okay, we're sorry, this // is obviously a useless definition for any other // wavelength, and it doesn't even make sense for *that* // wavelength. We know. It sucks. The guys at the 16th // CGPM went out and got drunk the night before instead of // working on the definition, and they all sheepishly passed // this in in the morning, and went back to bed. They got // fired later, make no doubt. It's on our list of bugs. // We're sending in the Wolf to fix it directly. // Here is the workaround, but we consider it broken // and we're ashamed to have ever put it forth in this // useless form and left it this way for 30 years. // For now, here is one single draft standard equation to use // for other wavelengths. Download it here. We promise // that the link works and contains a computer-readable // table (though we're too sloppy to actually create a good // smooth polynomial fit that would be a lot cleaner and // easier for everyone) and is not some PDF of a terrible // unreadable old re-scan, stashed away somewhere, making // you wonder if it's valid today, nor is it a ridiculous CIE // document that you have to *pay* a hundred bucks for, when // we could and absolutely need to distribute it for free.
- exikyut 8y agoWow, I completely agree that file is a great read. Also, for reference, the closing " is in the following paragraph, but I'm not quoting it because the 2 paragraphs after that one made opening the link worth my time.