#NEWLINE# @ verbose #NEWLINE# def save( self , fname , picks = None , tmin = 0 , tmax = None , buffer_size_sec = 10 , drop_small_buffer = False , proj = False , fmt = 'single' , overwrite = False , split_size = '2GB' , verbose = None ) : #NEWLINE# #INDENT# "Save raw data to file\n\n        Parameters\n        ----------\n        fname : string\n            File name of the new dataset. This has to be a new filename\n            unless data have been preloaded. Filenames should end with\n            raw.fif, raw.fif.gz, raw_sss.fif, raw_sss.fif.gz, raw_tsss.fif\n            or raw_tsss.fif.gz.\n        picks : array-like of int | None\n            Indices of channels to include. If None all channels are kept.\n        tmin : float | None\n            Time in seconds of first sample to save. If None first sample\n            is used.\n        tmax : float | None\n            Time in seconds of last sample to save. If None last sample\n            is used.\n        buffer_size_sec : float | None\n            Size of data chunks in seconds. If None, the buffer size of\n            the original file is used.\n        drop_small_buffer : bool\n            Drop or not the last buffer. It is required by maxfilter (SSS)\n            that only accepts raw files with buffers of the same size.\n        proj : bool\n            If True the data is saved with the projections applied (active).\n\n            .. note:: If ``apply_proj()`` was used to apply the projections,\n                      the projectons will be active even if ``proj`` is False.\n\n        fmt : str\n            Format to use to save raw data. Valid options are 'double',\n            'single', 'int', and 'short' for 64- or 32-bit float, or 32- or\n            16-bit integers, respectively. It is **strongly** recommended to\n            use 'single', as this is backward-compatible, and is standard for\n            maintaining precision. Note that using 'short' or 'int' may result\n            in loss of precision, complex data cannot be saved as 'short',\n            and neither complex data types nor real data stored as 'double'\n            can be loaded with the MNE command-line tools. See raw.orig_format\n            to determine the format the original data were stored in.\n        overwrite : bool\n            If True, the destination file (if it exists) will be overwritten.\n            If False (default), an error will be raised if the file exists.\n        split_size : string | int\n            Large raw files are automatically split into multiple pieces. This\n            parameter specifies the maximum size of each piece. If the\n            parameter is an integer, it specifies the size in Bytes. It is\n            also possible to pass a human-readable string, e.g., 100MB.\n\n            .. note:: Due to FIFF file limitations, the maximum split\n                      size is 2GB.\n\n        verbose : bool, str, int, or None\n            If not None, override default verbose level (see mne.verbose).\n            Defaults to self.verbose.\n\n        Notes\n        -----\n        If Raw is a concatenation of several raw files, **be warned** that\n        only the measurement information from the first raw file is stored.\n        This likely means that certain operations with external tools may not\n        work properly on a saved concatenated file (e.g., probably some\n        or all forms of SSS). It is recommended not to concatenate and\n        then save raw files for this reason.\n        " #NEWLINE# check_fname ( fname , 'raw' , ( 'raw.fif' , 'raw_sss.fif' , 'raw_tsss.fif' , 'raw.fif.gz' , 'raw_sss.fif.gz' , 'raw_tsss.fif.gz' ) ) #NEWLINE# split_size = _get_split_size ( split_size ) #NEWLINE# fname = op . realpath ( fname ) #NEWLINE# if ( ( not self . preload ) and ( fname in self . _filenames ) ) : #NEWLINE# #INDENT# raise ValueError ( 'You cannot save data to the same file. Please use a different filename.' ) #NEWLINE# #UNINDENT# if self . preload : #NEWLINE# #INDENT# if np . iscomplexobj ( self . _data ) : #NEWLINE# #INDENT# warn ( 'Saving raw file with complex data. Loading with command-line MNE tools will not work.' ) #NEWLINE# #UNINDENT# #UNINDENT# type_dict = dict ( short = FIFF . FIFFT_DAU_PACK16 , int = FIFF . FIFFT_INT , single = FIFF . FIFFT_FLOAT , double = FIFF . FIFFT_DOUBLE ) #NEWLINE# if ( fmt not in type_dict . keys ( ) ) : #NEWLINE# #INDENT# raise ValueError ( 'fmt must be "short", "int", "single", or "double"' ) #NEWLINE# #UNINDENT# reset_dict = dict ( short = False , int = False , single = True , double = True ) #NEWLINE# reset_range = reset_dict [ fmt ] #NEWLINE# data_type = type_dict [ fmt ] #NEWLINE# data_test = self [ ( 0 , 0 ) ] [ 0 ] #NEWLINE# if ( ( fmt == 'short' ) and np . iscomplexobj ( data_test ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Complex data must be saved as "single" or "double", not "short"' ) #NEWLINE# #UNINDENT# _check_fname ( fname , overwrite ) #NEWLINE# if proj : #NEWLINE# #INDENT# info = copy . deepcopy ( self . info ) #NEWLINE# ( projector , info ) = setup_proj ( info ) #NEWLINE# activate_proj ( info [ 'projs' ] , copy = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# info = self . info #NEWLINE# projector = None #NEWLINE# #UNINDENT# inv_comp = None #NEWLINE# if ( self . comp is not None ) : #NEWLINE# #INDENT# inv_comp = linalg . inv ( self . comp ) #NEWLINE# set_current_comp ( info , self . _orig_comp_grade ) #NEWLINE# #UNINDENT# start = int ( np . floor ( ( tmin * self . info [ 'sfreq' ] ) ) ) #NEWLINE# if ( tmax is None ) : #NEWLINE# #INDENT# stop = ( ( self . last_samp + 1 ) - self . first_samp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stop = int ( np . floor ( ( tmax * self . info [ 'sfreq' ] ) ) ) #NEWLINE# #UNINDENT# buffer_size = self . _get_buffer_size ( buffer_size_sec ) #NEWLINE# _write_raw ( fname , self , info , picks , fmt , data_type , reset_range , start , stop , buffer_size , projector , inv_comp , drop_small_buffer , split_size , 0 , None )