Exemplo n.º 1
0
#comsol_file = "random100_2MHz.npy"
#comsol_file = "random100.npy"
actual_locations = np.load("".join((data_dir, "actual_locations.npy")))[:5]
mic_coordinates = np.array(zip([5, -5, -5, 5], [6, 6, -6, -6]))
dt = 2.5e-6
(times, signal_sets) = comsol.load_data(data_dir, comsol_file, dt=dt)
#signals = signal_sets[8]
for index, signals in enumerate(signal_sets[:5]):
    #for index,signals in enumerate(signal_sets):
    print actual_locations[index]
    distances = np.sqrt(
        np.sum((mic_coordinates - actual_locations[index])**2, axis=1))
    print 'Source-Mic Times:', distances / 2.3e5
    plt.subplot(511 + index)
    #plt.xlim(0,120)
    plot.plot_signals(times * 1e6, signals)
    cwts = mc.signals_to_cwts(times, signals)
    #plot.plot_signals(times*1e6, cwts)
    print order_by_time(times, signals, False)

    #plot.plot_signals(times*1e6, cwts)

    #location_prediction = mc.localize_spark(times, signals, dt=dt)
    #print 'Predicted Location:', location_prediction
plt.tight_layout()
"""
location_prediction = mc.localize_spark(times, signals, dt=dt)
print 'Predicted Location:', location_prediction
"""
"""
damped_signals = np.zeros((np.shape(signals)[0], np.shape(signals)[1]))
Exemplo n.º 2
0
plt.figure(figsize=(12, 9))

lv_directory = "C:\\Users\\plane\\Desktop\\Data\\HPRF\\HPRF 20120605\sparks_29p5MV-M_15Hz\\"
lv_file = "spark_66_68.npz"
(times, raw_signals) = labview.load_data(lv_directory,
                                         lv_file,
                                         t0=221.524e-3,
                                         t1=222.324e-3,
                                         channels=[0, 1, 2])
dt = 1.0e-6
flip_time = 310.e-6
flip_offset = int(round(flip_time / dt))
raw_signals[2, flip_offset:] = -raw_signals[2, flip_offset:]
plt.subplot(311)
plt.ylim((-1.2, 1.2))
plot.plot_signals(times * 1e6, raw_signals, norm=True)  # 22us wavefront delay

data_dir = "C:\\Users\\plane\\Dropbox\\Research\\MTA\\Analysis\\HPRF\\"
if platform.system() == 'Linux':
    data_dir = "/home/lane/Dropbox/Research/MTA/Analysis/HPRF/"

comsol_file = "hpc_wall_shock.npy"
(times, breakdown_signals) = comsol.load_data(data_dir, comsol_file, dt=2.0e-6)
dt = times[1]
plt.subplot(312)
plt.ylim((-1.2, 1.2))
plt.ylabel('Normalized Amplitude')
plot.plot_signals(times * 1e6, breakdown_signals[0],
                  norm=True)  # 22us wavefront delay

comsol_file = "hpc_gas_shock.npy"
Exemplo n.º 3
0
# ## HC Observed vs. Simulated RF Hammer Comparison

# In[ ]:

#get_ipython().magic(u'matplotlib qt')
lv_dir = "C:\\Users\\peter\\Development\\Dissertation\\data\\HC\\"
if platform.system() == 'Linux':
    lv_dir = "/home/lane/Data/HPRF/HPRF 20120614/sparks_36MV-M_15Hz/"
lv_file = "spark_66_68.npz"
(times, real_hammer_signals) = labview.load_data(lv_dir, lv_file, t0=0.029342, t1=0.039342, channels=(0,5,3,))  # channels=(0,5,3,6,))
(frequencies, magnitudes, phases) = psig.spectra(times, real_hammer_signals)
fig = plt.figure(figsize=(20.0, 8.0))
plt.subplot(221)
#plt.xlabel('Time (s)')
plt.ylabel('Normalized Voltage')
plot.plot_signals(times*1e6, real_hammer_signals, tlim=300, ylim=1.5, norm=True)
plt.subplot(222)
#plt.xlabel('Frequency (Hz)')
plt.ylabel('Normalized Magnitude')
plot.plot_signals(frequencies*1e-3, magnitudes, ylim=(0,1.2), tlim=30, norm=True)

comsol_dir = "C:\\Users\\peter\\Development\\Dissertation\\data\\HC\\"
if platform.system() == 'Linux':
    comsol_dir = "/home/lane/Data/COMSOL/HPRF/RF Hammer with Thin Elastic Layer/"
comsol_file = "\S0_TEL_r_1e9_z_21e6_S1_TEL_r_15e6_z_1e9_S5_TEL_r_1e9_z_37e6_10ms.npy"
(times, sim_hammer_signals_set) = comsol.load_data(comsol_dir, comsol_file, dt=2e-6)

sim_hammer_signals = sim_hammer_signals_set[0]
(frequencies, magnitudes, phases) = psig.spectra(times, sim_hammer_signals)
print(psig.peaks(frequencies, magnitudes[2])[:10])
plt.subplot(223)
Exemplo n.º 4
0
lv_file = "spark_66_68.npz"
#(times, raw_signals) = labview.load_data(lv_directory, lv_file,
#(times, raw_signals) = labview.load_data(lv_directory, lv_file, t0=286.401e-3, t1=287.241e-3,
(times, raw_signals) = labview.load_data(lv_directory,
                                         lv_file,
                                         t0=221.524e-3,
                                         t1=222.324e-3,
                                         channels=[0, 1, 2, 3, 4, 5])
#channels=[0,1,2,3,4,5,6])
signals = raw_signals
"""
lv_file = "reduced_53_55.npz"
(times, reduced_signals) = labview.load_data(lv_directory, lv_file, t0=286.401e-3, t1=287.241e-3,
                                             channels=[0,1])
                                             #channels=[0,1,2,3,4,5,6])

hammer_signals = raw_signals - reduced_signals
dt = times[1]
time_shift = 16e-6
offset = int(round(time_shift / dt))
hammer_signals = np.roll(hammer_signals, offset, axis=1)
blank = np.zeros((np.shape(hammer_signals)[0], offset))
hammer_signals[:,:offset] = blank
signals = raw_signals - hammer_signals
"""

plt.xlabel("Time (us)")
plt.ylabel("Amplitude (V)")
plot.plot_signals(times * 1e6, signals, norm=True)
plt.tight_layout()
  """
    """
  dt = times[1] - times[0]
  fc = psig.ricker_center_freq(dt)
  scales = np.linspace(1e3, 50e3, num=50) * (1.0/fc)
  for signal in breakdown_signals:
    cwtmatr = sig.cwt(signal, sig.ricker, scales)
    #plt.imshow(cwtmatr[::-1,:], extent=[times[0]*1e6, times[-1]*1e6, 1, 50])
    max_indicies = np.unravel_index(cwtmatr.argmax(), cwtmatr.shape)
    print 'Peak Frequency:', scales[max_indicies[0]] * fc
    print 'Peak Time:', times[max_indicies[1]]
    cwt = cwtmatr[max_indicies[0]]
    #plt.plot(times, signal)
    #plt.plot(times, np.sum(cwtmatr, axis=0))
  """
    plot.plot_signals(times * 1e6, breakdown_signals)
    #plot.plot_signals(times, wavelet_signals)
    #plot.plot_signals(times, derivatives)

    #new_times, conditioned_signals = mc.condition_signals(times, breakdown_signals)
    #plot.plot_signals(times*1e6, breakdown_signals)
    #plot.plot_signals(upsampled_times*1e6, upsampled_signals)
    #spark_coordinates = np.array(mc.localize_spark(times, breakdown_signals, live=True))
    #plot.plot_signals(times*1e6, breakdown_signals, norm=True)

    location_predictions[index] = np.array(\
    #mc.localize_spark_pp(upsampled_times, upsampled_signals, 1.0, 1.29e5, 40, False))
    #mc.localize_spark_pp(upsampled_times, upsampled_signals, 1.3e5, 1.3e5, 40, False))
    #mc.localize_spark_pp(times, breakdown_signals, 1.0, 1.29e5, 50, False))
    #mc.localize_spark_pp(times, cwts, 1.3e5, 1.3e5, 100, False))
    #mc.localize_spark_pp(times, wavelet_signals, 1.3e5, 1.3e5, 60, False))
    mpl.rcParams['xtick.labelsize'] = 22
    mpl.rcParams['axes.labelsize'] = 26
    mpl.rcParams['font.size'] = 26
    mpl.rcParams['mathtext.default'] = 'regular'
    mpl.rcParams['figure.subplot.left'] = 0.02
    mpl.rcParams['figure.subplot.right'] = 0.98
    mpl.rcParams['figure.subplot.top'] = 0.9
    mpl.rcParams['figure.subplot.bottom'] = 0.1
    mpl.rcParams['figure.subplot.wspace'] = 0.2
    mpl.rcParams['figure.subplot.hspace'] = 0.2


reset_plot_params()

data_dir = "C:\\Users\\plane\\Dropbox\\Research\\MTA\\Analysis\\HPRF\\"
if platform.system() == 'Linux':
    data_dir = "/home/lane/Dropbox/Research/MTA/Analysis/HPRF/"

comsol_file = "hpc_wall_shock.npy"
(times, breakdown_signals) = comsol.load_data(data_dir, comsol_file, dt=2.0e-6)
plt.figure(figsize=(12, 9))
plt.subplot(211)
plt.ylim((-4, 4))
plot.plot_signals(times * 1e6, breakdown_signals[0])  # 22us wavefront delay

comsol_file = "hpc_dual_shock.npy"
(times, breakdown_signals) = comsol.load_data(data_dir, comsol_file, dt=2.0e-6)
plt.subplot(212)
plot.plot_signals(times * 1e6, breakdown_signals[0])  # 22us wavefront delay

plt.tight_layout()
Exemplo n.º 7
0
plt.figure(figsize=(12, 9))

lv_directory = "C:\\Users\\plane\\Desktop\\Data\\HPRF\\HPRF 20120605\sparks_29p5MV-M_15Hz\\"
lv_file = "spark_66_68.npz"
(times, raw_signals) = labview.load_data(lv_directory,
                                         lv_file,
                                         t0=221.324e-3,
                                         t1=222.524e-3,
                                         channels=[0, 1, 2, 6])
dt = 2.0e-6
flip_time = 310.e-6
flip_offset = int(round(flip_time / dt))
raw_signals[2, flip_offset:] = -raw_signals[2, flip_offset:]
plt.subplot(211)
plt.ylim((-1.2, 1.2))
plot.plot_signals(times * 1e6, raw_signals, norm=True)  # 22us wavefront delay

data_dir = "C:\\Users\\plane\\Dropbox\\Research\\MTA\\Analysis\\HPRF\\"
if platform.system() == 'Linux':
    data_dir = "/home/lane/Dropbox/Research/MTA/Analysis/HPRF/"
"""
comsol_file = "hpc_wall_shock.npy"
(times, breakdown_signals) = comsol.load_data(data_dir, comsol_file, dt=2.0e-6)
dt = times[1]
plt.subplot(212)
plt.ylim((-1.2,1.2))
plt.ylabel('Normalized Amplitude')
plot.plot_signals(times*1e6, breakdown_signals[0], norm=True)  # 22us wavefront delay
"""

plt.tight_layout()
                                 lv_file,
                                 t0=30e-6,
                                 t1=430e-6,
                                 channels=[
                                     6,
                                 ])
times = times * 1e6

fig = plt.figure(figsize=(16.0, 8.0))
#fig.text(0.5, 0.05, r'Time ($ms$)', ha='center', va='center', size=26)
fig.text(0.02,
         0.5,
         r'Amplitude ($V$)',
         ha='center',
         va='center',
         size=26,
         rotation='vertical')
plt.subplot(311)
plt.ylim(-1.8, 1.8)
plot.plot_signals(times, avg_hammer)

plt.subplot(312)
plt.ylim(-1.8, 1.8)
plot.plot_signals(times, spark + avg_hammer)

plt.subplot(313)
plt.xlabel('Time ($\mu s$)')
plt.ylim(-1.8, 1.8)
plot.plot_signals(times, spark)
plt.tight_layout()
Exemplo n.º 9
0
import pgl.tektronix as tektronix
import pgl.mc as mc
import pgl.progress as prog
import pgl.cluster as clust
import pgl.hpc as hpc


def reset_plot_params():
    mpl.rcParams['ytick.labelsize'] = 22
    mpl.rcParams['xtick.labelsize'] = 22
    mpl.rcParams['axes.labelsize'] = 26
    mpl.rcParams['font.size'] = 26
    mpl.rcParams['mathtext.default'] = 'regular'
    mpl.rcParams['figure.subplot.left'] = 0.02
    mpl.rcParams['figure.subplot.right'] = 0.98
    mpl.rcParams['figure.subplot.top'] = 0.9
    mpl.rcParams['figure.subplot.bottom'] = 0.1
    mpl.rcParams['figure.subplot.wspace'] = 0.2
    mpl.rcParams['figure.subplot.hspace'] = 0.2


reset_plot_params()

directory = 'C:/Users/plane/Dropbox/Research/MTA/Analysis/AMC/'
filename = 'al_disk_spring_foundation.npy'
(times, signals) = comsol.load_data(directory, filename, dt=25e-6)
plt.xlabel('Time (ms)')
plt.ylabel('Norm. Acceleration (m/s)')
plot.plot_signals(times * 1e3, signals[0], norm=True)
plt.tight_layout()