You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading a FAST binary file using FASTOutputFile from the openfast_toolbox.io module and converting it to a DataFrame, a dimension mismatch error occurs in non-buffered mode. The error originates from openfast_toolbox/io/fast_output_file.py during the data scaling step.
Error Trigger Code:
fromopenfast_toolbox.ioimportFASTOutputFileout_file=FASTOutputFile("test.outb").toDataFrame() # Fails here
Ensure the file is in a compressed format (e.g., FileFmtID_WithTime or FileFmtID_WithoutTime).
The error occurs during the data scaling step in non-buffered mode (use_buffer=False).
Root Cause
In fast_output_file.py, the scaling arrays ColOff and ColScl are incorrectly shaped as column vectors ((NumOutChans, 1)), while the data array data has shape (NT, NumOutChans). This violates NumPy broadcasting rules when performing element-wise operations:
# In fast_output_file.py (non-buffered mode):data= (data-ColOff) /ColScl# Shapes: (NT,138) vs (138,1)
• Buffered mode works because it uses 1D arrays and applies scaling column-by-column.
Proposed Fix
Adjust the dimensions of ColOff and ColScl to align with broadcasting rules.
Option 1: Flatten to 1D Arrays
Modify the code in fast_output_file.py to convert ColOff and ColScl to 1D arrays:
Alternatively, transpose ColOff and ColScl to row vectors:
data= (data-ColOff.T) /ColScl.T# Shapes: (NT,138) vs (1,138)
Why Buffered Mode Works
In buffered mode (use_buffer=True):
• ColOff and ColScl are 1D arrays (shape (NumOutChans,)).
• Scaling is applied column-wise in a loop, avoiding broadcasting:
Description
When loading a FAST binary file using
FASTOutputFile
from theopenfast_toolbox.io
module and converting it to a DataFrame, a dimension mismatch error occurs in non-buffered mode. The error originates fromopenfast_toolbox/io/fast_output_file.py
during the data scaling step.Error Trigger Code:
Error Message:
Affected File:
openfast_toolbox/io/fast_output_file.py
Steps to Reproduce
FASTOutputFile
and load a FAST binary file:FileFmtID_WithTime
orFileFmtID_WithoutTime
).use_buffer=False
).Root Cause
In
fast_output_file.py
, the scaling arraysColOff
andColScl
are incorrectly shaped as column vectors ((NumOutChans, 1)
), while the data arraydata
has shape(NT, NumOutChans)
. This violates NumPy broadcasting rules when performing element-wise operations:• Buffered mode works because it uses 1D arrays and applies scaling column-by-column.
Proposed Fix
Adjust the dimensions of
ColOff
andColScl
to align with broadcasting rules.Option 1: Flatten to 1D Arrays
Modify the code in
fast_output_file.py
to convertColOff
andColScl
to 1D arrays:Option 2: Transpose Scaling Arrays
Alternatively, transpose
ColOff
andColScl
to row vectors:Why Buffered Mode Works
In buffered mode (
use_buffer=True
):•
ColOff
andColScl
are 1D arrays (shape(NumOutChans,)
).• Scaling is applied column-wise in a loop, avoiding broadcasting:
Impact
Affected Users: Anyone using
FASTOutputFile.toDataFrame()
in non-buffered mode.The text was updated successfully, but these errors were encountered: