コード例 #1
0
ファイル: prune_network.py プロジェクト: reedessick/nmodelte
def freqs_lorentzian(freq, fq, network, Oorb=False, rtol=1e-8, max_iters=100, bw=0, n_lowpass=False, mode_nums=None):
  """
  selects modes using the frequency data (freq, fq) and returns a list of modes

  modes = [(f, (n,l,m,w,y,U)), ...]

  if Oorb, we assume that freq contains (O/Oorb) data, and we convert it back to O [rad/sec] by multiplying by Oorb
  """
  if not mode_nums:
    mode_nums = range(len(network))

  fit_params, fit_params_covar = nm_s.fit_peaks_lorentzian(freq, fq, max_iters=50, verbose=True)

  modes = {}
  for modeNo in mode_nums:
    fit = fit_params[modeNo]
    if len(fit) == 0:
      raise StandardError, "No frequency peak detected for modeNo=%d" % modeNo
    f,_,_ = fit[0]

    if Oorb:
      f = f*Oorb

    if (min_w <= f) and (f <= max_w):
      modes[modeNo] = f

  return modes
コード例 #2
0
ファイル: nmode_s.py プロジェクト: reedessick/nmodelte
  if not len(freq):
    raise ValueError, "no data loaded from ", opts.freqfilename

  if opts.freq_peaks:
    if opts.verbose: print "finding peak frequencies by closest point in the FFT"
    x, _ = nm_s.find_freq_peaks(freq, fq, delta=0, __sort=True)
    freq_maxs=[]
    for A in x:
      try:
        freq_maxs.append( [A[0]] )
      except IndexError:
        freq_maxs.append( [] )

  if opts.freq_peaks_fit:
    if opts.verbose: print "fitting lorentizians to the peak frequencies in the FFT"
    fit_params, fit_params_covar = nm_s.fit_peaks_lorentzian(freq, fq, max_iters=opts.max_freqfit_iters, delta=0, rtol=opts.freqfit_rtol, verbose=opts.freq_peaks_verbose)

####################################################################################################
#
#
#                                 analytics
#
#
####################################################################################################
if opts.analytics:
  if not opts.freq_peaks:
    if opts.verbose: print "finding peak freuqencies by closest point in the FFT"
    freq_maxs, freq_mins = nm_s.find_freq_peaks(freq, fq, delta=0, __sort=True)

  if opts.verbose: print "computing the most unstable pairings using observed frequencies"
  freqs = []