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
An obstacle to quick adoption of TBROMs in a workflow is the need for the user to create additional functions to convert data in tabular format (generally the most common import/export format from other 3D tools) to snapshot vectors and vice versa.
On the input side, there is the potential error of using column-major, rather than row-major vectorisation, while for outputs, the dimensionality is not directly inferable from the vector and needs to retrieve from the TBROM settings anyway.
e.g. n x 3 matrix must be flattened to 3n vector on input. On output, dimensionality must be retrieved from tbrom.field_output_dim and then used to reshape the vector
x
y
z
x_1
y_1
z_1
x_2
y_2
z_2
...
...
...
x_n
y_n
z_n
flattens to
x_1
y_1
...
z_n
Incorporating these functions simplifies user work and abstracts the snapshot format.
💡 Steps for implementing the feature
A possible option is to provide an additional boolean argument to TbRom.generate_snapshot and TbRom.generate_snapshot to export as a matrix e.g. as_matrix.
Input flattening could use ndarray.flatten(order='C') directly, explicitly using the row-major style. Boolean argument is not strictly necessary, since structure can be inferred from input shape. This would also required the ability to pass inputs in memory (see Issue 107).
Output reshaping can use the numpy.reshape(vec, newshape, order='C') function. New shape columns are retrieved from TBROM field_output_dim, rows calculated from len(vec) / dim.
In both cases, reading/writing matrices to disk need not necessarily be supported. The specific formats required may vary with upstream and downstream programs, so writing can be left to the user.
🔗 Useful links and references
Input matrices would require implementation of Issue #107
The text was updated successfully, but these errors were encountered:
btw S & M (depending on if we refactor the static binary data helpers.)
Priority:
btw low to medium, this is a question that is often raised by ROM users (=> maybe we should document our snapshot data format better in the PyTwin doc?)
📝 Description of the feature
Add option to import/export snapshot as matrix
An obstacle to quick adoption of TBROMs in a workflow is the need for the user to create additional functions to convert data in tabular format (generally the most common import/export format from other 3D tools) to snapshot vectors and vice versa.
On the input side, there is the potential error of using column-major, rather than row-major vectorisation, while for outputs, the dimensionality is not directly inferable from the vector and needs to retrieve from the TBROM settings anyway.
e.g.
n x 3
matrix must be flattened to3n
vector on input. On output, dimensionality must be retrieved fromtbrom.field_output_dim
and then used to reshape the vectorflattens to
Incorporating these functions simplifies user work and abstracts the snapshot format.
💡 Steps for implementing the feature
A possible option is to provide an additional boolean argument to
TbRom.generate_snapshot
andTbRom.generate_snapshot
to export as a matrix e.g.as_matrix
.Input flattening could use
ndarray.flatten(order='C')
directly, explicitly using the row-major style. Boolean argument is not strictly necessary, since structure can be inferred from input shape. This would also required the ability to pass inputs in memory (see Issue 107).Output reshaping can use the
numpy.reshape(vec, newshape, order='C')
function. New shape columns are retrieved from TBROMfield_output_dim
, rows calculated fromlen(vec) / dim
.In both cases, reading/writing matrices to disk need not necessarily be supported. The specific formats required may vary with upstream and downstream programs, so writing can be left to the user.
🔗 Useful links and references
Input matrices would require implementation of Issue #107
The text was updated successfully, but these errors were encountered: