コード例 #1
0
def run_scanning_simulation(radar_ctrl):

    p = Profiler()
    radar_ctrl.profiler = p

    p.start('total')
    scheduler = ObservedScanning(
        radar=eiscat3d,
        controllers=[radar_ctrl],
        logger=logger,
        profiler=p,
    )

    p.start('equidistant_sampling')
    t = sorts.equidistant_sampling(
        orbit=obj.state,
        start_t=0,
        end_t=end_t,
        max_dpos=1e3,
    )
    p.stop('equidistant_sampling')

    print(f'Temporal points obj: {len(t)}')

    p.start('get_state')
    states = obj.get_state(t)
    p.stop('get_state')

    p.start('find_passes')
    #rename cache_data to something more descriptive
    passes = eiscat3d.find_passes(t, states, cache_data=True)
    p.stop('find_passes')

    p.start('observe_passes')
    data = scheduler.observe_passes(passes, space_object=obj, snr_limit=False)
    p.stop('observe_passes')

    for psi in data:
        for txps in psi:
            for rxtxps in txps:
                print(f'Max SNR={10*np.log10(rxtxps["snr"].max())} dB')

    p.stop('total')
    print(f'\n {radar_ctrl.__class__}: len(t) = {len(radar_ctrl.t)} \n')
    print(p.fmt(normalize='total'))
コード例 #2
0
def observe_objects(objs, controllers, end_t=600.0, dt=10.0, verbose=True):

    p = Profiler()

    class ObservedScanning(StaticList, ObservedParameters):
        pass

    #set radar
    for ctrl in controllers:
        ctrl.radar = eiscat3d
        ctrl.profiler = p
        ctrl.logger = logger

    p.start('total')
    scheduler = ObservedScanning(
        radar=eiscat3d,
        controllers=controllers,
        logger=logger,
        profiler=p,
    )

    t = np.arange(0, end_t, dt)

    if verbose:
        for obj in objs:
            print(obj)

    datas = []
    passes = []
    states = []
    for ind in range(len(objs)):

        p.start('get_state')
        states += [objs[ind].get_state(t)]
        p.stop('get_state')

        p.start('find_passes')
        passes += [eiscat3d.find_passes(t, states[ind], cache_data=True)]
        p.stop('find_passes')

        p.start('observe_passes')
        data = scheduler.observe_passes(passes[ind],
                                        space_object=objs[ind],
                                        snr_limit=False)
        p.stop('observe_passes')

        datas.append(data)

    p.stop('total')
    if verbose:
        print(p.fmt(normalize='total'))

    return {'t': t, 'observations': datas, 'passes': passes, 'states': states}
コード例 #3
0
                  e=0.1,
                  i=75,
                  omega=0,
                  Omega=79,
                  anom=72,
                  epoch=53005.0)
print(orb)

p.start('equidistant_sampling')
t = sorts.equidistant_sampling(
    orbit=orb,
    start_t=0,
    end_t=3600 * 24 * 1,
    max_dpos=1e4,
)
p.stop('equidistant_sampling')

print(f'Temporal points: {len(t)}')

p.start('propagate')

states = prop.propagate(t,
                        orb.cartesian[:, 0],
                        orb.epoch,
                        A=1.0,
                        C_R=1.0,
                        C_D=1.0)
p.stop('propagate')

# fig = plt.figure(figsize=(15,15))
# ax = fig.add_subplot(111, projection='3d')
コード例 #4
0
ファイル: observing_passes.py プロジェクト: danielk333/SORTS
sched_data = scheduler.schedule()

rx_head = [
    f'rx{i} {co}' for i in range(len(scheduler.radar.rx))
    for co in ['az', 'el']
]
sched_tab = tabulate(sched_data,
                     headers=["t [s]"] + rx_head + ['Controller', 'Target'])

print(sched_tab)

p.start('total')
data0 = scheduler.observe_passes(passes0,
                                 space_object=objs[0],
                                 snr_limit=False)
p.stop('total')
print(p.fmt(normalize='total'))

data1 = scheduler.observe_passes(passes1,
                                 space_object=objs[1],
                                 snr_limit=False)

#create a tdm file example
# pth = pathlib.Path(__file__).parent / 'data' / 'test_tdm.tdm'
# print(f'Writing TDM data to: {pth}')

# dat = data0[0][0][0]
# sorts.io.write_tdm(
#     pth,
#     dat['t'],
#     dat['range'],
コード例 #5
0
    logger=logger,
    profiler=p,
)

t = np.arange(0.0, end_t, 30.0)

datas = []
passes = []
states = []
for ind in range(len(objs)):

    print(f'Temporal points obj {ind}: {len(t)}')

    p.start('get_state')
    states += [objs[ind].get_state(t)]
    p.stop('get_state')

    interpolator = Legendre8(states[ind], t)

    p.start('find_passes')
    #rename cache_data to something more descriptive
    passes += [eiscat3d.find_passes(t, states[ind], cache_data=False)]
    p.stop('find_passes')

    p.start('observe_passes')
    data = scheduler.observe_passes(passes[ind],
                                    space_object=objs[ind],
                                    interpolator=None,
                                    snr_limit=False)
    p.stop('observe_passes')
コード例 #6
0
    logger=logger,
    profiler=p,
)

datas = []
passes = []
states = []
for ind in range(len(objs)):
    p.start('equidistant_sampling')
    t = sorts.equidistant_sampling(
        orbit=objs[ind].state,
        start_t=0,
        end_t=end_t,
        max_dpos=1e3,
    )
    p.stop('equidistant_sampling')

    print(f'Temporal points obj {ind}: {len(t)}')

    p.start('get_state')
    states += [objs[ind].get_state(t)]
    p.stop('get_state')

    p.start('find_passes')
    #rename cache_data to something more descriptive
    passes += [eiscat3d.find_passes(t, states[ind], cache_data=True)]
    p.stop('find_passes')

    p.start('observe_passes')
    data = scheduler.observe_passes(passes[ind],
                                    space_object=objs[ind],
コード例 #7
0
orb = pyorb.Orbit(M0=pyorb.M_earth,
                  direct_update=True,
                  auto_update=True,
                  degrees=True,
                  a=6700e3,
                  e=0,
                  i=75,
                  omega=0,
                  Omega=80,
                  anom=72)
t = np.linspace(0, 120, num=10)
mjd0 = 53005

p.start('propagate')
states = prop.propagate(t, orb.cartesian[:, 0], mjd0, A=1.0, C_R=1.0, C_D=1.0)
p.stop('propagate')

e3d = Tracker(radar=eiscat3d, t=t, ecefs=states[:3, :], profiler=p)

fig = plt.figure(figsize=(15, 15))
ax = fig.add_subplot(111, projection='3d')

ax.plot(states[0, :], states[1, :], states[2, :], "or")

for tx in e3d.radar.tx:
    ax.plot([tx.ecef[0]], [tx.ecef[1]], [tx.ecef[2]], 'or')
for rx in e3d.radar.rx:
    ax.plot([rx.ecef[0]], [rx.ecef[1]], [rx.ecef[2]], 'og')

for radm, ti in zip(e3d(t), range(len(t))):
    radar, meta = radm
コード例 #8
0
#!/usr/bin/env python
'''
Profiling save and load
================================

'''
import pathlib
from sorts.profiling import Profiler

p = Profiler()
p.start('program')

p.start('list init')
lst = list(range(200))
p.stop('list init')

for i in range(1000):
    p.start('list reversal')
    lst = lst[::-1]
    p.stop('list reversal')

p.stop('program')

print(p)

pth = pathlib.Path(__file__).parent / 'data' / 'profiler_data.txt'
print(f'Writing profiler data to: {pth}')
p.to_txt(pth)

new_profiler = Profiler.from_txt(pth)