forked from cms-nanoAOD/correctionlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cms-nanoAOD/master
Rebase
- Loading branch information
Showing
19 changed files
with
848 additions
and
45 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
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 |
---|---|---|
|
@@ -140,3 +140,7 @@ cython_debug/ | |
|
||
# setuptools_scm | ||
src/*/version.py | ||
|
||
_skbuild | ||
src/correctionlib/cmake | ||
src/correctionlib/include |
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,11 @@ | ||
correctionlib.highlevel | ||
----------------------- | ||
High-level interface to correction evaluator module. These objects | ||
are also available directly through the ``correctionlib`` namespace. | ||
|
||
.. currentmodule:: correctionlib.highlevel | ||
.. autosummary:: | ||
:toctree: _generated | ||
|
||
Correction | ||
CorrectionSet |
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
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,11 +1,20 @@ | ||
from .version import version as __version__ | ||
|
||
__all__ = ("__version__",) | ||
|
||
import sys | ||
|
||
if sys.platform.startswith("win32"): | ||
import ctypes | ||
import os.path | ||
|
||
ctypes.CDLL(os.path.join(os.path.dirname(__file__), "lib", "correctionlib.dll")) | ||
import pkg_resources | ||
|
||
ctypes.CDLL( | ||
pkg_resources.resource_filename( | ||
"correctionlib", os.path.join("lib", "correctionlib.dll") | ||
) | ||
) | ||
|
||
|
||
from .binding import register_pyroot_binding | ||
from .highlevel import Correction, CorrectionSet | ||
from .version import version as __version__ | ||
|
||
__all__ = ("__version__", "CorrectionSet", "Correction", "register_pyroot_binding") |
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,26 @@ | ||
from typing import Iterator, Type, TypeVar, Union | ||
|
||
import numpy | ||
|
||
class Correction: | ||
@property | ||
def name(self) -> str: ... | ||
@property | ||
def description(self) -> str: ... | ||
@property | ||
def version(self) -> int: ... | ||
def evaluate(self, *args: Union[str, int, float]) -> float: ... | ||
def evalv(self, *args: Union[numpy.ndarray, str, int, float]) -> numpy.ndarray: ... | ||
|
||
T = TypeVar("T", bound="CorrectionSet") | ||
|
||
class CorrectionSet: | ||
@classmethod | ||
def from_file(cls: Type[T], filename: str) -> T: ... | ||
@classmethod | ||
def from_string(cls: Type[T], data: str) -> T: ... | ||
@property | ||
def schema_version(self) -> int: ... | ||
def __getitem__(self, key: str) -> Correction: ... | ||
def __len__(self) -> int: ... | ||
def __iter__(self) -> Iterator[str]: ... |
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,25 @@ | ||
def register_pyroot_binding() -> None: | ||
import os.path | ||
import sys | ||
|
||
import pkg_resources | ||
from cppyy import gbl # PyROOT without pythonization | ||
|
||
# maybe not the most robust solution? | ||
if sys.platform.startswith("win32"): | ||
lib = pkg_resources.resource_filename( | ||
"correctionlib", os.path.join("lib", "correctionlib.dll") | ||
) | ||
elif sys.platform.startswith("darwin"): | ||
lib = pkg_resources.resource_filename( | ||
"correctionlib", os.path.join("lib", "libcorrectionlib.dylib") | ||
) | ||
else: | ||
lib = pkg_resources.resource_filename( | ||
"correctionlib", os.path.join("lib", "libcorrectionlib.so") | ||
) | ||
gbl.gSystem.Load(lib) | ||
gbl.gInterpreter.AddIncludePath( | ||
pkg_resources.resource_filename("correctionlib", "include") | ||
) | ||
gbl.gROOT.ProcessLine('#include "correction.h"') |
Oops, something went wrong.