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

Simplified data loader #59

Merged
merged 54 commits into from
Sep 24, 2024
Merged

Simplified data loader #59

merged 54 commits into from
Sep 24, 2024

Conversation

theHenks
Copy link
Collaborator

Included read_ldata function to simplify data loading for a single DataTier and ChannelId including fast flattening and concatenation of tables and arrays.
The following functionality is implemented:
Example (requires a $LEGEND_DATA_CONFIG environment variable pointing to a legend data-config file):

using LegendDataManagement, LegendHDF5IO
l200 = LegendData(:l200)
filekeys = search_dsik(FileKey, l200.tier[:jldsp, :cal, :p03, :r000])

chinfo = channelinfo(l200, (:p03, :r000, :cal); system=:geds, only_processable=true)

ch = chinfo[1].channel

dsp = read_ldata(l200, :jldsp, first(filekeys), ch)
dsp = read_ldata(l200, :jldsp, :cal, :p03, :r000, ch)
dsp = read_ldata((:e_cusp, :e_trap, :blmean, :blslope), l200, :jldsp, :cal, :p03, :r000, ch)

read_ldata automitcally loads LEGEND data for a specific DataTier and data selection like e.g. a FileKey or a run-selection based for a given ChannelId. The search_disk function allows the user to search for available DataTier and FileKey on disk. The first argument can be either a selection of keys in form of a NTuple of Symbol or a PropertyFunction which will be applied during loading.
It is also possible to load whole a DataPartition or DataPeriod for a given ChannelId ch:

dsp = read_ldata(l200, :jldsp, :cal, DataPartition(1), ch)
dsp = read_ldata(l200, :jldsp, :cal, DataPeriod(3), ch)

In additon, it is possible to load a random selection of n_evts events randomly selected from each loaded file:

dsp = read_ldata(l200, :jldsp, :cal, :p03, :r000, ch; n_evts=1000)

For simplicity, the ch can also be given as a DetectorID which will be converted internally to a ChannelId:

det = chinfo[1].detector
dsp = read_ldata(l200, :jldsp, :cal, :p03, :r000, det)

@theHenks theHenks requested a review from oschulz August 14, 2024 14:49
@theHenks theHenks self-assigned this Aug 14, 2024
@theHenks theHenks added the enhancement New feature or request label Aug 14, 2024
@theHenks theHenks linked an issue Aug 14, 2024 that may be closed by this pull request
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 46.58041% with 289 lines in your changes missing coverage. Please review.

Project coverage is 36.40%. Comparing base (469a00e) to head (8be0c18).
Report is 56 commits behind head on main.

Files with missing lines Patch % Lines
ext/LegendDataManagementLegendHDF5IOExt.jl 0.00% 99 Missing ⚠️
ext/LegendDataManagementSolidStateDetectorsExt.jl 73.82% 39 Missing ⚠️
src/calibration_functions.jl 0.00% 31 Missing ⚠️
src/active_volume.jl 74.22% 25 Missing ⚠️
src/evt_functions.jl 0.00% 24 Missing ⚠️
src/dataprod_config.jl 0.00% 23 Missing ⚠️
src/utils/pars_utils.jl 0.00% 16 Missing ⚠️
src/legend_data.jl 81.70% 15 Missing ⚠️
src/data_io.jl 0.00% 10 Missing ⚠️
src/utils/data_utils.jl 0.00% 4 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   33.00%   36.40%   +3.40%     
==========================================
  Files          27       28       +1     
  Lines        1618     2104     +486     
==========================================
+ Hits          534      766     +232     
- Misses       1084     1338     +254     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oschulz
Copy link
Contributor

oschulz commented Aug 16, 2024

This is still in progress, right?

@theHenks
Copy link
Collaborator Author

I need some final checks, than it is ready. But the core is in principle ready to be merged.

docs/src/extensions.md Outdated Show resolved Hide resolved
@fhagemann
Copy link
Contributor

@theHenks I merged all PRs on dev and resolved the merge conflicts,
meaning that it is up to date with main and should be good to go.

@oschulz
Copy link
Contributor

oschulz commented Sep 19, 2024

Is dev ready to be merged into main then?

@fhagemann fhagemann mentioned this pull request Sep 19, 2024
@fhagemann fhagemann merged commit 13775c4 into main Sep 24, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overload lh5open
5 participants