def __init__(self, hub, short_label=None, long_label=None, genomes_file=None, genomes_filename=None, email="", url=None, filename=None): """ Represents a top-level track hub container. hub : str Top-level name of the hub. short_label : str Short label for the hub, alias for UCSC parameter shortLabel. long_label : str Long label for the hub, alias for UCSC parameter longLabel. If None, will copy `short_label`. genomes_file : GenomesFile If you already have a GenomesFile created, you can add it here; otherwise when one is created you'll have to add one later with the `add_genomes_file` method. email : str Email that will be provided in the hub for contact info url : str Deprecated. filename : str If None, defaults to the value of `hub` plus ".hub.txt". When uploaded, the filename is relative to the uploaded location. """ HubComponent.__init__(self) if url is not None: self.url = url warnings.DeprecationWarning( 'url is no longer used for Hub objects') self.hub = hub if not short_label: short_label = hub self.short_label = short_label if not long_label: long_label = short_label self.long_label = long_label self.email = email self.genomes_file = None if genomes_file is not None: self.add_genomes_file(genomes_file) if filename is None: filename = hub + '.hub.txt' self.filename = filename
def stop(self, stoplogging=False): log.info('Stopping %s' % SERVER_SOFTWARE) self.startstop_lock.acquire() try: # Stop listeners for l in self.listeners: l.ready = False # Encourage a context switch time.sleep(0.01) for l in self.listeners: if l.isAlive(): l.join() # Stop Monitor self._monitor.stop() if self._monitor.isAlive(): self._monitor.join() # Stop Worker threads self._threadpool.stop() if stoplogging: logging.shutdown() msg = "Calling logging.shutdown() is now the responsibility of \ the application developer. Please update your \ applications to no longer call rocket.stop(True)" try: import warnings raise warnings.DeprecationWarning(msg) except ImportError: raise RuntimeError(msg) finally: self.startstop_lock.release()
def save_results(y_true, y_score, outputpath): '''Save ground truth and scores :param y_true: the ground truth labels, shape: (n_samples, n_classes) for multi-label, and (n_samples,) for other tasks :param y_score: the predicted score of each class, shape: (n_samples, n_classes) :param outputpath: path to save the result csv ''' warnings.DeprecationWarning("Only kept for backward compatiblility." + "Please use `Evaluator` API instead. ") idx = [] idx.append('id') for i in range(y_true.shape[1]): idx.append('true_%s' % (i)) for i in range(y_score.shape[1]): idx.append('score_%s' % (i)) df = pd.DataFrame(columns=idx) for id in range(y_score.shape[0]): dic = {} dic['id'] = id for i in range(y_true.shape[1]): dic['true_%s' % (i)] = y_true[id][i] for i in range(y_score.shape[1]): dic['score_%s' % (i)] = y_score[id][i] df_insert = pd.DataFrame(dic, index=[0]) df = df.append(df_insert, ignore_index=True) df.to_csv(outputpath, sep=',', index=False, header=True, encoding="utf_8_sig")
# Global array type setting. See use_arraytype(). __arraytype = None # Try to import the necessary modules. try: import pygame._numpysurfarray as numpysf __hasnumpy = True __arraytype = "numpy" except ImportError: __hasnumpy = False try: if not __hasnumpy: import pygame._numericsurfarray as numericsf __arraytype = "numeric" warnings.warn(warnings.DeprecationWarning( "Numeric support to be removed in Pygame 1.9.3")) else: f, p, d = imp.find_module('Numeric') f.close() __hasnumeric = True except ImportError: __hasnumeric = False if not __hasnumpy and not __hasnumeric: raise ImportError("no module named numpy or Numeric found") from pygame.pixelcopy import array_to_surface def blit_array (surface, array): """pygame.surfarray.blit_array(Surface, array): return None