Note
Click here to download the full example code
Static radar controller and time samplingΒΆ
You can speed up execution by switching radar controller that is optimized for the use case. Also reducing time sampling of the radar controller can speed up calculations.
Out:
Space object 1: <Time object: scale='utc' format='mjd' value=53005.0>:
a : 7.2000e+06 x : -1.3922e+06
e : 2.0000e-02 y : 3.4519e+06
i : 7.5000e+01 z : 6.0816e+06
omega: 0.0000e+00 vx: -1.3986e+03
Omega: 8.6000e+01 vy: -6.4897e+03
anom : 6.0000e+01 vz: 3.5175e+03
Parameters: C_D=2.3, m=1.0, C_R=1.0, d=0.1
2020-10-15 13:24:47.300 INFO ; Static:init
2020-10-15 13:24:47.303 INFO ; Static:init
2020-10-15 13:24:47.306 INFO ; Scanner:init
Temporal points obj: 4555
Max SNR=-7.52150639802996 dB
Max SNR=-7.426719944704181 dB
Max SNR=-6.157419687282379 dB
<class 'sorts.controller.scanner.Scanner'>: len(t) = 6000
--------------------------------------- Performance analysis --------------------------------------
Name | Executions | Mean time | Total time
--------------------------------------------------------+--------------+---------------+--------------
equidistant_sampling | 1 | 6.65188e-05 s | 0.00 %
get_state | 1 | 5.63178e-02 s | 0.44 %
find_passes | 1 | 5.84817e-03 s | 0.05 %
Obs.Param.:calculate_observation:get_state | 3 | 5.38036e-02 s | 1.27 %
Obs.Param.:calculate_observation:enus,range,range_rate | 3 | 7.07547e-04 s | 0.02 %
Scanner:generator:point_radar:_point_station[tx] | 8361 | 1.03405e-04 s | 6.80 %
Scanner:generator:point_radar:_point_station[rx] | 25083 | 1.96192e-04 s | 38.68 %
Scanner:generator:point_radar | 8361 | 8.26807e-04 s | 54.34 %
Obs.Param.:calculate_observation:snr-step:gain | 8361 | 6.26064e-04 s | 41.15 %
Obs.Param.:calculate_observation:snr-step:snr | 8361 | 2.11980e-05 s | 1.39 %
Obs.Param.:calculate_observation:snr-step | 8361 | 6.62585e-04 s | 43.55 %
Obs.Param.:calculate_observation:generator | 3 | 4.16464e+00 s | 98.21 %
Obs.Param.:calculate_observation | 3 | 4.21945e+00 s | 99.50 %
observe_passes | 1 | 1.26592e+01 s | 99.51 %
total | 1 | 1.27217e+01 s | 100.00 %
---------------------------------------------------------------------------------------------------
Temporal points obj: 4555
Max SNR=-7.52150639802996 dB
Max SNR=-7.426719944704181 dB
Max SNR=-6.157419687282379 dB
<class 'sorts.controller.static.Static'>: len(t) = 6000
--------------------------------------- Performance analysis --------------------------------------
Name | Executions | Mean time | Total time
--------------------------------------------------------+--------------+---------------+--------------
equidistant_sampling | 1 | 6.62804e-05 s | 0.00 %
get_state | 1 | 5.27039e-02 s | 1.05 %
find_passes | 1 | 5.74374e-03 s | 0.11 %
Obs.Param.:calculate_observation:get_state | 3 | 5.15394e-02 s | 3.08 %
Obs.Param.:calculate_observation:enus,range,range_rate | 3 | 7.63178e-04 s | 0.05 %
Obs.Param.:calculate_observation:snr-step:gain | 8361 | 5.41809e-04 s | 90.36 %
Obs.Param.:calculate_observation:snr-step:snr | 8361 | 1.71599e-05 s | 2.86 %
Obs.Param.:calculate_observation:snr-step | 8361 | 5.71848e-04 s | 95.37 %
Obs.Param.:calculate_observation:generator | 3 | 1.59862e+00 s | 95.67 %
Obs.Param.:calculate_observation | 3 | 1.65118e+00 s | 98.81 %
observe_passes | 1 | 4.95437e+00 s | 98.83 %
total | 1 | 5.01308e+00 s | 100.00 %
---------------------------------------------------------------------------------------------------
Temporal points obj: 4555
Max SNR=-7.825843305311009 dB
Max SNR=-7.629714510540971 dB
Max SNR=-6.239996253442425 dB
<class 'sorts.controller.static.Static'>: len(t) = 600
--------------------------------------- Performance analysis --------------------------------------
Name | Executions | Mean time | Total time
--------------------------------------------------------+--------------+---------------+--------------
equidistant_sampling | 1 | 7.27177e-05 s | 0.01 %
get_state | 1 | 4.79825e-02 s | 7.31 %
find_passes | 1 | 5.87559e-03 s | 0.89 %
Obs.Param.:calculate_observation:get_state | 3 | 2.22474e-02 s | 10.16 %
Obs.Param.:calculate_observation:enus,range,range_rate | 3 | 5.24441e-04 s | 0.24 %
Obs.Param.:calculate_observation:snr-step:gain | 835 | 5.97733e-04 s | 75.99 %
Obs.Param.:calculate_observation:snr-step:snr | 835 | 2.23976e-05 s | 2.85 %
Obs.Param.:calculate_observation:snr-step | 835 | 6.36720e-04 s | 80.94 %
Obs.Param.:calculate_observation:generator | 3 | 1.77813e-01 s | 81.21 %
Obs.Param.:calculate_observation | 3 | 2.00671e-01 s | 91.65 %
observe_passes | 1 | 6.02712e-01 s | 91.76 %
total | 1 | 6.56831e-01 s | 100.00 %
---------------------------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
import sorts
eiscat3d = sorts.radars.eiscat3d_interp
from sorts.scheduler import StaticList, ObservedParameters
from sorts.controller import Static, Scanner
from sorts import SpaceObject
from sorts.profiling import Profiler
from sorts.radar.scans import Beampark
from sorts.propagator import SGP4
Prop_cls = SGP4
Prop_opts = dict(
settings = dict(
out_frame='ITRF',
),
)
end_t = 600.0
logger = sorts.profiling.get_logger('scanning')
obj = SpaceObject(
Prop_cls,
propagator_options = Prop_opts,
a = 7200e3,
e = 0.02,
i = 75,
raan = 86,
aop = 0,
mu0 = 60,
epoch = 53005.0,
parameters = dict(
d = 0.1,
),
)
print(obj)
class ObservedScanning(StaticList, ObservedParameters):
pass
static_ctrl = Static(eiscat3d, azimuth=0, elevation=90, logger=logger, meta={'dwell': 0.1})
static_ctrl.t = np.arange(0, end_t, static_ctrl.meta['dwell'])
static_ctrl_undersamp = Static(eiscat3d, azimuth=0, elevation=90, logger=logger, meta={'dwell': 0.1})
static_ctrl_undersamp.t = np.arange(0, end_t, 1.0)
scan = Beampark(azimuth=0, elevation=90, dwell=0.1)
scanner_ctrl = Scanner(eiscat3d.copy(), scan, logger=logger)
scanner_ctrl.t = np.arange(0, end_t, scan.dwell())
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'))
run_scanning_simulation(scanner_ctrl)
run_scanning_simulation(static_ctrl)
run_scanning_simulation(static_ctrl_undersamp)
Total running time of the script: ( 0 minutes 18.415 seconds)