Example #1
0
def freqs_maxPSD(freq, fq, network, Oorb=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))

  maxs, mins = nm_s.find_freq_peaks(freq, fq, delta=0, __sort=True)

  modes = {}
  for modeNo in mode_nums:
    fit = maxs[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
Example #2
0
#
#
#                                frequency domain
#
#
####################################################################################################
if freq_domain:
  if opts.verbose: print "loading freq-domain data from %s" % opts.freqfilename
  freq, fq, N_m = nm_u.load_out(opts.freqfilename, tmin=opts.fmin, tmax=opts.fmax, downsample=opts.fdownsample)

  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