-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Line 233 in b97cad2
| def copy_to_buffer( |
There are many cases where copy_to_buffer will be used, but not all of them the copy_to_buffer is necessary. It is not necessary in particular one case:
- We do not need
sourceafter "copying". - The fields of
bufferis a subset ofsource.
In this case, numpy.lib.recfunctions.drop_fields is a better choice. Because we can directly overwrite source without worrying. Using drop_fields can help us save memory usage because there will be only one copy of the array existing in memory.
from numpy.lib.recfunctions import drop_fields
An example of this case is https://github.com/XENONnT/straxen/blob/5bb4e0494d02424ffb0563f758c6ffb644dfe4d8/straxen/plugins/records/records.py#L170-L171.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request