Describe the bug
When printing a Database object, the __str__ method incorrectly reports the number of degrees of freedom (columns) as the number of snapshots. This occurs because the string formatting calls self.snapshots_matrix.shape[1] instead of shape[0] or len(self).
To Reproduce
import numpy as np
from ezyrb import Database
# Create a database with 3 snapshots and 100 degrees of freedom
params = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
snapshots = np.random.rand(3, 100)
db = Database(params, snapshots)
print(db)
Expected behavior
len(db): 3
db.parameters_matrix.shape: (3, 2)
db.snapshots_matrix.shape: (3, 100)
Output of print(db):
Database with 3 snapshots and 2 parameters
Output
len(db): 3
db.parameters_matrix.shape: (3, 2)
db.snapshots_matrix.shape: (3, 100)
Output of print(db):
Database with 100 snapshots and 2 parameters
Fix
In ezyrb/database.py, update line 134 in the __str__ method:
Change
self.snapshots_matrix.shape[1]
to
self.snapshots_matrix.shape[0]
Describe the bug
When printing a
Databaseobject, the__str__method incorrectly reports the number of degrees of freedom (columns) as the number of snapshots. This occurs because the string formatting callsself.snapshots_matrix.shape[1]instead ofshape[0]orlen(self).To Reproduce
Expected behavior
Output
Fix
In ezyrb/database.py, update line 134 in the
__str__ method:Change
to