示例#1
0
def sim_uhf(N_samples=10):
    outdir="./master_validation_data_uhf"
    os.system("mkdir -p %s"%(outdir))

    incs=n.arange(69,113,2)
    apogs=n.arange(6971,8371,100)
    print(len(apogs)*len(incs))
    radar=rl.eiscat_uhf()
    for inci,i in enumerate(incs):
        for ai in range(comm.rank,len(apogs),comm.size):
            a=apogs[ai]
            print("inc %f apog %f"%(i,a))
            sample_detections(radar,N=N_samples,a=a,inc=i,outdir=outdir)
示例#2
0
    def test_correlator(self):

        radar = rlib.eiscat_uhf()

        measurement_folder = './data/uhf_test_data/events'
        tle_file = './data/uhf_test_data/tle-201801.txt'
        measurement_file = measurement_folder + '/det-000000.h5'

        with h5py.File(measurement_file, 'r') as h_det:
            r = h_det['r'].value * 1e3
            t = h_det['t'].value
            v = -h_det['v'].value

            dat = {
                'r': r,
                't': t,
                'v': v,
            }

        pop = population_library.tle_snapshot(tle_file, sgp4_propagation=True)

        pop.filter('oid', lambda oid: n.abs(oid - 43075) < 50)

        cdat = correlator.correlate(
            data=dat,
            station=radar._rx[0],
            population=pop,
            metric=correlator.residual_distribution_metric,
            n_closest=2,
            out_file=None,
            verbose=False,
            MPI_on=False,
        )

        assert int(cdat[0]['sat_id']) == 43075
        self.assertLess(n.abs(cdat[0]['stat'][0]), 1e3)
        self.assertLess(n.abs(cdat[0]['stat'][1]), 500)
        self.assertLess(n.abs(cdat[0]['stat'][2]), 10.0)
        self.assertLess(n.abs(cdat[0]['stat'][3]), 5.0)
示例#3
0
                if len(d["range"]) > 0:
                    for di in range(len(d["range"])):
                        print("det oi %d fi %d di %d angle %1.3f" %
                              (oi, fi, di, d["on_axis_angle"][di]))
                        fname = "%s/det_%09d_%06d_%03d.h5" % (
                            outdir, m["id"][oi], fi, di)
                        print(fname)
                        ho = h5py.File(fname, "w")
                        ho["time"] = d["tm"][di]
                        ho["range"] = d["range"][di]
                        ho["range_rate"] = d["range_rate"][di]
                        ho["snr"] = d["snr"][di]
                        ho["oid"] = m["id"][oi]
                        ho["rx_gain"] = d["tx_gain"][di]
                        ho["tx_gain"] = d["tx_gain"][di]
                        ho["on_axis_angle"] = d["on_axis_angle"][di]
                        ho.close()
    comm.barrier()


if __name__ == "__main__":
    m = read_master()
    uhf = True
    esr = False
    if uhf:
        radar = rl.eiscat_uhf()
        proof(radar, m, outdir="proof_uhf")
    if esr:
        radar = rl.eiscat_svalbard()
        proof(radar, m, outdir="proof_esr")
示例#4
0
import numpy as n
from mpi4py import MPI
import sys

sys.path.insert(0, "/home/danielk/IRF/IRF_GITLAB/SORTSpp")
# SORTS imports
import population as p
import radar_library as rl
import radar_scan_library as rslib
import simulation as s
import scheduler_library as sch

sim_root = '/home/danielk/IRF/E3D_PA/SORTSpp_sim/sim_rho'

#initialize the radar setup
e3d = rl.eiscat_uhf()
e3d._min_on_axis=25.0
e3d._min_SNRdb=1.0

e3d._tx[0].enr_thresh = 1.0 #SNR?
e3d._tx[0].el_thresh = 30.0 #deg
for rx in e3d._rx:
	rx.el_thresh =  30.0 #deg
e3d._tx[0].ipp = 10e-3 # pulse spacing
e3d._tx[0].n_ipp = 5 # number of ipps to coherently integrate
e3d._tx[0].pulse_length = 1e-3

#initialize the observing mode
e3d_scan = rslib.beampark_model(az=0.0, el=90.0, alt = 150, dwell_time = 0.1)

e3d_scan.set_radar_location(e3d)
示例#5
0
_opts = {
    'in_frame': 'TEME',
    'out_frame': 'ITRF',
    'solar_activity_strength': 'WEAK',
}

event_date = np.datetime64('2019-03-27T05:40')
event_mjd = dpt.npdt2mjd(event_date)

prop = _prop(**_opts)

#sim_root = '/ZFS_DATA/SORTSpp/FP_sims/T_UHF_MicrosatR_v2'
sim_root = '/home/danielk/IRF/E3D_PA/FP_sims/T_UHF_MicrosatR_v2'

#initialize the radar setup
radar = rlib.eiscat_uhf()

radar.set_FOV(max_on_axis=25.0, horizon_elevation=50.0)
radar.set_SNR_limits(min_total_SNRdb=14.0, min_pair_SNRdb=14.0)

radar.set_scan(scan)

fname = sim_root + '/population_{}.h5'.format(branch_name)
catname = sim_root + '/' + branch_name + '/catalogue_data.h5'

pop = Population.load(
    fname,
    propagator=_prop,
    propagator_options=_opts,
)
示例#6
0
#!/usr/bin/env python

import numpy as n
import matplotlib.pyplot as plt
import debris
import radar_library as rl

radars=[]
radars.append(rl.eiscat_uhf())
radars.append(rl.tromso_space_radar())
radars.append(rl.eiscat_svalbard())
radars.append(rl.eiscat_3d_module())
radars.append(rl.eiscat_3d())

range_m=10**n.linspace(5,8,num=100)

for r in radars:
    min_diam=n.zeros(len(range_m))
    gain_tx=r._tx[0].beam.I_0
    gain_rx=r._rx[0].beam.I_0
    rx_noise=r._tx[0].rx_noise
    B=r._tx[0].coh_int_bandwidth
    wavelength=r._tx[0].wavelength
    tx_power=r._tx[0].tx_power
    print(r._tx[0])

    for ri,rng_m in enumerate(range_m):
        min_diam[ri]=debris.target_diameter(gain_tx, gain_rx, wavelength, tx_power, rng_m, rng_m, enr=1.0, bandwidth=B, rx_noise_temp=rx_noise)
    plt.loglog(range_m/1e3,min_diam,label=r.name)
    
plt.xlabel("Range (km)")
示例#7
0
import numpy as np
import scipy.constants as c

import matplotlib.pyplot as plt

from radar_config import plot_radar
import radar_library as rl

radars = [
    rl.eiscat_3d(beam='gauss'),
    #rl.eiscat_3d(beam = 'array'),
    rl.eiscat_3d_module(beam='gauss'),
    #rl.eiscat_3d_module(beam = 'array'),
    rl.eiscat_svalbard(),
    rl.eiscat_uhf(),
]

for radar in radars:
    plot_radar(radar)
示例#8
0
space_o = space_object.SpaceObject(
    a=7000,
    e=0.0,
    i=69,
    raan=0,
    aop=0,
    mu0=0,
    C_D=2.3,
    A=1.0,
    m=1.0,
    C_R=1.0,
    oid=42,
    d=0.1,
    mjd0=57125.7729,
)

print(space_o)

radars = [
    radar_library.eiscat_uhf(),
    radar_library.eiscat_3d(),
]

radars[0]._tx[0].scan.keyword_arguments(el=45.0)

for radar in radars:
    plot_detections(radar, space_o, t_end=24.0 * 3600.0)

plt.show()
示例#9
0
def test_envisat_detection():
    from mpi4py import MPI

    # SORTS imports CORE
    import population_library as plib
    from simulation import Simulation

    #SORTS Libraries
    import radar_library as rlib
    import radar_scan_library as rslib
    import scheduler_library as schlib
    import antenna_library as alib
    import rewardf_library as rflib

    #SORTS functions
    import ccsds_write
    import dpt_tools as dpt

    sim_root = './tests/tmp_test_data/envisat_sim_test'

    radar = rlib.eiscat_uhf()
    radar.set_FOV(max_on_axis=30.0, horizon_elevation=25.0)

    scan = rslib.beampark_model(
        lat=radar._tx[0].lat,
        lon=radar._tx[0].lon,
        alt=radar._tx[0].alt,
        az=90.0,
        el=75.0,
    )
    radar.set_scan(scan)

    #tle files for envisat in 2016-09-05 to 2016-09-07 from space-track.
    TLEs = [
        ('1 27386U 02009A   16249.14961597  .00000004  00000-0  15306-4 0  9994',
         '2 27386  98.2759 299.6736 0001263  83.7600 276.3746 14.37874511760117'
         ),
        ('1 27386U 02009A   16249.42796553  .00000002  00000-0  14411-4 0  9997',
         '2 27386  98.2759 299.9417 0001256  82.8173 277.3156 14.37874515760157'
         ),
        ('1 27386U 02009A   16249.77590267  .00000010  00000-0  17337-4 0  9998',
         '2 27386  98.2757 300.2769 0001253  82.2763 277.8558 14.37874611760201'
         ),
        ('1 27386U 02009A   16250.12384028  .00000006  00000-0  15974-4 0  9995',
         '2 27386  98.2755 300.6121 0001252  82.5872 277.5467 14.37874615760253'
         ),
        ('1 27386U 02009A   16250.75012691  .00000017  00000-0  19645-4 0  9999',
         '2 27386  98.2753 301.2152 0001254  82.1013 278.0311 14.37874790760345'
         ),
    ]

    pop = plib.tle_snapshot(TLEs, sgp4_propagation=True)

    pop['d'] = n.sqrt(4 * 2.3 * 4 / n.pi)
    pop['m'] = 2300.
    pop['C_R'] = 1.0
    pop['C_D'] = 2.3
    pop['A'] = 4 * 2.3

    ccsds_file = './data/uhf_test_data/events/2002-009A-2016-09-06_08:27:08.tdm'

    obs_data = ccsds_write.read_ccsds(ccsds_file)
    jd_obs = dpt.mjd_to_jd(dpt.npdt2mjd(obs_data['date']))

    jd_sort = jd_obs.argsort()
    jd_obs = jd_obs[jd_sort]

    jd_det = jd_obs[0]

    pop.delete([0, 1, 2, 4])  #now just best ID left

    jd_pop = dpt.mjd_to_jd(pop['mjd0'][0])
    tt_obs = (jd_obs - jd_pop) * 3600.0 * 24.0

    sim = Simulation(
        radar=radar,
        population=pop,
        root=sim_root,
        scheduler=schlib.dynamic_scheduler,
    )

    sim.observation_parameters(
        duty_cycle=0.125,
        SST_fraction=1.0,
        tracking_fraction=0.0,
        SST_time_slice=0.2,
    )

    sim.run_observation(jd_obs[-1] - jd_pop + 1.0)

    sim.print_maintenance()
    sim.print_detections()

    sim.set_scheduler_args(logger=sim.logger, )

    sim.run_scheduler()
    sim.print_tracks()

    print(sim.catalogue.tracklets[0]['t'])
    print(jd_obs)

    shutil.rmtree(sim_root)
    assert False
示例#10
0
    def test_create_tracklet(self):

        radar = rlib.eiscat_uhf()
        radar.set_FOV(30.0, 25.0)

        #tle files for envisat in 2016-09-05 to 2016-09-07 from space-track.
        TLEs = [
            ('1 27386U 02009A   16249.14961597  .00000004  00000-0  15306-4 0  9994',
             '2 27386  98.2759 299.6736 0001263  83.7600 276.3746 14.37874511760117'
             ),
            ('1 27386U 02009A   16249.42796553  .00000002  00000-0  14411-4 0  9997',
             '2 27386  98.2759 299.9417 0001256  82.8173 277.3156 14.37874515760157'
             ),
            ('1 27386U 02009A   16249.77590267  .00000010  00000-0  17337-4 0  9998',
             '2 27386  98.2757 300.2769 0001253  82.2763 277.8558 14.37874611760201'
             ),
            ('1 27386U 02009A   16250.12384028  .00000006  00000-0  15974-4 0  9995',
             '2 27386  98.2755 300.6121 0001252  82.5872 277.5467 14.37874615760253'
             ),
            ('1 27386U 02009A   16250.75012691  .00000017  00000-0  19645-4 0  9999',
             '2 27386  98.2753 301.2152 0001254  82.1013 278.0311 14.37874790760345'
             ),
        ]

        pop = population_library.tle_snapshot(TLEs, sgp4_propagation=True)

        #it seems to around 25m^2 area
        d = n.sqrt(25.0 * 4 / n.pi)
        pop.add_column('d', space_object_uses=True)
        pop['d'] = d

        ccsds_file = './data/uhf_test_data/events/2002-009A-1473150428.tdm'

        obs_data = ccsds_write.read_ccsds(ccsds_file)
        jd_obs = dpt.mjd_to_jd(dpt.npdt2mjd(obs_data['date']))

        date_obs = obs_data['date']
        sort_obs = n.argsort(date_obs)
        date_obs = date_obs[sort_obs]
        r_obs = obs_data['range'][sort_obs]

        jd_sort = jd_obs.argsort()
        jd_obs = jd_obs[jd_sort]

        jd_det = jd_obs[0]

        jd_pop = dpt.mjd_to_jd(pop['mjd0'])

        pop_id = n.argmin(n.abs(jd_pop - jd_det))
        obj = pop.get_object(pop_id)

        print(obj)

        jd_obj = dpt.mjd_to_jd(obj.mjd0)

        print('Day difference detection - TLE: {}'.format(jd_det - jd_obj))

        t_obs = (jd_obs - jd_obj) * (3600.0 * 24.0)

        meas, fnames, ecef_stdevs = simulate_tracklet.create_tracklet(
            obj,
            radar,
            t_obs,
            hdf5_out=True,
            ccsds_out=True,
            dname="./tests/tmp_test_data",
            noise=False,
        )

        out_h5 = fnames[0] + '.h5'
        out_ccsds = fnames[0] + '.tdm'

        print('FILES: ', fnames)

        with h5py.File(out_h5, 'r') as h_det:
            assert 'm_range' in h_det
            assert 'm_range_rate' in h_det
            assert 'm_time' in h_det

        sim_data = ccsds_write.read_ccsds(out_ccsds)

        date_sim = sim_data['date']
        sort_sim = n.argsort(date_sim)
        date_sim = date_sim[sort_sim]

        r_sim = sim_data['range'][sort_sim]
        v_sim = sim_data['doppler_instantaneous'][sort_sim]

        lt_correction = n.round(r_sim / scipy.constants.c * 1e6).astype(
            n.int64).astype('timedelta64[us]')

        date_sim_cor = date_sim + lt_correction

        t_sim = dpt.jd_to_unix(dpt.mjd_to_jd(dpt.npdt2mjd(date_sim_cor)))

        for ind in range(len(date_sim)):
            time_df = (dpt.npdt2mjd(date_sim_cor[ind]) -
                       dpt.npdt2mjd(date_obs[ind])) * 3600.0 * 24.0
            assert time_df < 0.01

        assert len(r_obs) == len(r_sim)

        dat = {
            't': t_sim,
            'r': r_sim * 1e3,
            'v': v_sim * 1e3,
        }

        cdat = correlator.correlate(
            data=dat,
            station=radar._rx[0],
            population=pop,
            metric=correlator.residual_distribution_metric,
            n_closest=1,
            out_file=None,
            verbose=False,
            MPI_on=False,
        )

        self.assertLess(n.abs(cdat[0]['stat'][0]), 5.0)
        self.assertLess(n.abs(cdat[0]['stat'][1]), 50.0)
        self.assertLess(n.abs(cdat[0]['stat'][2]), 5.0)
        self.assertLess(n.abs(cdat[0]['stat'][3]), 50.0)

        nt.assert_array_less(n.abs(r_sim - r_obs), 1.0)

        os.remove(out_h5)
        print('removed "{}"'.format(out_h5))

        os.remove(out_ccsds)
        print('removed "{}"'.format(out_ccsds))

        sat_folder = os.sep.join(fnames[0].split(os.sep)[:-1])
        os.rmdir(sat_folder)
        print('removed "{}"'.format(sat_folder))