From 925a4f73d649eee0276e102e0c95da2c119d18fa Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 26 Nov 2019 20:32:54 +0100 Subject: [PATCH] staticmethod better suited than class method a classmethod changes the class, i.e. it assigns attributes and gives them specific values. a staticmethod does not alter the class https://www.geeksforgeeks.org/class-method-vs-static-method-python --- python/damask/geom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/damask/geom.py b/python/damask/geom.py index 1c9e10cd1..32ea2ed89 100644 --- a/python/damask/geom.py +++ b/python/damask/geom.py @@ -239,8 +239,8 @@ class Geom(): header.append('homogenization {}'.format(self.get_homogenization())) return header - @classmethod - def from_file(cls,fname): + @staticmethod + def from_file(fname): """ Reads a geom file. @@ -300,7 +300,7 @@ class Geom(): if not np.any(np.mod(microstructure.flatten(),1) != 0.0): # no float present microstructure = microstructure.astype('int') - return cls(microstructure.reshape(grid),size,origin,homogenization,comments) + return Geom(microstructure.reshape(grid),size,origin,homogenization,comments) def to_file(self,fname,pack=None):