-
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
Refactor of LH5 I/O routines, deprecation of existing methods #24
Refactor of LH5 I/O routines, deprecation of existing methods #24
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
- Coverage 75.49% 74.87% -0.62%
==========================================
Files 22 27 +5
Lines 2126 2209 +83
==========================================
+ Hits 1605 1654 +49
- Misses 521 555 +34 ☔ View full report in Codecov by Sentry. |
lh5_store.py
refactor (2nd attempt)
Should I wait until this PR is reviewed before making the PR in the other repositories? |
First of all: thanks a lot @MoritzNeuberger for taking care of this!
I would say so, yes.
It's perfectly ok, in my opinion, since the scope is made clear by the subpackage name: Should we also:
Yes, let's try to get this merged first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For discussion: do we really want to drop the LH5
prefix in LH5Store
and LH5Iterator
? I like the lh5.Store
and lh5.Iterator
syntax more, but I wonder if the LH5
prefix could still be useful, if the names are individually imported.
Moritz: have you checked if there is any broken Sphinx reference left in files not affected by this PR? I guess it would be useful to turn on the Sphinx option to error/warn if cross-references are broken.
src/lgdo/lh5/iterator.py
Outdated
LGDO = Union[Array, Scalar, Struct, VectorOfVectors] | ||
|
||
|
||
class LH5Iterator(Iterator): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be renamed to Iterator
in my opinion.
docs/source/notebooks/LH5Files.ipynb
Outdated
@@ -101,7 +101,7 @@ | |||
"id": "ef09f43c", | |||
"metadata": {}, | |||
"source": [ | |||
"The group contains several LGDOs. Let's read them in memory. We start by initializing an `LH5Store` [[docs]](https://legend-pydataobj.readthedocs.io/en/stable/api/lgdo.html#lgdo.lh5_store.LH5Store) object:" | |||
"The group contains several LGDOs. Let's read them in memory. We start by initializing an `Store` [[docs]](https://legend-pydataobj.readthedocs.io/en/stable/api/lgdo.html#lgdo.lh5_store.Store) object:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The group contains several LGDOs. Let's read them in memory. We start by initializing an `Store` [[docs]](https://legend-pydataobj.readthedocs.io/en/stable/api/lgdo.html#lgdo.lh5_store.Store) object:" | |
"The group contains several LGDOs. Let's read them in memory. We start by initializing an `Store` [[docs]](https://legend-pydataobj.readthedocs.io/en/stable/api/lgdo.html#lgdo.lh5.Store) object:" |
All these links need to be fixed in the documentation...
src/lgdo/__init__.py
Outdated
"Iterator", | ||
"Store", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should remove these imports from the lh5
submodule, especially if we are dropping the LH5
prefix. The user should import lgdo.lh5.Store
, and not lgdo.Store
. But see my comment about this prefix in the review summary.
src/lgdo/cli.py
Outdated
@@ -5,11 +5,11 @@ | |||
|
|||
import lgdo | |||
import lgdo.logging | |||
from lgdo import show | |||
from lgdo.lh5.store import show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm I forgot to use relative imports in this file. Could you just import from .
instead of lgdo
?
src/lgdo/lh5/store.py
Outdated
obj.resize(new_size=size) | ||
return obj | ||
|
||
def read_object( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to rename read_object()
and write_object()
to just read()
and write()
. "object" sounds redundant to me.
I realized that I haven't made the change of |
It looks like Yeah it looks like you just need to go through each |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just need to go through each def and make sure there is a deprication warning and appropriate call-through
|
lh5_store.py
refactor (2nd attempt)
Hmm, seems like it didn't work with that approach. What I did was delete |
227324d
to
063fdb9
Compare
Co-authored-by: Luigi Pertoldi <gipert@pm.me>
This looks good to me, I will merge. |
#3
Second attempt to implement the refactoring of lh5 related classes and functions into a separate folder.
This refactoring also requires changes to the other relevant repositories (pygama, dspeed, legend-daq2lh5) as the include paths have changed. They will be included in pull requests for each package individually.
Some notes:
ls
andshow
are still in thestore.py
file. They cannot be moved toutils.py
as they reference theLH5Store
object, which would result in a circular import. Should we try to move them to a separate file?utils.py
at different levels? I am not an expert enough to know if this could cause problems with the import.