Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change np.int16 to np.uint32 in the response file reading #276

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 320 in cosipy/response/FullDetectorResponse.py

View check run for this annotation

Codecov / codecov/patch

cosipy/response/FullDetectorResponse.py#L319-L320

Added lines #L319 - L320 were not covered by tests

# 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 @@
nlines = nbins

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

Check warning on line 332 in cosipy/response/FullDetectorResponse.py

View check run for this annotation

Codecov / codecov/patch

cosipy/response/FullDetectorResponse.py#L332

Added line #L332 was not covered by tests

# Calculate the memory usage in Gigabytes
memory_size = (nlines * data.itemsize)/(1024*1024*1024)
Expand Down Expand Up @@ -361,7 +361,7 @@

if key == 'RD':

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

Check warning on line 364 in cosipy/response/FullDetectorResponse.py

View check run for this annotation

Codecov / codecov/patch

cosipy/response/FullDetectorResponse.py#L364

Added line #L364 was not covered by tests
c = int(line[-1])

coords[:, sbin] = b
Expand Down
Loading