Return the number of frames that will be used for a signal with the length of ``num_samples``.
341266
def num_frames(self, num_samples):
        
        return math.ceil(float(max(num_samples - self.frame_size, 0)) / float(self.hop_size)) + 1
737744
def _get_samples(n, sim, inc_warmup=True):
    # NOTE: this is in stanfit-class.R in RStan (rather than misc.R)
    
    return pystan._misc.get_samples(n, sim, inc_warmup)
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
409542
def get_frame(self, index):
        ''' 
        '''

        frame_num = self.frame_index[index]
        onset = float(frame_num) / self.fps

        if index < self.n_frames - 1:
            next_frame_num = self.frame_index[index + 1]
            end = float(next_frame_num) / self.fps
        else:
            end = float(self.duration)

        duration = end - onset if end > onset else 0.0

        return VideoFrameStim(self, frame_num,
                              data=self.clip.get_frame(onset),
                              duration=duration)
1011947
def getCameraFrameSize(self, nDeviceIndex, eFrameType):
        """"""

        fn = self.function_table.getCameraFrameSize
        pnWidth = c_uint32()
        pnHeight = c_uint32()
        pnFrameBufferSize = c_uint32()
        result = fn(nDeviceIndex, eFrameType, byref(pnWidth), byref(pnHeight), byref(pnFrameBufferSize))
        return result, pnWidth.value, pnHeight.value, pnFrameBufferSize.value
637192
def get_sample(self, dest_addr_long=None):
        
        frame = self._send_and_wait(
            command=b"IS", dest_addr_long=dest_addr_long)
        if "parameter" in frame:
            # @TODO: Is there always one value? Is it always a list?
            return frame["parameter"][0]
        return {}
121649
def predict_f_samples(self, Xnew, num_samples):
        
        mu, var = self._build_predict(Xnew, full_cov=True)  # N x P, # P x N x N
        jitter = tf.eye(tf.shape(mu)[0], dtype=settings.float_type) * settings.jitter
        samples = []
        for i in range(self.num_latent):
            L = tf.cholesky(var[i, :, :] + jitter)
            shape = tf.stack([tf.shape(L)[0], num_samples])
            V = tf.random_normal(shape, dtype=settings.float_type)
            samples.append(mu[:, i:i + 1] + tf.matmul(L, V))
        return tf.transpose(tf.stack(samples))
431469
def sample(self, num):
        
        if num > len(self):
            return self.copy()
        elif num < 0:
            raise IndexError("Cannot sample a negative number of rows "
                             "from a DataTable")

        random_row_mask = ([True] * num) + ([False] * (len(self) - num))
        shuffle(random_row_mask)

        sampled_table = self.mask(random_row_mask)
        random_col_name = 'random_sorting_column'
        while random_col_name in sampled_table:
            random_col_name = '%030x' % randrange(16**30)
        sampled_table[random_col_name] = [random()
                                          for _ in xrange(len(sampled_table))]
        sampled_table.sort(random_col_name, inplace=True)
        del sampled_table[random_col_name]
        return sampled_table
1295842
def next_frame_sampling_stochastic():
  """"""
  hparams = basic_deterministic_params.next_frame_sampling()
  hparams.stochastic_model = True
  hparams.add_hparam("latent_channels", 1)
  hparams.add_hparam("latent_std_min", -5.0)
  hparams.add_hparam("num_iterations_1st_stage", 15000)
  hparams.add_hparam("num_iterations_2nd_stage", 15000)
  hparams.add_hparam("latent_loss_multiplier", 1e-3)
  hparams.add_hparam("latent_loss_multiplier_dynamic", False)
  hparams.add_hparam("latent_loss_multiplier_alpha", 1e-5)
  hparams.add_hparam("latent_loss_multiplier_epsilon", 1.0)
  hparams.add_hparam("latent_loss_multiplier_schedule", "constant")
  hparams.add_hparam("latent_num_frames", 0)  # 0 means use all frames.
  hparams.add_hparam("anneal_end", 40000)
  hparams.add_hparam("information_capacity", 0.0)
  return hparams
802123
public int calculate_framesize()
	{

	 if (h_layer == 1)
	 {
	   framesize = (12 * bitrates[h_version][0][h_bitrate_index]) /
	               frequencies[h_version][h_sample_frequency];
	   if (h_padding_bit != 0 ) framesize++;
	   framesize <<= 2;		// one slot is 4 bytes long
	   nSlots = 0;
	 }
	 else
	 {
	   framesize = (144 * bitrates[h_version][h_layer - 1][h_bitrate_index]) /
	               frequencies[h_version][h_sample_frequency];
	   if (h_version == MPEG2_LSF || h_version == MPEG25_LSF) framesize >>= 1;	// SZD
	   if (h_padding_bit != 0) framesize++;
	   // Layer III slots
	   if (h_layer == 3)
	   {
	     if (h_version == MPEG1)
	     {
	  		 nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 17 : 32) // side info size
	  								  -  ((h_protection_bit!=0) ? 0 : 2) 		       // CRC size
	  								  - 4; 								             // header size
	     }
	     else
		 {  // MPEG-2 LSF, SZD: MPEG-2.5 LSF
	        nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ?  9 : 17) // side info size
	  					   		  -  ((h_protection_bit!=0) ? 0 : 2) 		       // CRC size
	  								  - 4; 								             // header size
	     }
	   }
	   else
	   {
	  	 nSlots = 0;
	   }
	 }
	 framesize -= 4;             // subtract header size
	 return framesize;
	}
319172
def num_samples(self, dataset_split):
    
    return {
        problem.DatasetSplit.TRAIN: 1000000,
        problem.DatasetSplit.EVAL: 10000,
        problem.DatasetSplit.TEST: 10000
    }[dataset_split]
1255955
function consume (len) {
		count -= len
		if (count < 0) {
			count = 0;
			console.warn('Not enough samples fed for the next data frame. Expected frame is ' + samplesPerFrame + ' samples ' + channels + ' channels')
		}

		if (!callbackMarks.length) return

		for (let i = 0, l = callbackMarks.length; i < l; i++) {
			callbackMarks[i] = Math.max(callbackMarks[i] - len, 0)
		}

		while (callbackMarks[0] <= 0) {
			callbackMarks.shift()
			let cb = callbackQueue.shift()
			cb()
		}
	}
1083705
private int getFrame(long pos) {
        int sample = 1;
        int len = frames.size();
        MP4Frame frame = null;
        for (int f = 0; f < len; f++) {
            frame = frames.get(f);
            if (pos == frame.getOffset()) {
                sample = f;
                break;
            }
        }
        return sample;
    }
825104
def timescales_samples(self):
         """
        res = np.empty((self.nsamples, self.nstates-1), dtype=config.dtype)
        for i in range(self.nsamples):
            res[i, :] = self._sampled_hmms[i].timescales
        return res
346973
def size(self, destination):
        
        if not destination in self.queue_metadata:
            return 0
        else:
            return len(self.queue_metadata[destination]['frames'])
803872
def time_bins(header):
  '''
  
  '''
  return np.arange(header['number_of_half_frames'], dtype=np.float64)*constants.bins_per_half_frame\
  *(1.0 - header['over_sampling']) / header['subband_spacing_hz']
333222
def num_examples(self):
        """"""
        if self.is_list:
            return len(self.list_or_slice)
        else:
            start, stop, step = self.slice_to_numerical_args(
                self.list_or_slice, self.original_num_examples)
            return stop - start