Skip to content

Commit 9ad24f8

Browse files
authored
Fix AttributeError due to deprecated np.intint
Fixes ``` Traceback (most recent call last): File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_14_1_0_pre4/bin/el9_amd64_gcc12/pileupCalc.py", line 189, in <module> fillPileupHistogram(lumiInfo, options.calcMode, File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_14_1_0_pre4/bin/el9_amd64_gcc12/pileupCalc.py", line 87, in fillPileupHistogram obs = binning.find(AveNumInt) File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_14_1_0_pre4/bin/el9_amd64_gcc12/pileupCalc.py", line 65, in find return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(np.int) File "/cvmfs/cms.cern.ch/el9_amd64_gcc12/external/py3-numpy/1.24.3-ac08ea497df571aa0b37dc29bb7a2045/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'int'. `np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations ```
1 parent 41a4450 commit 9ad24f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

RecoLuminosity/LumiDB/scripts/pileupCalc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, num, xMin, xMax):
6262
def width(self):
6363
return (self.xMax-self.xMin)/self.num
6464
def find(self, x):
65-
return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(np.int)
65+
return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(int)
6666

6767
Sqrt2 = np.sqrt(2)
6868

0 commit comments

Comments
 (0)