:param name:
        :param start:
        :param end:
        :param resolution:
        :param window:
        :return: an analysed file.
359760
def get(self, name, start, end, resolution, window):
        
        logger.info(
            'Analysing ' + name + ' from ' + start + ' to ' + end + ' at ' + resolution + 'x resolution using ' + window + ' window')
        signal = self._uploadController.loadSignal(name,
                                                   start=start if start != 'start' else None,
                                                   end=end if end != 'end' else None)
        if signal is not None:
            window = tuple(filter(None, window.split(' ')))
            if len(window) == 2:
                window = (window[0], float(window[1]))
            import time
            data = {
                'spectrum': self._jsonify(
                    signal.spectrum(ref=SPECLAB_REFERENCE, segmentLengthMultiplier=int(resolution), window=window)
                ),
                'peakSpectrum': self._jsonify(
                    signal.peakSpectrum(ref=SPECLAB_REFERENCE, segmentLengthMultiplier=int(resolution), window=window)
                ),
                'analysedAt': int(time.time() * 1000)
            }
            return data, 200
        else:
            return None, 404
623944
def which(name):
    

    # we were given a filename, return it if it's executable
    if os.path.dirname(name) != '':
        if not os.path.isdir(name) and os.access(name, os.X_OK):
            return name
        else:
            return None

    # fetch PATH env var and split
    path_val = os.environ.get('PATH', None) or os.defpath

    # return the first match in the paths
    for path in path_val.split(os.pathsep):
        filename = os.path.join(path, name)

        if os.access(filename, os.X_OK):
            return filename

    return None
501821
def make_gdf_graph(filename, stop=True):
    
    if stop:
        stop_trace()

    try:
        f = open(filename, 'w')
        f.write(get_gdf())
    finally:
        if f: f.close()
379722
def started(name):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'comment': '',
           'result': False}

    volinfo = __salt__['glusterfs.info']()
    if name not in volinfo:
        ret['result'] = False
        ret['comment'] = 'Volume {0} does not exist'.format(name)
        return ret

    if int(volinfo[name]['status']) == 1:
        ret['comment'] = 'Volume {0} is already started'.format(name)
        ret['result'] = True
        return ret
    elif __opts__['test']:
        ret['comment'] = 'Volume {0} will be started'.format(name)
        ret['result'] = None
        return ret

    vol_started = __salt__['glusterfs.start_volume'](name)
    if vol_started:
        ret['result'] = True
        ret['comment'] = 'Volume {0} is started'.format(name)
        ret['change'] = {'new': 'started', 'old': 'stopped'}
    else:
        ret['result'] = False
        ret['comment'] = 'Failed to start volume {0}'.format(name)

    return ret
744053
def get_window_size(self, window):
        
        w_ret = ctypes.c_uint(0)
        h_ret = ctypes.c_uint(0)
        _libxdo.xdo_get_window_size(self._xdo, window, ctypes.byref(w_ret),
                                    ctypes.byref(h_ret))
        return window_size(w_ret.value, h_ret.value)
435365
def get_preparation_data(name):
    '''
    
    '''
    d = dict(
        name=name,
        sys_path=sys.path,
        sys_argv=sys.argv,
        log_to_stderr=_log_to_stderr,
        orig_dir=process.ORIGINAL_DIR,
        authkey=process.current_process().authkey,
    )

    if _logger is not None:
        d['log_level'] = _logger.getEffectiveLevel()

    if not WINEXE:
        main_path = getattr(sys.modules['__main__'], '__file__', None)
        if not main_path and sys.argv[0] not in ('', '-c'):
            main_path = sys.argv[0]
        if main_path is not None:
            if (not os.path.isabs(main_path) and process.ORIGINAL_DIR
                    is not None):
                main_path = os.path.join(process.ORIGINAL_DIR, main_path)
            if not main_path.endswith('.exe'):
                d['main_path'] = os.path.normpath(main_path)

    return d
540956
def _walk_through_windows(self):
        
        def walk(split):
            for c in split:
                if isinstance(c, (HSplit, VSplit)):
                    for i in walk(c):
                        yield i
                elif isinstance(c, Window):
                    yield split, c

        return walk(self.root)
1028899
def process(name)
      self.ext      = File.extname(name)
      self.basename = name[0 .. -self.ext.length-1].
        sub(Localization::LANG_END_RE, '')
    end
267269
def reader(fname):
    ''''''
    f = pyfastaq.utils.open_file_read(fname)

    for line in f:
        if line.startswith('[') or (not '\t' in line):
            continue

        yield alignment.Alignment(line)

    pyfastaq.utils.close(f)
408124
def open(self, name, mode='r', *args, **kwargs):
        '''  '''
        fname = self.lookup(name)
        if not fname: raise IOError("Resource %r not found." % name)
        return self.opener(fname, mode=mode, *args, **kwargs)
591406
def on_m_open_file(self,event):
        '''
        
        '''
        dlg = wx.FileDialog(
            self, message="choose orient file",
            defaultDir=self.WD,
            defaultFile="",
            style=wx.FD_OPEN | wx.FD_CHANGE_DIR
            )
        if dlg.ShowModal() == wx.ID_OK:
            orient_file = dlg.GetPath()
            dlg.Destroy()
            new_data = self.er_magic_data.read_magic_file(orient_file, "sample_name")[0]
            if len(new_data) > 0:
                self.orient_data={}
                self.orient_data=new_data
            #self.create_sheet()
            self.update_sheet()
            print("-I- If you don't see a change in the spreadsheet, you may need to manually re-size the window")
188904
def _filename(self, ifo, description, extension, segment):
        
        if extension.startswith('.'):
            extension = extension[1:]

        # Follow the frame convention of using integer filenames,
        # but stretching to cover partially covered seconds.
        start = int(segment[0])
        end = int(math.ceil(segment[1]))
        duration = str(end-start)
        start = str(start)

        return "%s-%s-%s-%s.%s" % (ifo, description.upper(), start,
                                   duration, extension)
8173
def get_window_user_pointer(window):
    

    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value

    if window_addr in _window_user_data_repository:
        data = _window_user_data_repository[window_addr]
        is_wrapped_py_object = data[0]
        if is_wrapped_py_object:
            return data[1]
    return _glfw.glfwGetWindowUserPointer(window)
1211301
def _view(self, filepath, format):
        """"""
        methodnames = [
            '_view_%s_%s' % (format, backend.PLATFORM),
            '_view_%s' % backend.PLATFORM,
        ]
        for name in methodnames:
            view_method = getattr(self, name, None)
            if view_method is not None:
                break
        else:
            raise RuntimeError('%r has no built-in viewer support for %r '
                'on %r platform' % (self.__class__, format, backend.PLATFORM))
        view_method(filepath)
219661
def _file_name(self, dtype_out_time, extension='nc'):
        """"""
        if dtype_out_time is None:
            dtype_out_time = ''
        out_lbl = utils.io.data_out_label(self.intvl_out, dtype_out_time,
                                          dtype_vert=self.dtype_out_vert)
        in_lbl = utils.io.data_in_label(self.intvl_in, self.dtype_in_time,
                                        self.dtype_in_vert)
        start_year = utils.times.infer_year(self.start_date)
        end_year = utils.times.infer_year(self.end_date)
        yr_lbl = utils.io.yr_label((start_year, end_year))
        return '.'.join(
            [self.name, out_lbl, in_lbl, self.model.name,
             self.run.name, yr_lbl, extension]
        ).replace('..', '.')
313836
def _file_details(filename):
    
    max_head, max_foot = _max_lengths()
    with open(filename, "rb") as fin:
        head = fin.read(max_head)
        try:
            fin.seek(-max_foot, os.SEEK_END)
        except IOError:
            fin.seek(0)
        foot = fin.read()
    return head, foot
913031
def fileParameter(self, comp):
        
        for row in range(self.nrows()):
            p = self._parameters[row]
            if p['parameter'] == 'filename':
                # ASSUMES COMPONENT IN ONE SELECTION
                if comp in p['selection']:
                    return row