show all defined beamlines
963821
def showBeamlines(self):
        
        cnt = 0
        blidlist = []
        for k in self.all_elements:
            try:
                if 'beamline' in self.all_elements.get(k):
                    cnt += 1
                    blidlist.append(k)
            except:
                pass
        retstr = '{total:<3d}beamlines: {allbl}'.format(total=cnt,
                                                        allbl=';'.join(blidlist))
        return retstr
146810
def lines(self):
        """"""
        if self._lines is None:
            with io.open(self.path, 'r', encoding='utf-8') as fh:
                self._lines = fh.read().split('\n')

        return self._lines
351543
function showArray(maxDepth, array) {
  return '['
        + array.map(function(a) {
            return show(maxDepth - 1, a)
          }).join(', ')
        + ']';
}
451303
def show_tour(self, index):
        """"""
        self.maximize_dockwidget(restore=True)
        frames = self.tours_available[index]
        self.tour.set_tour(index, frames, self)
        self.tour.start_tour()
330116
def show_wbridges(self):
        """"""
        for bridge in self.plcomplex.waterbridges:
            if bridge.protisdon:
                cmd.select('HBondDonor-P', 'HBondDonor-P or (id %i & %s)' % (bridge.don_id, self.protname))
                cmd.select('HBondAccept-L', 'HBondAccept-L or (id %i & %s)' % (bridge.acc_id, self.ligname))
                cmd.select('tmp_don', 'id %i & %s' % (bridge.don_id, self.protname))
                cmd.select('tmp_acc', 'id %i & %s' % (bridge.acc_id, self.ligname))
            else:
                cmd.select('HBondDonor-L', 'HBondDonor-L or (id %i & %s)' % (bridge.don_id, self.ligname))
                cmd.select('HBondAccept-P', 'HBondAccept-P or (id %i & %s)' % (bridge.acc_id, self.protname))
                cmd.select('tmp_don', 'id %i & %s' % (bridge.don_id, self.ligname))
                cmd.select('tmp_acc', 'id %i & %s' % (bridge.acc_id, self.protname))
            cmd.select('Water', 'Water or (id %i & resn HOH)' % bridge.water_id)
            cmd.select('tmp_water', 'id %i & resn HOH' % bridge.water_id)
            cmd.distance('WaterBridges', 'tmp_acc', 'tmp_water')
            cmd.distance('WaterBridges', 'tmp_don', 'tmp_water')
        if self.object_exists('WaterBridges'):
            cmd.set('dash_color', 'lightblue', 'WaterBridges')
        cmd.delete('tmp_water or tmp_acc or tmp_don')
        cmd.color('lightblue', 'Water')
        cmd.show('spheres', 'Water')
1333692
def lte2json(self, filename):
        
        lpins = lattice.LteParser(filename)
        data_json = lpins.file2json()

        latins = lattice.Lattice(lpins.file2json())
        self.lattice_instance = latins
        self.all_beamlines = latins.getAllBl()
        if self.use_beamline is None:
            self.use_beamline = 'BL' if 'BL' in self.all_beamlines else self.all_beamlines[
                0]
        bl_ele_list = [latins.getFullBeamline(k, True)
                       for k in self.all_beamlines]
        self.beamlines_dict = dict(zip(self.all_beamlines, bl_ele_list))

        data_lte = open(filename, 'r').read()
        return data_json, data_lte
281665
def ctcBeamSearch(mat, classes, lm, k, beamWidth):
    

    blankIdx = len(classes)
    maxT, maxC = mat.shape

    # initialise beam state
    last = BeamState()
    labeling = ()
    last.entries[labeling] = BeamEntry()
    last.entries[labeling].prBlank = 1
    last.entries[labeling].prTotal = 1

    # go over all time-steps
    for t in range(maxT):
        curr = BeamState()

        # get beam-labelings of best beams
        bestLabelings = last.sort()[0:beamWidth]

	    # go over best beams
        for labeling in bestLabelings:

	        # probability of paths ending with a non-blank
            prNonBlank = 0
	        # in case of non-empty beam
            if labeling:
		       # probability of paths with repeated last char at the end
                try: 
                    prNonBlank = last.entries[labeling].prNonBlank * mat[t, labeling[-1]]
                except FloatingPointError:
                    prNonBlank = 0

	    # probability of paths ending with a blank
            prBlank = (last.entries[labeling].prTotal) * mat[t, blankIdx]

	    # add beam at current time-step if needed
            addBeam(curr, labeling)

            # fill in data
            curr.entries[labeling].labeling = labeling
            curr.entries[labeling].prNonBlank += prNonBlank
            curr.entries[labeling].prBlank += prBlank
            curr.entries[labeling].prTotal += prBlank + prNonBlank
            curr.entries[labeling].prText = last.entries[labeling].prText # beam-labeling not changed, therefore also LM score unchanged from
            curr.entries[labeling].lmApplied = True # LM already applied at previous time-step for this beam-labeling

            # extend current beam-labeling
            for c in range(maxC - 1):
                # add new char to current beam-labeling
                newLabeling = labeling + (c,)

                # if new labeling contains duplicate char at the end, only consider paths ending with a blank
                if labeling and labeling[-1] == c:
                    prNonBlank = mat[t, c] * last.entries[labeling].prBlank
                else:
                    prNonBlank = mat[t, c] * last.entries[labeling].prTotal

		        # add beam at current time-step if needed
                addBeam(curr, newLabeling)
				
		        # fill in data
                curr.entries[newLabeling].labeling = newLabeling
                curr.entries[newLabeling].prNonBlank += prNonBlank
                curr.entries[newLabeling].prTotal += prNonBlank
				
		        # apply LM
                applyLM(curr.entries[labeling], curr.entries[newLabeling], classes, lm)

        # set new beam state
        last = curr

    # normalise LM scores according to beam-labeling-length
    last.norm()

    # sort by probability
    bestLabelings = last.sort()[:k] # get most probable labeling

    output = []
    for bestLabeling in bestLabelings:
        # map labels to chars
        res = ''
        for l in bestLabeling:
            res += classes[l]
        output.append(res)
    return output
1110294
def parameters(self):
        """"""
        lines = Lines()
        lines.add(0, '@cython.final')
        lines.add(0, 'cdef class Parameters(object):')
        for subpars in self.model.parameters:
            if subpars:
                lines.add(1, 'cdef public %s %s'
                             % (objecttools.classname(subpars), subpars.name))
        for subpars in self.model.parameters:
            if subpars:
                print('        - %s' % subpars.name)
                lines.add(0, '@cython.final')
                lines.add(0, 'cdef class %s(object):'
                             % objecttools.classname(subpars))
                for par in subpars:
                    try:
                        ctype = TYPE2STR[par.TYPE] + NDIM2STR[par.NDIM]
                    except KeyError:
                        ctype = par.TYPE + NDIM2STR[par.NDIM]
                    lines.add(1, 'cdef public %s %s' % (ctype, par.name))
        return lines
765258
def show():
    """"""
    env = get_environment()

    for key, val in sorted(env.env.items(), key=lambda item: item[0]):
        click.secho('%s = %s' % (key, val))
1249841
def show_hbonds(self):
        """"""
        grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model])
        grp.lineWidth = 3
        for i in self.plcomplex.hbonds.ldon_id:
            b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]])
            b.color = self.colorbyname('blue')
            self.bs_res_ids.append(i[0])
        for i in self.plcomplex.hbonds.pdon_id:
            b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]])
            b.color = self.colorbyname('blue')
            self.bs_res_ids.append(i[1])
970553
def display(self):
        
        for line in self.adb_shell('dumpsys display').splitlines():
            m = _DISPLAY_RE.search(line, 0)
            if not m:
                continue
            w = int(m.group('width'))
            h = int(m.group('height'))
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
        else:
            w, h = self.info['displayWidth'], self.info['displayHeight']
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
954764
def list_all(dev: Device):
    """"""
    for name, service in dev.services.items():
        click.echo(click.style("\nService %s" % name, bold=True))
        for method in service.methods:
            click.echo("  %s" % method.name)
114875
function filterTimeseriesesByLine(timeseriesesByLine) {
  const result = [];
  for (const {lineDescriptor, timeserieses} of timeseriesesByLine) {
    const filteredTimeserieses = timeserieses.filter(ts => ts);
    if (filteredTimeserieses.length === 0) continue;
    result.push({lineDescriptor, timeserieses: filteredTimeserieses});
  }
  return result;
}
1306473
def get_curr_lines(self):
        
        start = max(0, self._coord.line - 5)
        end = min(len(self._template_lines), self._coord.line + 4)

        lines = [(x, self._template_lines[x]) for x in six.moves.range(start, end, 1)]
        return self._coord.line, lines
1253345
def modelstandardfunctions(self):
        """"""
        lines = Lines()
        lines.extend(self.doit)
        lines.extend(self.iofunctions)
        lines.extend(self.new2old)
        lines.extend(self.run)
        lines.extend(self.update_inlets)
        lines.extend(self.update_outlets)
        lines.extend(self.update_receivers)
        lines.extend(self.update_senders)
        return lines
369814
def show(ctx, search):
    
    matches = {'aliases': [], 'mappings': [], 'projects': []}
    projects_db = ctx.obj['projects_db']

    matches = get_alias_matches(search, matches)
    matches = get_mapping_matches(search, matches, projects_db)
    matches = get_project_matches(search, matches, projects_db)

    ctx.obj['view'].show_command_results(search, matches, projects_db)
876232
def list(self):
        """"""
        return [self._pos3d.x, self._pos3d.y, self._pos3d.z]