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

feat: add support for complex number #374

Merged
merged 9 commits into from
Jan 27, 2025
Merged

feat: add support for complex number #374

merged 9 commits into from
Jan 27, 2025

Conversation

tmichela
Copy link
Member

HED needs to save complex number for their next experiment.
h5py does support saving complex numbers, but netCDF does not yet, there's an option in xarrays's to_netcdf to save "invalid netCDF" files allowing these features, c.f. https://docs.xarray.dev/en/stable/user-guide/io.html#invalid-netcdf-files

I understand this PR in HDF5 would allow support for these data types in netCDF, but it's not clear when it will be available.

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.

Project coverage is 75.63%. Comparing base (8c90aed) to head (3eb25b9).
Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
damnit/api.py 85.71% 3 Missing ⚠️
damnit/ctxsupport/damnit_ctx.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #374      +/-   ##
==========================================
+ Coverage   75.47%   75.63%   +0.16%     
==========================================
  Files          32       32              
  Lines        5137     5332     +195     
==========================================
+ Hits         3877     4033     +156     
- Misses       1260     1299      +39     

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

@JamesWrigley JamesWrigley linked an issue Jan 22, 2025 that may be closed by this pull request
@tmichela tmichela added the enhancement New feature or request label Jan 22, 2025
damnit/backend/db.py Outdated Show resolved Hide resolved
@takluyver
Copy link
Member

Other than those things, this LGTM

@tmichela
Copy link
Member Author

I just noticed that the run_variables table has a summary_type column that isn't used yet, but sounds like its purpose would be exactly handling this kind of object(?)
@takluyver you think it'd be better to use that column to define the summary type instead of adding a header to the blob data?

@tmichela
Copy link
Member Author

I made the change anyway, let me know what you think

@takluyver
Copy link
Member

Thanks, I think that makes sense. I had envisaged the summary_type for where there was a more specialised type based on an SQLite type that we also use, e.g. timestamps stored as floats, but I don't see any problems with using it for custom bytes types as well.

LGTM

@CammilleCC
Copy link
Member

CammilleCC commented Jan 27, 2025

+1 to putting the complex data type to summary_type 🥺

Also, LGTM. Thanks for adding the tests!

@tmichela
Copy link
Member Author

thanks both for the review!

@tmichela tmichela merged commit 76352ec into master Jan 27, 2025
6 checks passed
@tmichela tmichela deleted the feat/complexNumbers branch January 27, 2025 15:10
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.

Add support for complex numbers
4 participants