cositools / cosipy

The COSI high-level data analysis tools
Apache License 2.0
3 stars 16 forks source link

Make FullDetectorResponse.open work with pathlib.Path #97

Closed israelmcmc closed 1 month ago

israelmcmc commented 7 months ago

Currently it throws this error, because it expect a string

File ~/software/cosipy/cosipy/response/FullDetectorResponse.py:76, in FullDetectorResponse.open(cls, filename, Spectrumfile, norm, single_pixel, alpha, emin, emax)
     47 @classmethod
     48 def open(cls, filename,Spectrumfile=None,norm="Linear" ,single_pixel = False,alpha=0,emin=90,emax=10000):
     49     """
     50     Open a detector response file.
     51 
   (...)
     73     
     74     """
---> 76     if filename.endswith('.h5'):
     77         return cls._open_h5(filename)
     78     elif filename.endswith('.rsp.gz'):

AttributeError: 'PosixPath' object has no attribute 'endswith'
israelmcmc commented 1 month ago

Fixed for DC2