Create Epoch info
960611
def epoch_info(self, training_info: TrainingInfo, global_idx: int, local_idx: int) -> EpochInfo:
        
        raise NotImplementedError
73172
def on_epoch_end(self):
        
        self.freeze_epoch_result()

        for callback in self.callbacks:
            callback.on_epoch_end(self)

        self.training_info.history.add(self.result)
486655
def init_epoch(self):
        """"""

        if self._restored_from_state:
            self.random_shuffler.random_state = self._random_state_this_epoch
        else:
            self._random_state_this_epoch = self.random_shuffler.random_state

        self.create_batches()

        if self._restored_from_state:
            self._restored_from_state = False
        else:
            self._iterations_this_epoch = 0

        if not self.repeat:
            self.iterations = 0
986381
def after_epoch(self, epoch_data: EpochData, **kwargs) -> None:
        
        self._save_stats(epoch_data)
        super().after_epoch(epoch_data=epoch_data, **kwargs)
425634
def _to_epoch(self, ts):
        

        year = self.year
        tmpts = "%s %s" % (ts, str(self.year))
        new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        # If adding the year puts it in the future, this log must be from last year
        if new_time > int(time.time()):
            year -= 1
            tmpts = "%s %s" % (ts, str(year))
            new_time = int(calendar.timegm(time.strptime(tmpts, "%b %d %H:%M:%S %Y")))

        return new_time
1081740
def add_environment_information(meta):
        """"""
        meta["timestamp"] = datetime.utcnow().isoformat(" ")
        meta["platform"] = platform.system()
        meta["release"] = platform.release()
        meta["python"] = platform.python_version()
        meta["packages"] = get_pkg_info("memote")
1302337
def monkey_restore():
    """"""
    for k, v in originals.items():
        setattr(time_mod, k, v)
    
    global epoch
    epoch = None
507912
def set_epoch(self, year):
        

        fa.loadapxsh(self.datafile, np.float(year))
        self.year = year
733829
def __datetime_to_epoch(self, date_time):
        
        date_time_utc = None
        if date_time.tzinfo is None:
            date_time_utc = date_time.replace(tzinfo=pytz.utc)
        else:
            date_time_utc = date_time.astimezone(pytz.utc)

        epoch_utc = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)

        return (date_time_utc - epoch_utc).total_seconds()
66064
def enkf(self):
        

        for cycle_index, time_point in enumerate(self.timeline):
            if cycle_index >= len(self.timeline) - 1:
                # Logging : Last Update cycle has finished
                break

            print("Print information about this assimilation Cycle ???")  # should be handeled in Logger

            # each cycle should have a dictionary of template files and instruction files to update the model inout
            # files
            # get current cycle update information
            current_cycle_files = self.cycle_update_files[cycle_index]

            #  (1)  update model input files for this cycle
            self.model_temporal_evolotion(cycle_index, current_cycle_files)

            # (2) generate new Pst object for the current time cycle
            current_pst = copy.deepcopy(self.pst)
            # update observation dataframe
            # update parameter dataframe
            # update in/out files if needed

            # At this stage the problem is equivalent to smoother problem
            self.smoother(current_pst)
1072084
def cluster_set_config_epoch(self, config_epoch):
        """"""
        fut = self.execute(b'CLUSTER', b'SET-CONFIG-EPOCH', config_epoch)
        return wait_ok(fut)
569700
public static Message buildNewLeader(long epoch) {
    NewLeader nl = NewLeader.newBuilder().setEpoch(epoch).build();
    return Message.newBuilder().setType(MessageType.NEW_LEADER)
                               .setNewLeader(nl)
                               .build();
  }
312855
def datetime_from_timestamp(n, epoch=datetime.datetime.fromordinal(693594)):
    
    return epoch + datetime.timedelta(n)
1114702
def _dt_to_epoch(dt):
        """"""
        try:
            epoch = dt.timestamp()
        except AttributeError:  # py2
            epoch = (dt - datetime(1970, 1, 1)).total_seconds()
        return epoch
526393
def create_epochs(self, epoch_length=30, first_second=None):
        
        lg.info('creating epochs of length ' + str(epoch_length))
        if first_second is None:
            first_second = self.first_second
        last_sec = ceil((self.last_second - first_second) /
                        epoch_length) * epoch_length

        stages = self.rater.find('stages')
        for epoch_beg in range(first_second, last_sec, epoch_length):
            epoch = SubElement(stages, 'epoch')

            start_time = SubElement(epoch, 'epoch_start')
            start_time.text = str(epoch_beg)

            end_time = SubElement(epoch, 'epoch_end')
            end_time.text = str(epoch_beg + epoch_length)

            stage = SubElement(epoch, 'stage')
            stage.text = 'Unknown'

            quality = SubElement(epoch, 'quality')
            quality.text = 'Good'
737634
def line_up_with_epoch(self):
        """"""
        if self.parent.notes.annot is None:  # TODO: remove if buttons are disabled
            error_dialog = QErrorMessage()
            error_dialog.setWindowTitle('Error moving to epoch')
            error_dialog.showMessage('No score file loaded')
            error_dialog.exec()
            return

        new_window_start = self.parent.notes.annot.get_epoch_start(
            self.parent.value('window_start'))

        self.parent.overview.update_position(new_window_start)
335589
def add_basic_info(self, run_id, timestamp):
    """"""
    datetime = time.strftime('%A %b %d, %Y %H:%M:%S', time.localtime(timestamp))
    user = getpass.getuser()
    machine = socket.gethostname()
    buildroot = get_buildroot()
    # TODO: Get rid of the redundant 'path' key once everyone is off it.
    self.add_infos(('id', run_id), ('timestamp', timestamp), ('datetime', datetime),
                   ('user', user), ('machine', machine), ('path', buildroot),
                   ('buildroot', buildroot), ('version', version.VERSION))