Example #1
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}
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'))
Example #3
0
'''

import numpy as np
import matplotlib.pyplot as plt
import pyorb

import sorts
eiscat3d = sorts.radars.eiscat3d
from sorts.profiling import Profiler

from sorts.propagator import SGP4
Prop_cls = SGP4
Prop_opts = dict(settings=dict(out_frame='ITRF', ), )
prop = Prop_cls(**Prop_opts)

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

orb = pyorb.Orbit(M0=pyorb.M_earth,
                  direct_update=True,
                  auto_update=True,
                  degrees=True,
                  a=7200e3,
                  e=0.1,
                  i=75,
                  omega=0,
                  Omega=79,
                  anom=72,
                  epoch=53005.0)
print(orb)
Example #4
0
#area in m^2
A = 2.0

#change the area every 1 minutes
dt = 60.0

#propagate for 6h
t = np.arange(0, 6 * 3600.0, dt)

#for reproducibility
np.random.seed(23984)

states = []

ph = Profiler()
ph.start('total')
prop.profiler = ph

for mci in range(10):
    print(f'MC-iteration {mci+1}/10')
    state = prop.propagate(
        t,
        orb.cartesian[:, 0],
        epoch=Time(53005, format='mjd', scale='utc'),
        A=A,
        C_R=1.0,
        C_D=2.3,
    )
    states += [state]
Example #5
0
#!/usr/bin/env python
'''
Profiling Orekit
======================

'''
import numpy as np

from sorts.profiling import Profiler
from sorts.propagator import Orekit

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

orekit_data = '/home/danielk/IRF/IRF_GITLAB/orekit_build/orekit-data-master.zip'

prop = Orekit(
    orekit_data=orekit_data,
    settings=dict(
        in_frame='ITRS',
        out_frame='GCRS',
        drag_force=False,
        radiation_pressure=False,
    ),
    profiler=p,
)

print(prop)

state0 = np.array(
    [-7100297.113, -3897715.442, 18568433.707, 86.771, -3407.231, 2961.571])
Example #6
0
#!/usr/bin/env python

'''
Profiling memory leaks
=========================

'''
import matplotlib.pyplot as plt

from sorts.profiling import Profiler

p = Profiler(track_memory=True)

#As the profiler data is also stored in Python tracked memory
# a diff of "nothing" will still result in more allocation of memory
# including initialization for structures and the like
p.snapshot('nothing')
p.memory_diff('nothing')

#this allocates memory
p.snapshot('one list')
lst = list(range(2000))
p.memory_diff('one list')

#and if we take care to delete the variable
#only profiling allocations are left over
del lst
p.memory_diff('one list', save='one list - and clear')

#this iteration changes allocation each iteration and does not clean up
lsts = []