def __init__(self, scope, defDir=genHDFDataFilepath(), defSeries='%(day)d_%(month)d_series'): """Initialise the spooling controller. Parameters ---------- scope : microscope instance The currently active microscope class (see microscope.py) defDir : string pattern The default directory to save data to. Any keys of the form `%(<key>)` will be substituted using the values defined in `PYME.fileUtils.nameUtils.dateDict` defSeries : string pattern This specifies a pattern for file naming. Keys will be substituted as for `defDir` """ self.scope = scope self.spoolType = 'Queue' #dtn = datetime.datetime.now() #dateDict = {'username' : win32api.GetUserName(), 'day' : dtn.day, 'month' : dtn.month, 'year':dtn.year} self._user_dir = None self._base_dir = nameUtils.get_local_data_directory() self._subdir = nameUtils.get_spool_subdir() self.seriesStub = defSeries % nameUtils.dateDict self.seriesCounter = 0 self._series_name = None self.protocol = prot.NullProtocol self.protocolZ = prot.NullZProtocol self.onSpoolProgress = dispatch.Signal() self.onSpoolStart = dispatch.Signal() self.onSpoolStop = dispatch.Signal() self._analysis_launchers = queue.Queue(3) self.compressionSettings = HTTPSpooler.defaultCompSettings
def __init__(self, scope, defDir=genHDFDataFilepath(), defSeries='%(day)d_%(month)d_series'): """Initialise the spooling controller. Parameters ---------- scope : microscope instance The currently active microscope class (see microscope.py) defDir : string pattern The default directory to save data to. Any keys of the form `%(<key>)` will be substituted using the values defined in `PYME.fileUtils.nameUtils.dateDict` defSeries : string pattern This specifies a pattern for file naming. Keys will be substituted as for `defDir` """ self.scope = scope if int(sys.version[0]) < 3: #default to Queue for Py2 self.spoolType = 'Queue' else: #else default to file self.spoolType = 'File' #dtn = datetime.datetime.now() #dateDict = {'username' : win32api.GetUserName(), 'day' : dtn.day, 'month' : dtn.month, 'year':dtn.year} self._user_dir = None self._base_dir = nameUtils.get_local_data_directory() self._subdir = nameUtils.get_spool_subdir() self.seriesStub = defSeries % nameUtils.dateDict self.seriesCounter = 0 self._series_name = None self.protocol = prot.NullProtocol self.protocolZ = prot.NullZProtocol self.onSpoolProgress = dispatch.Signal() self.onSpoolStart = dispatch.Signal() self.onSpoolStop = dispatch.Signal() self._analysis_launchers = queue.Queue(3) self._status_changed_condition = threading.Condition() #settings which were managed by GUI self.hdf_compression_level = 2 # zlib compression level that pytables should use (spool to file and queue) self.z_stepped = False # z-step during acquisition self.z_dwell = 100 # time to spend at each z level (if z_stepped == True) self.cluster_h5 = False # spool to h5 on cluster (cluster of one) self.pzf_compression_settings = HTTPSpooler.defaultCompSettings # only for cluster spooling #check to see if we have a cluster self._N_data_servers = len( hybrid_ns.getNS('_pyme-http').get_advertised_services()) if self._N_data_servers > 0: # switch to cluster as spool method if available. self.SetSpoolMethod('Cluster') if self._N_data_servers == 1: self.cluster_h5 = True # we have a cluster of one