Count how many times each individual salt bridge occured throughout the simulation.
        Returns numpy array.
359851
def count_by_type(self):
        """"""
        saltbridges = defaultdict(int)
        for contact in self.timeseries:
            #count by residue name not by proteinring
            pkey = (contact.ligandatomid,contact.ligandatomname, contact.resid,contact.resname,contact.segid)
            saltbridges[pkey]+=1
        dtype = [("ligand_atom_id",int),("ligand_atom_name","|U4"),("resid",int),("resname","|U4"),("segid","|U8"),("frequency",float) ]
        out = np.empty((len(saltbridges),),dtype=dtype)
        tsteps = float(len(self.timesteps))
        for cursor,(key,count) in enumerate(saltbridges.iteritems()):
            out[cursor] = key + (count / tsteps,)
        return out.view(np.recarray)
724751
def _multiplyThroughputs(self):
        ''' 
        '''
        index = 0
        for component in self.components:
            if component.throughput != None:
                break
            index += 1

        return BaseObservationMode._multiplyThroughputs(self, index)
1133216
def gen_salt
      chars = []
      8.times { chars << SALT_CHARS[SecureRandom.random_number(SALT_CHARS.size)] }
      chars.join('')
    end
1025021
private static int countleaps( double gpsTime, boolean accum_leaps ) {
        int i, nleaps;
        double[] leaps = getleaps();
        nleaps = 0;

        if (accum_leaps) {
            for( i = 0; i < leaps.length; i += 1 ) {
                if (gpsTime + i >= leaps[i]) {
                    nleaps += 1;
                }
            }
        } else {
            for( i = 0; i < leaps.length; i += 1 ) {
                if (gpsTime >= leaps[i]) {
                    nleaps += 1;
                }
            }
        }
        return nleaps;
    }
1035181
def get_counts(self):
        """"""

        hbondsback = len([hb for hb in self.hbonds if not hb.sidechain])
        counts = {'hydrophobics': len(self.hydrophobics), 'hbonds': len(self.hbonds),
                  'wbridges': len(self.wbridges), 'sbridges': len(self.sbridges), 'pistacks': len(self.pi_stacks),
                  'pications': len(self.pi_cations), 'halogens': len(self.halogens), 'metal': len(self.metal_complexes),
                  'hbond_back': hbondsback, 'hbond_nonback': (len(self.hbonds) - hbondsback)}
        counts['total'] = counts['hydrophobics'] + counts['hbonds'] + counts['wbridges'] + \
            counts['sbridges'] + counts['pistacks'] + counts['pications'] + counts['halogens'] + counts['metal']
        return counts
466961
def even_mults(start:float, stop:float, n:int)->np.ndarray:
    ""
    mult = stop/start
    step = mult**(1/(n-1))
    return np.array([start*(step**i) for i in range(n)])
811449
def spanning_tree_count(graph: nx.Graph) -> int:
    
    laplacian = nx.laplacian_matrix(graph).toarray()
    comatrix = laplacian[:-1, :-1]
    det = np.linalg.det(comatrix)
    count = int(round(det))
    return count
823969
def get_recurrence(self, config):
        '''
        
        '''
        model = MFD_MAP[config['Model_Name']]()
        model.setUp(config)
        model.get_mmax(config, self.msr, self.rake, self.area)
        model.mmax = model.mmax + (self.msr_sigma * model.mmax_sigma)
        # As the Anderson & Luco arbitrary model requires the input of the
        # displacement to length ratio

        if 'AndersonLucoAreaMmax' in config['Model_Name']:
            if not self.disp_length_ratio:
                # If not defined then default to 1.25E-5
                self.disp_length_ratio = 1.25E-5
            min_mag, bin_width, occur_rates = model.get_mfd(
                self.slip,
                self.area, self.shear_modulus, self.disp_length_ratio)

        else:
            min_mag, bin_width, occur_rates = model.get_mfd(self.slip,
                                                            self.area,
                                                            self.shear_modulus)

        self.recurrence = IncrementalMFD(min_mag, bin_width, occur_rates)
        self.magnitudes = min_mag + np.cumsum(
            bin_width *
            np.ones(len(occur_rates), dtype=float)) - bin_width
        self.max_mag = np.max(self.magnitudes)
291422
def get_events_by_ses(self, events, num_ses):
        
        numpy.random.seed(self.serial)
        sess = numpy.random.choice(num_ses, len(events)) + 1
        events_by_ses = collections.defaultdict(list)
        for ses, event in zip(sess, events):
            events_by_ses[ses].append(event)
        for ses in events_by_ses:
            events_by_ses[ses] = numpy.array(events_by_ses[ses])
        return events_by_ses
1074609
def count(self):
        
        return (
            self
            .mapPartitions(lambda p: [sum(1 for _ in p)])
            .reduce(operator.add)
        )
175253
def replay_counters(buffer)
      buffer.each { |k, v| counter(k[0], v, k[1]) }
    end
493462
def number_of_states(dtrajs):
    
    """
    # determine number of states n
    nmax = 0
    for dtraj in dtrajs:
        nmax = max(nmax, np.max(dtraj))
    # return number of states
    return nmax + 1
1052791
def count(self):
        
        ids, _, ngroups = self.grouper.group_info
        val = self.obj.get_values()

        mask = (ids != -1) & ~isna(val)
        ids = ensure_platform_int(ids)
        minlength = ngroups or 0
        out = np.bincount(ids[mask], minlength=minlength)

        return Series(out,
                      index=self.grouper.result_index,
                      name=self._selection_name,
                      dtype='int64')
445202
def get_number_of_particles():
    
    with open('dynac.short') as f:
        data_str = ''.join(line for line in f.readlines())
        num_of_parts = int(data_str.split('Simulation with')[1].strip().split()[0])
    return num_of_parts
1201872
def failure_count(self):
        
        return len([i for i, result in enumerate(self.data) if result.failure])
171775
def count_ruptures(self):
        
        return (len(self.get_annual_occurrence_rates()) *
                len(self.nodal_plane_distribution.data) *
                len(self.hypocenter_distribution.data))
406127
def count(self):
        
        count = 0
        operation = self._get_operation()
        kwargs = self.kwargs.copy()
        kwargs['select'] = 'COUNT'
        limit = kwargs.get('limit', None)
        while True:
            result = operation(self.model.get_table_name(), **kwargs)
            count += result['Count']
            if limit is not None:
                limit -= result['Count']

            last_evaluated_key = result.get('LastEvaluatedKey', None)
            if not self._prepare_next_fetch(kwargs, last_evaluated_key, limit):
                break
        return count