Exemplo n.º 1
0
 def validate(self):
     """Runs a validation test.
        This checks that a samples group exist, and that pickeled data can
        be loaded.
     Returns
     -------
     bool :
         Whether or not the file is valid as a checkpoint file.
     """
     try:
         if 'sampler_info/saved_state' in self:
             load_state(self, path='sampler_info/saved_state')
         checkpoint_valid = True
     except KeyError:
         checkpoint_valid = False
     return checkpoint_valid
Exemplo n.º 2
0
    def restore_state(filename):
        """Restore state of the background buffers from a file"""
        from pycbc.io.hdf import load_state

        fp = h5py.File(filename, 'r')
        try:
            mgr = load_state(fp)
        except Exception as e:
            fp.close()
            raise e
        fp.close()
        next_template = mgr.tnum_finished + 1
        logging.info('Restoring with checkpoint at template %s', next_template)
        return mgr.tnum_finished + 1, mgr
Exemplo n.º 3
0
 def read_pickled_data_from_checkpoint_file(self):
     """Load the sampler state (pickled) from checkpoint file
     """
     return load_state(self, path='sampler_info/saved_state')