示例#1
0
    def export(self, folder=None, name=None, format="hspy",
               save_std=False):
        """Save the data to a file.

        All the arguments are optional.

        Parameters
        ----------
        folder : str or None
            The path to the folder where the file will be saved.
             If `None` the current folder is used by default.
        name : str or None
            The name of the file. If `None` the Components name followed
             by the Parameter `name` attributes will be used by default.
              If a file with the same name exists the name will be
              modified by appending a number to the file path.
        save_std : bool
            If True, also the standard deviation will be saved
        format: str
            The extension of any file format supported by HyperSpy, default hspy

        """
        if format is None:
            format = "hspy"
        if name is None:
            name = self.component.name + '_' + self.name
        filename = incremental_filename(slugify(name) + '.' + format)
        if folder is not None:
            filename = os.path.join(folder, filename)
        self.as_signal().save(filename)
        if save_std is True:
            self.as_signal(field='std').save(append2pathname(
                filename, '_std'))
示例#2
0
    def export(self, folder=None, name=None, format="hspy", save_std=False):
        """Save the data to a file.

        All the arguments are optional.

        Parameters
        ----------
        folder : str or None
            The path to the folder where the file will be saved.
             If `None` the current folder is used by default.
        name : str or None
            The name of the file. If `None` the Components name followed
             by the Parameter `name` attributes will be used by default.
              If a file with the same name exists the name will be
              modified by appending a number to the file path.
        save_std : bool
            If True, also the standard deviation will be saved
        format: str
            The extension of any file format supported by HyperSpy, default hspy

        """
        if format is None:
            format = "hspy"
        if name is None:
            name = self.component.name + '_' + self.name
        filename = incremental_filename(slugify(name) + '.' + format)
        if folder is not None:
            filename = os.path.join(folder, filename)
        self.as_signal().save(filename)
        if save_std is True:
            self.as_signal(field='std').save(append2pathname(filename, '_std'))
示例#3
0
 def export(self, folder=None, name=None, format=None, save_std=False):
     """Save the data to a file.
     
     All the arguments are optional.
     
     Parameters
     ----------
     folder : str or None
         The path to the folder where the file will be saved.
          If `None` the current folder is used by default.
     name : str or None
         The name of the file. If `None` the Components name followed
          by the Parameter `name` attributes will be used by default.
           If a file with the same name exists the name will be 
           modified by appending a number to the file path.
     save_std : bool
         If True, also the standard deviation will be saved
     
     """
     if format is None:
         format = preferences.General.default_export_format
     if name is None:
         name = self.component.name + "_" + self.name
     filename = incremental_filename(slugify(name) + "." + format)
     if folder is not None:
         filename = os.path.join(folder, filename)
     self.as_signal().save(filename)
     if save_std is True:
         self.as_signal(field="std").save(append2pathname(filename, "_std"))