torchsar.simulation package

Submodules

torchsar.simulation.geometry module

torchsar.simulation.geometry.disc(SceneArea, x0, y0, r, a=None, dx=None, dy=None, verbose=False)

disc area

generates disc area

Parameters
  • SceneArea (list or tuple) – Scene Area, [xmin,xmax,ymin,ymax]

  • x0 (int) – x center of disc (x: horizontal, y: vertical)

  • y0 (int) – y center of disc (x: horizontal, y: vertical)

  • r (int) – radius of disc

  • a (int, optional) – amplitude of disc (default: {None})

  • dx (float, optional) – resolution in range (default: {1 / (xmax-xmin)})

  • dy (float, optional) – resolution in azimuth (default: {1 / (ymax-ymin)})

  • verbose (bool, optional) – show more log info (the default is False, which means does not show)

Returns

ccas – disk area

Return type

tensor

torchsar.simulation.geometry.rectangle(SceneArea, x0, y0, h, w, a=None, dx=None, dy=None, verbose=False)

rectangle area

generates rectangle area

Parameters
  • SceneArea (list or tuple) – Scene Area, unit m, [xmin,xmax,ymin,ymax]

  • x0 (float) – x center of rectangle, unit m (x: horizontal, y: vertical)

  • y0 (float) – y center of rectangle, unit m (x: horizontal, y: vertical)

  • h (float) – height of rectangle, unit m (the default is None, which generates randomly)

  • w (float) – width of rectangle, unit m (the default is None, which generates randomly)

  • a (float, optional) – amplitude (the default is None, which generates randomly)

  • dx (float, optional) – resolution in range (default: {1 / (xmax-xmin)})

  • dy (float, optional) – resolution in azimuth (default: {1 / (ymax-ymin)})

  • verbose (bool, optional) – show more log info (the default is False, which means does not show)

Returns

rects – rectangle area

Return type

tensor

torchsar.simulation.make_sar_params module

class torchsar.simulation.make_sar_params.SARParameterGenerator(prdict, seed=None)

Bases: object

SAR Parameter Generator

prdict

{'p1': [low, high], 'p2': [low, high]...}

Type

dict

seed

The seed for random generator.

Type

int or None

mksarp(n=1, seed=None)

Makes SAR Parameters

Parameters
  • n (int, optional) – The number of experiments.

  • seed (None, optional) – The seed for random generator.

Returns

The SAR Parameter dict.

Return type

dict

torchsar.simulation.make_targets module

torchsar.simulation.make_targets.gpoints(SceneArea, npoints, amin=0.0, amax=1.0, seed=None)

Generates point targets

Parameters
  • SceneArea (tuple or list) – The area of scene.

  • npoints (int) – The number of points.

  • amin (float, optional) – The minimum amplitude. (default is 0)

  • amax (float, optional) – The maximum amplitude. (default is 1)

  • seed (int or None, optional) – The seed for random generator.

Returns

A tensor contains coordinate and amplitude information.

Return type

tensor

torchsar.simulation.sar_model module

torchsar.simulation.sar_model.load_sarmodel(datafile, mod='AinvA')

load sarmodel file

load sarmodel file (.pkl)

Parameters
  • datafile (str) – Model data file path.

  • mod (str, optional) – Specify load which variable, A, invA, AinvA (the default is ‘AinvA’, which \(\bm A\), \({\bm A}^{-1}\) )

Returns

  • A (numpy array) – Imaging mapping matrix.

  • invA (numpy array) – Inverse of imaging mapping matrix.

Raises

ValueError – wrong mod

torchsar.simulation.sar_model.sarmodel(pdict, mod='2D1', gdshape=None, device='cpu', islog=False)

model sar imaging process.

SAR imaging model

Parameters
  • pdict (dict) – SAR platform parameters

  • mod (str, optional) –

    mod type(default: ‘2D1’)

    if mod is ‘2D1’:
    the model will be in vector mode:

    s = A g MNx1 MNxHW HWx1(M: Na, N: Nr, MN << HW)

    if mod is ‘2D2’:
    the model will be in mat mode:

    S = Aa G Be MxN MxH HxW WxN(M: Na, N: Nr, M << H, N << W)

    if mod is ‘1Da’:

    S = A G MxW MxH HxW(M: Na, N: Nr, M << H)

    if mod is ‘1Dr’:

    S’ = A G’ NxH NxW WxH(M: Na, N: Nr, N << W)

  • gdshape (tuple, optional) – discrete scene size of G (default: None, sarplat.acquisition[‘SceneArea’], dx=dy=1)

  • device (str) – device, default is ‘cpu’

  • islog (bool) – show log info (default: True)

Returns

A – Imaging mapping matrix.

Return type

torch tensor

torchsar.simulation.sar_model.save_sarmodel(A, invA=None, AH=None, datafile='./model.pkl')

save model mapping matrix

save model mapping matrix to a file.

Parameters
  • A (numpy array) – Imaging mapping matrix

  • invA (numpy array, optional) – Moore - Penorse inverse of A(default: {None})

  • AH (numpy array, optional) – The Hermite \({\bm A}^H\) of the Imaging mapping matrix \(\bm A\) (the default is None, which does not store)

  • datafile (str, optional) – save file path(default: {‘./model.pkl’})

torchsar.simulation.sharing module

torchsar.simulation.sharing.range_angle(sensorpos, targetpos)

torchsar.simulation.simulation_chirp_scaling module

torchsar.simulation.simulation_freq_domain module

torchsar.simulation.simulation_freq_domain.dsm2sar_fd(g, pdict, mode='StationaryTarget2D', ftshift=True, device='cpu')

Frequency-domain simulation

SAR raw data simulation by frequency-domain method.

Parameters
  • g (tensor) – The digital scene matrix.

  • pdict (dict) – The SAR platform parameters.

  • mode (str, optional) – Simulation mode.

  • ftshift (bool, optional) – Shift zero-frequency to center?

  • device (str, optional) – Specifies which device to be used.

Returns

Simulated SAR raw data.

Return type

tensor

torchsar.simulation.simulation_time_domain module

torchsar.simulation.simulation_time_domain.tgs2sar_td(targets, pdict, mode='Target', device='cpu')

Time-domain simulation

SAR raw data simulation by time-domain method.

Parameters
  • targets (tensor) – A 2d-tensor contains the information of targets, each row is a target [x, y, z, vx, vy, vz, a].

  • pdict (dict) – The SAR platform parameters.

  • mode (str, optional) – Simulation mode.

  • device (str, optional) – Specifies which device to be used.

Returns

Simulated SAR raw data tensor.

Return type

tensor

Module contents