Esempio n. 1
0
 def get_result(self, group, name):
     """Return 'result' in 'results/group' that was saved by 
     the save_result() method."""
     with h5py.File(self.h5_path, 'r') as h5_file:
         if not group in h5_file['results']:
             raise Exception('The result group \'%s\' does not exist'%group)
         if not name in h5_file['results'][group].attrs.keys():
             raise Exception('The result \'%s\' does not exist'%name)
         return get_attribute(h5_file['results'][group], name)
Esempio n. 2
0
    def pre_transition_to_buffered(self, h5_filepath):
        # Delay according to the settings of the previously run shot, and save the
        # settings for the upcoming shot:
        self.target_cycle_time = self.next_target_cycle_time
        self.delay_after_programming = self.next_delay_after_programming

        with h5py.File(h5_filepath) as f:
            try:
                group = f['shot_properties']
            except KeyError:
                # Nothing for us to do
                return
            self.next_target_cycle_time = get_attribute(group, 'target_cycle_time')
            self.next_delay_after_programming = get_attribute(
                group, 'cycle_time_delay_after_programming'
            )

        if not self.delay_after_programming:
            self.do_delay(h5_filepath)
Esempio n. 3
0
    def get_result(self, group, name):
        """Retrieve result from prior calculation.

        Args:
            group (str): Group to look in for the result. Typically the name of
                the analysis script that created it.
            name (str): Name of the result.

        Raises:
            Exception: If `group` or `name` do not already exist.

        Returns:
            : Result with appropriate type, as determined by 
            :obj:`labscript-utils:labscript_utils.properties.get_attribute`.
        """
        with h5py.File(self.h5_path, 'r') as h5_file:
            if not group in h5_file['results']:
                raise Exception('The result group \'%s\' does not exist' %
                                group)
            if not name in h5_file['results'][group].attrs.keys():
                raise Exception('The result \'%s\' does not exist' % name)
            return get_attribute(h5_file['results'][group], name)