def save(self, filename, overwrite=None): """Save the result of the decomposition and demixing analysis Parameters ---------- filename : string overwrite : {True, False, None} If True(False) overwrite(don't overwrite) the file if it exists. If None (default) ask what to do if file exists. """ kwargs = {} for attribute in [ v for v in dir(self) if not isinstance(getattr(self, v), types.MethodType) and not v.startswith('_')]: kwargs[attribute] = self.__getattribute__(attribute) # Check overwrite if overwrite is None: overwrite = io_tools.overwrite(filename) # Save, if all went well! if overwrite is True: np.savez(filename, **kwargs)