Skip to content

Conversation

@cdunn314
Copy link
Contributor

In working with the BABY-1L-Run-2 foil activation data, libra-toolbox failed to upload the spectra from CoMPASS csv files with waveforms present. This PR fixes that problem.

Without this PR, the pandas.read_csv() function will read in the first csv file with a column header of length 8 even though the rows with actual data have 207 columns. The function will then assume that the last 8 columns are the correct ones, resulting in incorrect data assignment. And in reading any subsequent csv files that do not have a column header in the first row, get_events() function fails when trying to assign only 8 columns to data with 207 columns.

What this PR's version of get_events() does is to manually read just the first row of the first csv file with the column headers, and determine which column indices apply to the "TIMETAG" and "ENERGY" columns. Then it reads in the first csv file, skipping the first row which has the header, and indexes the times and energy values using the column indices determined previously. For all csv files after the first one, no rows are skipped in reading in the CSV file, and the same predetermined number indices are used to index the time and energy columns instead of indexing with ["TIMETAG"] and ["ENERGY"].

@codecov
Copy link

codecov bot commented Jul 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.48%. Comparing base (8644e0a) to head (981ecc5).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   86.46%   86.48%   +0.01%     
==========================================
  Files          18       18              
  Lines        1478     1480       +2     
==========================================
+ Hits         1278     1280       +2     
  Misses        200      200              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RemDelaporteMathurin RemDelaporteMathurin self-requested a review July 29, 2025 12:49
Copy link
Member

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdunn314 nice catch. COMPASS is a bit dumb here... there are solutions to this to fix this upstream... I wonder if we could report it to them or something?

Just a small suggestion for the test function name then we can merge this

@RemDelaporteMathurin RemDelaporteMathurin merged commit f460865 into LIBRA-project:main Jul 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants