예제 #1
0
def get_env(proj_str, source_freq):
    env_builder = factory.create('swellex')
    env = env_builder()
    zr = get_proj_zr(proj_str)
    zs = get_proj_zs(proj_str)
    dz, dr, zmax = 10, 20, 216.5
    folder, fname = 'at_files/', 'swell'
    env.add_source_params(source_freq, zr, zr)
    env.add_field_params(dz, zmax, dr, rmax)
    return env
예제 #2
0
def get_env():
    env_builder = factory.create('swellex')
    env = env_builder()
    source_freq = 100
    dz = 5
    zmax = 216.5
    dr = 25
    rmax = 1e4
    num_rcvrs = 21
    zr = np.linspace(100, 200, num_rcvrs)
    folder, fname = 'at_files/', 'simple'
    env.add_source_params(source_freq, zr, zr)
    env.add_field_params(dz, zmax, dr, rmax)
    return env
예제 #3
0
def array_analysis(freq):
    num_rcvrs = 20
    zr = np.linspace(100, 200, num_rcvrs)
    zs = 50

    dz = 5
    zmax = 216.5
    dr = 50
    rmax = 1e4

    env_builder = factory.create('swellex')
    env = env_builder()
    folder = 'at_files/'
    fname = 'simple'
    env.add_source_params(freq, zs, zr)
    env.add_field_params(dz, zmax, dr, rmax)
    p, pos = env.run_model('kraken',
                           folder,
                           fname,
                           zr_flag=True,
                           zr_range_flag=False)
    modes = read_modes(**{'freq': freq, 'fname': folder + fname + '.mod'})
    r1 = 6 * 1e3
    delta_r = np.linspace(0, 150, 30)
    p_r1 = get_array_p(modes, r1)
    p_r1 /= abs(p_r1)
    P_vals = []
    for dr in delta_r:
        p_tmp = get_array_p(modes, r1 + dr)
        p_tmp /= abs(p_tmp)
        print(p_tmp.shape, p_r1.shape)
        P = abs(p_r1.conj().T @ p_tmp)
        #plt.scatter(dr, abs(P))
        P_vals.append(P)
    print(np.mean(modes.k.real))
    #plt.plot(delta_r, np.mean(modes.k.real)*delta_r)
    P_vals = np.array(P_vals)
    P_vals /= np.max(P_vals)
    P_vals = 10 * np.log10(P_vals)
    plt.scatter(delta_r, P_vals)
    plt.ylim([np.min(P_vals), np.max(P_vals)])
    plt.xlabel('Range error (m)')
    plt.ylabel('Magnitude of Bartlett processor (dB)')
    plt.suptitle('Sensitivity of array to range errors. \nArray has ' +
                 str(num_rcvrs) + ' elements spaced from ' + str(np.min(zr)) +
                 ' to ' + str(np.max(zr)) + ' m depth\nSource is at ' +
                 str(zs) + ' m depth.')
    plt.show()
예제 #4
0
def single_sensor_analysis(freq):
    num_rcvrs = 1
    zr = 70
    zs = 50

    dz = 5
    zmax = 216.5
    dr = 50
    rmax = 1e4

    env_builder = factory.create('swellex')
    env = env_builder()
    folder = 'at_files/'
    fname = 'simple'
    env.add_source_params(freq, zs, zr)
    env.add_field_params(dz, zmax, dr, rmax)
    p, pos = env.run_model('kraken',
                           folder,
                           fname,
                           zr_flag=True,
                           zr_range_flag=False)
    modes = read_modes(**{'freq': freq, 'fname': folder + fname + '.mod'})
    r1 = 6 * 1e3
    delta_r = np.linspace(0, 10, 30)
    p_r1 = get_p(modes, r1)
    p_r1 /= abs(p_r1)
    P_vals = []
    for dr in delta_r:
        p_tmp = get_p(modes, r1 + dr)
        p_tmp /= abs(p_tmp)
        P = p_r1.conj() * p_tmp
        plt.scatter(dr, np.angle(p_tmp))
        P_vals.append(P)
    print(np.mean(modes.k.real))
    plt.plot(delta_r, np.mean(modes.k.real) * delta_r)
    P_vals = np.array(P_vals)
    plt.show()
예제 #5
0
    freq = 50
    num_rcvrs = 25
    zr = np.linspace(50, 200, num_rcvrs)  # array depths
    zs = 50  # source depth

    r0 = 5 * 1e3  # initial source range
    ship_v = 5  # m/s
    T = 10  # time between snapshots in synth array
    ship_dr = ship_v * T
    num_synth_els = 10

    dz = 5
    zmax = 216.5
    dr = 50
    rmax = 1e4
    env_builder = factory.create('swellex')
    env = env_builder()
    folder = 'at_files/'
    fname = 'simple'
    env.add_source_params(freq, zs, zr)
    env.add_field_params(dz, zmax, dr, rmax)

    true_r, synth_data, synth_p_true, pos = gen_synth_data(
        env, num_synth_els, r0, ship_dr, folder, fname)

    p_true = synth_p_true[:zr.size]
    p_true /= np.linalg.norm(p_true)
    K_true = np.outer(p_true, p_true.conj())
    synth_replica, rep_pos = get_v_replicas(ship_v, T, env, folder, fname,
                                            num_synth_els, dz, zmax, rmax)
예제 #6
0
파일: test.py 프로젝트: hunterakins/pyat
import numpy as np
from matplotlib import pyplot as plt
from env.env.envs import factory
from pyat.pyat.env import Beam, Box
from pyat.pyat.readwrite import read_arrivals_asc_alt, read_shd, plotray
'''
Description:

Author: Hunter Akins
'''

builder = factory.create('deepwater')
dw_env = builder()

freq = 1400
zs = 500
zr = np.linspace(0, 5000, 20)
dz = 20
zmax = 5000
dr = 1
rmax = 100 * 1e3

dw_env.add_source_params(freq, zs, zr)
dw_env.add_field_params(dz, zmax, dr, rmax)

folder = 'at_files/'
fname = 'dw'
"""
Ray trace
"""
run_type = 'R'