-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add LGDO format conversion utilities #30
Add LGDO format conversion utilities #30
Conversation
…utilities The idea is to add a `convert` function to each LGDO datatype that converts the underlying data to a third-party datatype. These are `pandas.DataFrame`, `numpy.ndarray` and `awkward.Array`. Additionally, you have the option to control whether `convert` copies data or not. At the moment, these issues are still open: [ ] How to use `to_aoesa` to convert VectorOfVectors to `numpy.ndarray`? [ ] How to implement the conversion of structures/tables to `numpy.ndarray`? [ ] How to implement the `convert' function for WaveformTable and encoded data? [ ] Find out how to implement units with pint. Is it possible for awkward arrays? [ ] Write many, many tests.
…berger/legend-pydataobj into issue_4_lgdo_format_conversion
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
==========================================
+ Coverage 74.87% 75.49% +0.61%
==========================================
Files 27 28 +1
Lines 2209 2379 +170
==========================================
+ Hits 1654 1796 +142
- Misses 555 583 +28 ☔ View full report in Codecov by Sentry. |
Results of some discussion
Units: So far, Copy: We will remove the option for the user to control whether to copy or not. By default, as good as possible, the zero-copy option will be preferred, and it will be up to the user to copy the data if necessary. Of a zero-copy option is not available for a certain data type, it will be indicated in the docstring. |
…to convert it with or without units.
…berger/legend-pydataobj into issue_4_lgdo_format_conversion
…berger/legend-pydataobj into issue_4_lgdo_format_conversion
Need tests for AoESA
@MoritzNeuberger we forgot about units in Struct and derived... |
Nevermind, I did not look carefully... |
…berger/legend-pydataobj into issue_4_lgdo_format_conversion
…n giving None as missing_value
This is my opinion more transparent.
Also missing: mention to |
I need to start using this around. I will merge and tag an alpha release |
The idea is to add a
convert
function to each LGDO datatype that converts the underlying data to a third-party datatype. These arepandas.DataFrame
,numpy.ndarray
andawkward.Array
. Additionally, you have the option to control whetherconvert
copies data or not.This version is not feature-complete. These issues are still open:
to_aoesa
to convert VectorOfVectors tonumpy.ndarray
?--> in the future, use awkward arrays for pandas conversion,
numpy.ndarray
?--> solved it by not implementing it and throwing a
TypeError
convert
function for WaveformTable and encoded data?--> just inherits from Tabel which has a generic function looping over columns, converting them and merging them.
--> partially possible, not awkward implementations and implementations relying on awkward such as some pandas conversions