Repository navigation
Conversation
Add ReconstructionSettings.transfer_function_dtype (float32 default). With float16, compute-tf stores complex arrays as interleaved real/imag float16 pairs along X and lists them under the float16_complex_arrays position attribute; apply-inv-tf and waveorder view upcast them back to complex64. compute-tf refuses values beyond float16's maximum of 65504.
# Conflicts: # tests/cli_tests/test_compute_tf.py
srivarra
marked this pull request as ready for review
October 23, 2026 23:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for float16 OTFs.
compute-tfwrites them when a config setstransfer_function_dtype: float16, andapply-inv-tfandwaveorder viewconverts them back to complex64 when they load them. If you don't pass in the dtype, then it continues to default to float32.Each complex array keeps complex64's real-then-imaginary layout at half width. numpy and zarr don't support complex32 out of the box. We could manage a custom dtype, but that would need integration in iohub, and TensorStore has no way to register custom dtypes. So the store declares each complex array as float16 with X doubled and lists it in
float16_complex_arrays.Size
Getting some nice tf size reductions when testing it out with
waveorder.api.*.simulate.One thing that's nice is the stores shrink by more than half because blosc compresses the rounded float16 better.
Another option: zarr's
complex_float16This one's more work, but could be useful in the longer term...
zarr-extensions registers a
complex_float16data type for zarr v3, andml_dtypes0.6.0 adds a matchingcomplex32to numpy. The layout is the same as this pr's, so a store could declarecomplex_float16at the original shape and drop thefloat16_complex_arraysattribute. It takes more work than this PR does:ml_dtypes.complex32. With that registered, iohub'szarrs-pythonandzarr-pythonbackends can handle that dtype. The registration could live inwaveorder, or iniohubso biahub and the GUI get it without importingwaveorder.ml_dtypes>=0.6.0as a dependency.PyTorch can't handle a
complex32array either, so loading still upcasts it tocomplex64.