Fermitools-conda icon indicating copy to clipboard operation
Fermitools-conda copied to clipboard

fermitools don't seem to support pathlib.Path objects

Open physicsranger opened this issue 1 year ago • 0 comments

When attempting to use a pathlib.Path object in python, via a GtApp call or something like creating a BinnedObs object, the fermitools throw an error (see below). This isn't a major issue as converting the Path objects to strings still works.

Simple example reproducing the error:

In [1]: from BinnedAnalysis import *

In [2]: from pathlib import Path

In [3]: sm=Path('sm_TCrB.fits')

In [4]: ltc=Path('ltc_TCrB.fits')

In [5]: bdem=Path('bdem_TCrB.fits')

In [6]: obs=BinnedObs(sm,ltc,bdem)

TypeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 obs=BinnedObs(sm,ltc,bdem)

File /Software/miniconda3/envs/fermi/lib/python3.9/site-packages/fermitools/BinnedAnalysis.py:63, in BinnedObs.init(self, srcMaps, expCube, binnedExpMap, irfs, phased_expmap) 61 self.phased_expmap = phased_expmap 62 if irfs is None or irfs == 'CALDB': ---> 63 my_cuts = pyLike.Cuts(srcMaps, "", False, True, True) 64 self.irfs = my_cuts.CALDB_implied_irfs() 65 else:

File /Software/miniconda3/envs/fermi/lib/python3.9/site-packages/fermitools/pyLikelihood.py:1950, in Cuts.init(self, *args) 1943 def init(self, *args): 1944 r""" 1945 init(Cuts self) -> Cuts 1946 init(Cuts self, std::string const & eventFile, std::string const & extension, bool check_columns=True, bool skipTimeRangeCuts=False, bool skipEventClassCuts=False) -> Cuts 1947 init(Cuts self, StringVector eventFiles, std::string const & extension, bool check_columns=True, bool skipTimeRangeCuts=False, bool skipEventClassCuts=False) -> Cuts 1948 init(Cuts self, Cuts rhs) -> Cuts 1949 """ -> 1950 _pyLikelihood.Cuts_swiginit(self, _pyLikelihood.new_Cuts(*args))

TypeError: Wrong number or type of arguments for overloaded function 'new_Cuts'. Possible C/C++ prototypes are: dataSubselector::Cuts::Cuts() dataSubselector::Cuts::Cuts(std::string const &,std::string const &,bool,bool,bool) dataSubselector::Cuts::Cuts(std::string const &,std::string const &,bool,bool) dataSubselector::Cuts::Cuts(std::string const &,std::string const &,bool) dataSubselector::Cuts::Cuts(std::string const &,std::string const &) dataSubselector::Cuts::Cuts(std::vector< std::string,std::allocator< std::string > > const &,std::string const &,bool,bool,bool) dataSubselector::Cuts::Cuts(std::vector< std::string,std::allocator< std::string > > const &,std::string const &,bool,bool) dataSubselector::Cuts::Cuts(std::vector< std::string,std::allocator< std::string > > const &,std::string const &,bool) dataSubselector::Cuts::Cuts(std::vector< std::string,std::allocator< std::string > > const &,std::string const &) dataSubselector::Cuts::Cuts(dataSubselector::Cuts const &)

physicsranger avatar Jun 22 '23 20:06 physicsranger