-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make
CreateDataFrame
accessible from python (#674)
* fix CreateDataFrame visibility in python * use load dict to read datasource lib in python * fix pylint warnings
- Loading branch information
Showing
5 changed files
with
36 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Python module for creating ROOT RDataFrame with files containing podio Frames""" | ||
|
||
from ROOT import gSystem | ||
|
||
if gSystem.Load("libpodioDataSourceDict") < 0: | ||
raise ImportError("Error when loading libpodioDataSourceDict") | ||
|
||
from ROOT import podio # pylint: disable=wrong-import-position | ||
|
||
CreateDataFrame = podio.CreateDataFrame |
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,5 +1,6 @@ | ||
<lcgdict> | ||
<selection> | ||
<class name="podio::DataSource"/> | ||
<function name="podio::CreateDataFrame"/> | ||
</selection> | ||
</lcgdict> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3 | ||
"""Small test case for checking DataSource based creating RDataFrames is accessible from python""" | ||
|
||
import ROOT | ||
from podio.data_source import CreateDataFrame # pylint: disable=import-error, no-name-in-module | ||
|
||
if ROOT.gSystem.Load("libTestDataModelDict") < 0: | ||
raise RuntimeError("Could not load TestDataModel dictionary") | ||
|
||
rdf = CreateDataFrame("example_frame.root") | ||
|
||
assert rdf.Count().GetValue() == 10 |