Skip to content

Commit 5b96867

Browse files
authored
Merge pull request #53 from Pressio/snapshot_data_refactor
get rid of reference to undocumented parameter and add some comments
2 parents d9bf5f1 + b91fdb8 commit 5b96867

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

romtools/snapshot_data.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,19 @@ def getMeshGids(self):
4949
"""
5050
pass
5151

52-
def getSnapshotsAsArray(self) -> np.ndarray:
53-
snapshot_array = listOfSnapshotsToArray(self.getSnapshotsAsListOfArrays())
54-
return snapshot_array
55-
52+
@abc.abstractmethod
5653
def getVariableNames(self) -> list:
5754
"""
5855
Returns the names of different state variables
5956
"""
60-
return self.var_names
57+
pass
58+
59+
def getSnapshotsAsArray(self) -> np.ndarray:
60+
"""
61+
Returns numpy array where the list of snapshot arrays are concatenated
62+
(assuming each snapshot corresponds to a column vector)
63+
"""
64+
return _listOfSnapshotsToArray(self.getSnapshotsAsListOfArrays())
6165

6266
def getNumVars(self) -> int:
6367
"""
@@ -66,10 +70,8 @@ def getNumVars(self) -> int:
6670
"""
6771
return len(self.get_variable_names())
6872

69-
70-
71-
def listOfSnapshotsToArray(list_of_snapshots: Iterable[np.ndarray]) -> np.ndarray:
72-
'''
73-
Helper function to move snapshot list into a matrix
74-
'''
75-
return np.hstack([ar.reshape(ar.shape[0],-1) for ar in list_of_snapshots])
73+
def _listOfSnapshotsToArray(list_of_snapshots: Iterable[np.ndarray]) -> np.ndarray:
74+
'''
75+
Helper function to move snapshot list into a matrix
76+
'''
77+
return np.hstack([ar.reshape(ar.shape[0],-1) for ar in list_of_snapshots])

0 commit comments

Comments
 (0)