torchsar.misc package¶
Submodules¶
torchsar.misc.data module¶
- torchsar.misc.data.format_data(X, modefrom='chnl_last', modeto='chnl_first')¶
format data
Format data to chanel first or chanel last.
- Parameters
- Returns
Formated data
- Return type
X (numpy array)
- Raises
TypeError – X should be a 3 or 4 dimention array!
ValueError – Unknown mode of modefrom or modeto
- torchsar.misc.data.sarread(file)¶
Read SAR file
Read SAR file (
.pkl
or.mat
) and returns SAR data and platform- Parameters
file (str) – SAR data (contains platform) file path.
- Returns
The SAR raw data.
params (Instance of SarPlat): The SAR platform for obtain the SAR data.
- Return type
sardata (Instance SarData)
- torchsar.misc.data.sarstore(sardata, params, file)¶
Read SAR file
Store SAR data and platform to a file (
.pkl
,.h5
or.mat
)
torchsar.misc.sardata module¶
- class torchsar.misc.sardata.SarData¶
Bases:
object
SAR data class. rawdata image store read
- property image¶
- property name¶
- property rawdata¶
- read(file)¶
Read SAR data file
Read SAR data file (
.pkl
or.mat
)- Parameters
file (str) – SAR data file path}
- Returns
sardata (Instance SarData) – The SAR raw data.
sarplat (Instance of SarPlat) – The SAR platform for obtain the SAR data.
- store(sarplat, file)¶
torchsar.misc.sarplat module¶
torchsar.misc.visual module¶
- torchsar.misc.visual.apshow(Srx, Title=None, cmap=None, extent=None, keepAspectRatio=True, outfile=None, isshow=True)¶
Show amplitude and phase.
Show amplitude and phase.
- Parameters
Srx (Tensor) – Complex-valued tensor.
Title (str, optional) – The figure title (the default is None, which means no title).
cmap (str, optional) – The colormap (the default is None)
extent (tuple or list, optional) – [description] (the default is None)
keepAspectRatio (bool, optional) – [description] (the default is True)
outfile (str, optional) – The filename for outputing (the default is None, which means not save)
isshow (bool, optional) – Whether to show the figure (the default is True).
- torchsar.misc.visual.imshow(Xs, nrows=None, ncols=None, xlabels=None, ylabels=None, titles=None, figsize=None, outfile=None, **kwargs)¶
show images
This function create an figure and show images in \(a\) rows and \(b\) columns.
- Parameters
Xs (tensor, array, list or tuple) – list/tuple of image arrays/tensors, if the type is not list or tuple, wrap it.
nrows (int, optional) – show in
nrows
rows, by default None (auto computed).ncols (int, optional) – show in
ncols
columns, by default None (auto computed).xlabels (str, optional) – labels of x-axis
ylabels (str, optional) – labels of y-axis
titles (str, optional) – titles
figsize (tuple, optional) – figure size, by default None
outfile (str, optional) – save image to file, by default None (do not save).
kwargs – see
matplotlib.pyplot.imshow()
- Returns
plot handle
- Return type
plt
- torchsar.misc.visual.saraxis(pdict, axismod=None)¶
generate SAR image axes ticks and strings
- Parameters
- Returns
extent, xlabel string, ylabel string, title string.
- Return type
list and str
- torchsar.misc.visual.sarshow(Xs, pdict, axismod=None, nrows=None, ncols=None, xlabels=None, ylabels=None, titles=None, figsize=None, outfile=None, **kwargs)¶
_summary_
- Parameters
Xs (tensor, array, list or tuple) – list/tuple of image arrays/tensors, if the type is not list or tuple, wrap it.
pdict (dict) – SAR parameter dict
axismod (_type_, optional) – _description_, by default None
nrows (int, optional) – show in
nrows
rows, by default None (auto computed).ncols (int, optional) – show in
ncols
columns, by default None (auto computed).xlabels (str, optional) – labels of x-axis
ylabels (str, optional) – labels of y-axis
titles (str, optional) – titles
figsize (tuple, optional) – figure size, by default None
outfile (str, optional) – save image to file, by default None (do not save).
kwargs – see
matplotlib.pyplot.imshow()
- torchsar.misc.visual.showReImAmplitudePhase(Srx, extent=None, title=None, keepAspectRatio=True)¶
[summary]
[description]
- Parameters
Srx ({[type]}) – [description]
extent ({[type]}, optional) – [description] (the default is None, which [default_description])
title (str, optional) – [description] (the default is None, which [default_description])
keepAspectRatio (bool, optional) – [description] (the default is True, which [default_description])
- torchsar.misc.visual.show_image(img, Title=None, cmap=None, keepAspectRatio=True, outfile=None, isshow=True)¶
- torchsar.misc.visual.show_response(Srx, extent=None, title='Figure', keepAspectRatio=True, outfile=None, isshow=True)¶
show SAR response
[description]
- Parameters
Srx (Tensor) – [description]
- Keyword Arguments
- torchsar.misc.visual.show_sarimage(SI, pdict, axismod=None, title=None, cmap=None, isimgadj=False, aspect=None, outfile=None, newfig=True, figsize=None)¶
[summary]
[description]
- Parameters
{[type]} -- [description] (pdict) –
{[type]} -- [description] –
- Keyword Arguments
{[type]} -- [description] (default (figsize) – {None})
{[type]} -- [description] (default – {None})
{[type]} -- [description] (default – {None})
bool -- [description] (default (newfig) – {False})
{[type]} -- [description] (default – {None})
{[type]} -- [description] (default – {None})
bool -- [description] (default – {True})
{[type]} -- [description] (default – {None})
- torchsar.misc.visual.show_sarimage3d(SI, pdict, axismod=None, title=None, cmap=None, isimgadj=False, aspect=None, outfile=None, figsize=None)¶
[summary]
[description]
- Parameters
{[type]} -- [description] (sarplat) –
{[type]} -- [description] –
- Keyword Arguments
{[type]} -- [description] (default (figsize) – {None})
{[type]} -- [description] (default – {None})
{[type]} -- [description] (default – {None})
bool -- [description] (default (isimgadj) – {False})
{[type]} -- [description] (default – {None})
{[type]} -- [description] (default – {None})
{[type]} -- [description] (default – {None})
- torchsar.misc.visual.tgshow(targets, scene, shape, extent=None, cmap=None, isflip=[False, False], labelstr=None, outfile=None, isshow=True)¶
show targets
Show targets in an image.
- Parameters
- Keyword Arguments
- Returns
- Return type
Tensor – The final image tensor for show.
:raises ValueError –
targets
should not be None.: