ersa_utils.py
def save_file(file_name, data):
    """
    Save data file of given path, use numpy.load if it is in .npy format,
    otherwise use pickle or imageio
    :param file_name: absolute path to the file
    :param data: data to save
    :return: file data, or IOError if it cannot be saved by either numpy or or pickle imageio
    """
    try:
        if file_name[-3:] == 'npy':
            np.save(file_name, data)
        elif file_name[-3:] == 'pkl':
            with open(file_name, 'wb') as f:
                data = pickle.dump(data, f)
        else:
            data = imageio.imsave(file_name, data)

        return data
    except Exception:  # so many things could go wrong, can't be more specific.
        raise IOError('Problem saving this data')

    Save data file of given path, use numpy.load if it is in .npy format,
    otherwise use pickle or imageio
    :param file_name: absolute path to the file
    :param data: data to save
    :return: file data, or IOError if it cannot be saved by either numpy or or pickle imageio
    
Save data file of given path, use numpy.load if it is in .npy format,
otherwise use pickle or imageio
Save data file of given path use numpy . load if it is in . npy format otherwise use pickle or imageio
def save_file(file_name, data):
    try:
        if file_name[-3:] == 'npy':
            np.save(file_name, data)
        elif file_name[-3:] == 'pkl':
            with open(file_name, 'wb') as f:
                data = pickle.dump(data, f)
        else:
            data = imageio.imsave(file_name, data)
        return data
    except Exception:  
        raise IOError('Problem saving this data')
def save_file ( file_name , data ) : try : if file_name [ - 3 : ] == 'npy' : np . save ( file_name , data ) elif file_name [ - 3 : ] == 'pkl' : with open ( file_name , 'wb' ) as f : data = pickle . dump ( data , f ) else : data = imageio . imsave ( file_name , data ) return data except Exception : raise IOError ( 'Problem saving this data' )
Save data file of given path, use numpy.load if it is in .npy format,
otherwise use pickle or imageio
Save data file of given path use numpy . load if it is in . npy format otherwise use pickle or imageio
"""
    Save data file of given path, use numpy.load if it is in .npy format,
    otherwise use pickle or imageio
    :param file_name: absolute path to the file
    :param data: data to save
    :return: file data, or IOError if it cannot be saved by either numpy or or pickle imageio
    """ # so many things could go wrong, can't be more specific.
file data, or IOError if it cannot be saved by either numpy or or pickle imageio
file data or IOError if it cannot be saved by either numpy or or pickle imageio
file_name
absolute path to the file
absolute path to the file
data
data to save
data to save