-
Notifications
You must be signed in to change notification settings - Fork 1
Description
To get droplets to work with the least resistance. I think we need to desparsify them into epix style images.
[from conversation with Gabriel]
Ah yeah its a bit tricky
You need to look at the droplets per shot and calculate offsets
3:15
So I think something like this pseudo-code:
row = ...
col = ...
adu = ...
offset = 0
ndrop = f["var_sparse_len"] ...
for i in len(ndrop): #Number of events
evt_row = row[offset:ndrop[i]] # droplet rows this evt
evt_col = col[offset:ndrop[i]] # droplet cols this evt
evt_adu = adu[offset:ndrop[i]] # droplet adus this evt
# ... Do whatever ...
offset += ndrop[i]
Its annoying because the alternative is to deal with ragged arrays since you will have different numbers of droplets per shot (edited)
from scipy import sparse
shape=(704,768) # can get from any full data/mask etc.
evt_img = sparse.coo_matrix(
(evt_adu, (evt_row, evt_col)), shape=shape
)