예제 #1
0
  def on_r_mouth_change(self, text):
      if len(text) != 0:
        try:
          self.r_mouth = float(text)
        except:
          raise ValueError('Input must be a float') 

        name = 'r_mouth'
        unit = self.controls_dict[name][4]
        conversion = self.controls_dict[name][5]
        label_text = (name + ' (' + str(self.r_mouth * conversion) + 
        ' ' + unit + ')')
        self.controls_dict[name][1].setText(label_text)
        if self.r_mouth == 0:
          self.s = j*np.zeros(self.nm)+np.array([(2*n+1)*pi/2 for n in range(self.nm)])
        else:
          self.s = cp.calc_spatial_evs(r_mouth=self.r_mouth/L, nm=self.nm, 
            num_seeds=500, max_x=20, max_y=2)

        self.pbar.setValue(0)
예제 #2
0
  def on_nm_change(self, text):
    if len(text) != 0:
      try:
        self.nm = int(text)
      except:
        raise ValueError('Input must be an integer')

    name = 'nm'
    unit = self.controls_dict[name][4]
    conversion = self.controls_dict[name][5]
    label_text = (name + ' (' + str(self.nm * conversion) + 
    ' ' + unit + ')')
    self.controls_dict[name][1].setText(label_text)
    if self.nm != 0:
      self.q0 = np.zeros(2*self.nm+3)
      self.q0[1] = 1
      #self.q0 = fp1 + 1e-12 * abs(np.random.rand(2*self.nm+1))
      self.s = cp.calc_spatial_evs(r_mouth=self.r_mouth/L, nm=self.nm, 
      num_seeds=300, max_x=20, max_y=2)
      
    self.pbar.setValue(0)
예제 #3
0
  def set_defaults(self):
      self.page = 1

      self.nm = 3
      self.r_mouth = 0.001
      self.omega_d = pi / 2
      self.Gamma = 1e-4

      self.p = 0.015
      self.r_folds = 0.002
      self.r_back = 0.002

      self.fs = 3. #time sampling frequency
      self.T = 500. #total time
      self.t = np.arange(0, self.T, 1/self.fs)
      self.t1 = 0 
      self.t2 = len(self.t)
      self.s = cp.calc_spatial_evs(r_mouth=self.r_mouth/L, nm=self.nm, 
          num_seeds=500, max_x=20, max_y=2)
      self.params = cp.calc_parameters(self.p, self.r_folds, self.r_folds, 
        self.omega_d, self.Gamma, self.s.imag, self.s.real, self.nm)
      fp1, fp2 = calc_fixed_points(self.params)
예제 #4
0
    cubic = (0.5 * B * gamma ** 2 / mu ** 2 * q[:, 0] ** 3).T

    A.shape = (nm,)
    B.shape = (nm,)

    return (radiation, shedding, vocal_fold_friction, dissipation, elastic, linear, quadratic, cubic)


if __name__ == "__main__":
    nm = 3
    p = 0.01
    r_front = 0.002
    r_back = 0.002
    r_mouth = 0.00001
    zeta = 0
    s = cp.calc_spatial_evs(r_mouth=r_mouth / L, nm=nm, num_seeds=100, max_x=20, max_y=3)
    params = cp.calc_parameters(p, r_front, r_back, s.imag, s.real, nm, zeta)
    nm, p, mu, gamma, zeta, alpha, omega, beta, A, B, M = params
    fs = 10.0  # time sampling frequency
    T = 1000.0  # total time
    t = np.arange(0, T, 1 / fs)
    fp1, fp2 = calc_fixed_points(params)
    # q0 = fp1 + 1e-3 * abs(np.random.rand(2*nm+1))
    q0 = np.zeros(2 * nm + 1)
    q = integrate.odeint(flow, q0, t, args=(params,))
    radiation = np.dot(M, (beta * q[:, nm + 1 :]).T).T
    elastic = np.dot(M, ((omega ** 2 - alpha ** 2) * (q[:, 1 : nm + 1])).T).T
    B.shape = (nm, 1)
    A.shape = (nm, 1)
    shedding = (B * gamma / mu ** 2 * q[:, 0] * sum(q[:, nm + 1 :], 1)).T
    vocal_fold_friction = (B * zeta / mu ** 2 * sum(q[:, nm + 1 :], 1)).T