Skip to content

Commit

Permalink
Merge pull request #276 from GallegoSav/develop_issueReading
Browse files Browse the repository at this point in the history
Change np.int16 to np.uint32 in the response file reading
  • Loading branch information
israelmcmc authored Jan 6, 2025
2 parents 3408ef9 + 9a364ac commit e9bf11e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cosipy/response/FullDetectorResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ def _open_rsp(cls, filename, Spectrumfile=None,norm="Linear" ,single_pixel = Fal
nlines = sum(1 for _ in gzip.open(filename,"rt"))

# Preallocate arrays
coords = np.empty([axes.ndim, nlines], dtype=np.int16)
data = np.empty(nlines, dtype=np.int16)
coords = np.empty([axes.ndim, nlines], dtype=np.uint32)
data = np.empty(nlines, dtype=np.uint32)

# Calculate the memory usage in Gigabytes
memory_size = ((nlines * data.itemsize)+(axes.ndim*nlines*coords.itemsize))/(1024*1024*1024)
Expand All @@ -329,7 +329,7 @@ def _open_rsp(cls, filename, Spectrumfile=None,norm="Linear" ,single_pixel = Fal
nlines = nbins

# Preallocate arrays
data = np.empty(nlines, dtype=np.int16)
data = np.empty(nlines, dtype=np.uint32)

# Calculate the memory usage in Gigabytes
memory_size = (nlines * data.itemsize)/(1024*1024*1024)
Expand Down Expand Up @@ -361,7 +361,7 @@ def _open_rsp(cls, filename, Spectrumfile=None,norm="Linear" ,single_pixel = Fal

if key == 'RD':

b = np.array(line[1:-1], dtype=np.int16)
b = np.array(line[1:-1], dtype=np.uint32)
c = int(line[-1])

coords[:, sbin] = b
Expand Down

0 comments on commit e9bf11e

Please sign in to comment.