I've started following the
[uproot] tag on StackOverflow, and will follow an
[awkward-array] tag if somebody creates a question about Awkward there.
(Tags can only be created on a question about the topic. There happened to be an old question about uproot that I could add the
[uproot] tag to; if anyone asks an Awkward question and doesn't have >1500 reputation to create a new tag, point me to it and I'll add the tag—and answer the question.)
I've created a link on the uproot README pointing to uproot questions, and I'll do the same for awkward when it comes up. (https://stackoverflow.com/questions/tagged/uproot)
Just like GitHub issues, I'll get an email when somebody asks a question, but unlike GitHub issues, StackOverflow is intended for usage questions and don't "go away" once answered.
I've started following the
[uproot]tag on StackOverflow, and will follow an
[awkward-array]tag if somebody creates a question about Awkward there.
A few questions have come in on
[uproot] and one of them was actually about
[awkward-array], so I took that opportunity to create the second tag. Apparently, I can only set up email notifications after the tag has existed for a little while (some database needs to sync), so I'm listening to
[uproot] now and will be listening to
import boost_histogram as bh import uproot import zfit from particle import Particle from iminuit import Minuit from decaylanguage import DecFileParser import ROOT
Not every library needs a two-letter abbreviation. I think that
hepunits loses usefulness if its usage involves weird
u.MeV type things. I think there's an argument for
from hepunits import MeV, GeV, mm, cm 0.510 * MeV # electron mass 125.2 * GeV # Higgs mass 0.456 * mm # B0 ctau 2.685 * cm # K0 ctau
since these objects exist primarily for readability.
By the way, Awkward's official two-letter abbreviation will be
import awkward1 as ak
as in "ak! ak! this array is so awkward!". I've seen some
import awkward as awk
in the wild and I want to avoid mental overlap with Awk (which is a rather nice language for its domain, but still).
... as awkis not a good option ...
These are about recommendations. I don't think I'd recommend
import hepunits as u
which is an extra step (
as u) for the sake of having a name around that's more likely to get clobbered than
GeV. For instance, there could easily be a step in a calculation like
u, v = math.cos(theta), math.sin(theta)
that silently clobbers the
MeV = ... # ?
would not be likely at all. It's about the names humans are likely to use and notice as being different. I wouldn't recommend
from hepunits import *
though. A given script is probably only going to use a couple of units, and pulling them into the namespace deliberately is not an abuse.
active_imports()and get the list of imports you need to paste into your script. :)
It has the
from pylab import * touch, which is now, for good reasons, depreceated. For IPython, I have a startup script full of
import package as pkg with suppressed
ImporError warnings, because yeah, it's otherwise pain.
It’s only for interactive work
I see the use case, and it's nice. But I also see the abuse cases and prefer e.g. template python modules combined with an "optimize import" in my IDE that removes all unnecessary imports. No magic, just clean...
(or better, what I actually do: an editor that imports modules like
pd with a single shortcut when I use them)
For IPython, I have a startup script full of import package as pkg
This is exactly what it can and should be used for - and your start up script slows down your IPython startup time, even if you don’t use all the packages. If you copy your start up script to
~/.pyforest/user_imports.py, you will have instant startup times again, and things get imported when you use them. And you gain the ability to quickly see what you have used. I don’t use the
from pyforst import * at all, it’s just an extention to IPython. I rather which that wasn’t there, for misusage issues.