-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve python API, use
import edm4hep
instead of `from edm4hep imp…
…ort edm4hep` (#207)
- Loading branch information
Showing
5 changed files
with
30 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
"""Python module for the EDM4HEP datamodel and utilities.""" | ||
import sys | ||
|
||
from .datamodel import Datamodel, Utils | ||
from .__version__ import __version__ | ||
edm4hep = Datamodel() | ||
utils = Utils() | ||
import ROOT | ||
res = ROOT.gSystem.Load('libedm4hepDict.so') | ||
if res < 0: | ||
raise RuntimeError('Failed to load libedm4hepDict.so') | ||
|
||
res = ROOT.gSystem.Load('libedm4hepRDF.so') | ||
if res < 0: | ||
raise RuntimeError('Failed to load libedm4hepRDF.so') | ||
|
||
res = ROOT.gInterpreter.LoadFile('edm4hep/utils/kinematics.h') | ||
if res != 0: | ||
raise RuntimeError('Failed to load kinematics.h') | ||
|
||
res = ROOT.gInterpreter.LoadFile('edm4hep/utils/dataframe.h') | ||
if res != 0: | ||
raise RuntimeError('Failed to load dataframe.h') | ||
from ROOT import edm4hep | ||
|
||
# Make TAB completion work for utils | ||
setattr(edm4hep, 'utils', edm4hep.utils) | ||
|
||
# Make `import edm4hep` work | ||
sys.modules['edm4hep'] = edm4hep |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import ROOT | ||
from edm4hep import edm4hep | ||
import edm4hep | ||
|
||
ROOT.EnableImplicitMT() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters