Read a CellDataFrame from an hdf5 file.

        Args:
            path (str): the path to read from
            key (str): the name of the location to read from

        Returns:
            CellDataFrame
424053
def read_hdf(cls,path,key=None):
        
        df = pd.read_hdf(path,key)
        df['scored_calls'] = df['scored_calls'].apply(lambda x: json.loads(x))
        df['channel_values'] = df['channel_values'].apply(lambda x: json.loads(x))
        df['regions'] = df['regions'].apply(lambda x: json.loads(x))
        df['phenotype_calls'] = df['phenotype_calls'].apply(lambda x: json.loads(x))
        df['neighbors'] = df['neighbors'].apply(lambda x: json.loads(x))
        df['neighbors'] = df['neighbors'].apply(lambda x:
                np.nan if not isinstance(x,dict) else dict(zip([int(y) for y in x.keys()],x.values()))
            )
        df['frame_shape'] = df['frame_shape'].apply(lambda x: tuple(json.loads(x)))
        df = cls(df)
        f = h5py.File(path,'r')
        mpp = f[key].attrs["microns_per_pixel"]
        if not np.isnan(mpp): df.microns_per_pixel = mpp
        f.close()
        return df
564628
def _notebook_model_from_path(self, path, content=False, format=None):
        
        model = base_model(path)
        model["type"] = "notebook"
        if self.fs.isfile(path):
            model["last_modified"] = model["created"] = self.fs.lstat(path)["ST_MTIME"]
        else:
            model["last_modified"] = model["created"] = DUMMY_CREATED_DATE
        if content:
            if not self.fs.isfile(path):
                self.no_such_entity(path)
            file_content = self.fs.read(path)
            nb_content = reads(file_content, as_version=NBFORMAT_VERSION)
            self.mark_trusted_cells(nb_content, path)
            model["format"] = "json"
            model["content"] = nb_content
            self.validate_notebook_model(model)
        return model
464611
def load(self, path, name):
        

        filename = name + '.fgic'
        filepath = aux.joinpath(path, filename)
        with zipfile.ZipFile(filepath, 'r') as containerZip:
            #Convert the zipfile data into a str object, necessary since
            #containerZip.read() returns a bytes object.
            jsonString = io.TextIOWrapper(containerZip.open('data'),
                                          encoding='utf-8'
                                          ).read()
            infoString = io.TextIOWrapper(containerZip.open('info'),
                                          encoding='utf-8'
                                          ).read()
        self.container = json.loads(jsonString, object_hook=Fgi.jsonHook)
        self.info.update(json.loads(infoString))
        self._matrixTemplate = self.info['_matrixTemplate']
        del self.info['_matrixTemplate']
636097
def load_df_from_file(file_path, sep=",", header=0):
  """"""
  with tf.gfile.Open(file_path) as infile:
    df = pd.read_csv(infile, sep=sep, header=header)
  return df
1200767
def load_data_file(path_of_file):
    
    if os.path.exists(path_of_file):
        return storage_utils.load_objects_from_json(path_of_file)
    raise ValueError("Data file not found: {0}".format(path_of_file))
700124
def read_data(file_path):
    

    if not is_valid(file_path):
        write_data(file_path, {})

    db = open_file_for_reading(file_path)
    content = db.read()

    obj = decode(content)

    db.close()

    return obj
215593
def read_file(*path):
    
    with open(os.path.join(*path)) as f:
        return f.read().strip()
1031854
def read_file(self, path, **kwargs):
        
        try:
            parsed_data = Parser().parse_file(path)
            return parsed_data
        except (IOError, TypeError, ImportError):
            LOGGER.warning("Error reading file: {0}".format(path))
        return None
281728
def read_hdf (self, key, **kwargs):
        
        # This one needs special handling because of the "key" and path input.
        import pandas
        return pandas.read_hdf (text_type (self), key, **kwargs)
994159
def read(path, create_file=False):
        
        if create_file:
            with open(str(path), 'a+') as data_file:
                data_file.seek(0)
                return json.load(data_file)

        else:
            with open(str(path)) as data_file:
                return json.load(data_file)
376109
def read_key_value_pairs_from_file(*path):
    
    with open(os.path.join(*path)) as f:
        for line in f:
            yield line.split(' ', 1)
1249864
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
        
        # Set file extension property
        self.fileExtension = extension

        # Keywords
        KEYWORDS = ('STREAMCELLS',
                    'CELLIJ')

        # Parse file into chunks associated with keywords/cards
        with open(path, 'r') as f:
            chunks = pt.chunk(KEYWORDS, f)

        # Parse chunks associated with each key
        for key, chunkList in iteritems(chunks):
            # Parse each chunk in the chunk list
            for chunk in chunkList:

                # Cases
                if key == 'STREAMCELLS':
                    # PIPECELLS Handler
                    schunk = chunk[0].strip().split()
                    self.streamCells = schunk[1]

                elif key == 'CELLIJ':
                    # CELLIJ Handler
                    # Parse CELLIJ Chunk
                    result = self._cellChunk(chunk)

                    # Create GSSHAPY object
                    self._createGsshaPyObjects(result)
112613
def reader_from_path(cls, path):
        
        context = FilePathContext(path)
        try:
            with open(context.filepath, 'r') as f:
                return ModelReader(f, context)
        except IOError:
            # Try to open the default file
            for filename in cls.DEFAULT_MODEL:
                try:
                    context = FilePathContext(
                        os.path.join(path, filename))
                    with open(context.filepath, 'r') as f:
                        return ModelReader(f, context)
                except:
                    logger.debug('Failed to load model file',
                                 exc_info=True)

        # No model could be loaded
        raise ParseError('No model file could be found ({})'.format(
            ', '.join(cls.DEFAULT_MODEL)))
566412
def read(path):
    
    data = None
    with open(path, 'r') as f:
        data = f.read()
    f.close()
    return data
473082
def read(path):
    
    # This function implementation was chosen to be compatible across Python 2/3.
    f = open(path, 'rb')
    # We avoid use of the with keyword for Python 2.4 support.
    try:
        b = f.read()
    finally:
        f.close()

    return b.decode(FILE_ENCODING)
544466
def read_file(cls, path):
        
        with open(path, encoding="utf-8") as file:
            file_contents = file.read()
            return cls.read(file_contents)
844576
def read_file(path):
    
    with open(must_exist(path)) as infile:
        r = infile.read()
    return r