code: def tofile(self, path='filters'):
          r
  
          # Get name of filter
          name = self.savename
  
          # Get absolute path, create if it doesn't exist
          path = os.path.abspath(path)
          os.makedirs(path, exist_ok=True)
  
          # Save filter base
          basefile = os.path.join(path, name + '_base.txt')
          with open(basefile, 'w') as f:
              self.base.tofile(f, sep="\n")
  
          # Save filter coefficients
          for val in ['j0', 'j1', 'sin', 'cos']:
              if hasattr(self, val):
                  attrfile = os.path.join(path, name + '_' + val + '.txt')
                  with open(attrfile, 'w') as f:
                      getattr(self, val).tofile(f, sep="\n")
docs: r"""Save filter values to ascii-files.
  
          Store the filter base and the filter coefficients in separate files
          in the directory `path`; `path` can be a relative or absolute path.
  
          Examples
          --------
          >>> import empymod
          >>> # Load a filter
          >>> filt = empymod.filters.wer_201_2018()
          >>> # Save it to pure ascii-files
          >>> filt.tofile()
          >>> # This will save the following three files:
          >>> #    ./filters/wer_201_2018_base.txt
          >>> #    ./filters/wer_201_2018_j0.txt
          >>> #    ./filters/wer_201_2018_j1.txt