bundles / scipy 1.17.1 / scipy / io / _idl / readsav
function
scipy.io._idl:readsav
source: /scipy/io/_idl.py :677
Signature
def readsav ( file_name , idict = None , python_dict = False , uncompressed_file_name = None , verbose = False ) Summary
Read an IDL .sav file.
Parameters
file_name: strName of the IDL save file.
idict: dict, optionalDictionary in which to insert .sav file variables.
python_dict: bool, optionalBy default, the object return is not a Python dictionary, but a case-insensitive dictionary with item, attribute, and call access to variables. To get a standard Python dictionary, set this option to True.
uncompressed_file_name: str, optionalThis option only has an effect for .sav files written with the /compress option. If a file name is specified, compressed .sav files are uncompressed to this file. Otherwise, readsav will use the tempfile module to determine a temporary filename automatically, and will remove the temporary file upon successfully reading it in.
verbose: bool, optionalWhether to print out information about the save file, including the records read, and available variables.
Returns
idl_dict: AttrDict or dictIf
python_dictis set to False (default), this function returns a case-insensitive dictionary with item, attribute, and call access to variables. Ifpython_dictis set to True, this function returns a Python dictionary with all variable names in lowercase. Ifidictwas specified, then variables are written to the dictionary specified, and the updated dictionary is returned.
Examples
from os.path import dirname, join as pjoin import scipy.io as sio from scipy.io import readsav✓
data_dir = pjoin(dirname(sio.__file__), 'tests', 'data') sav_fname = pjoin(data_dir, 'array_float32_1d.sav')✓
sav_data = readsav(sav_fname)
✓print(sav_data.keys())
✓print(sav_data['array1d'])
✓Aliases
-
scipy.io.readsav