Skip to content

Commit

Permalink
164 make randomdistribution a native type (#202)
Browse files Browse the repository at this point in the history
* Fixing QA generation

* Explicit module updates in dataset and transform RTD files

* First attempts

* Refactored to RandomDistribution

* Final touches

* Formatting

---------

Co-authored-by: Luke Boegner <[email protected]>
  • Loading branch information
gvanhoy and lboegner authored Sep 5, 2023
1 parent 979f754 commit 54f8200
Show file tree
Hide file tree
Showing 10 changed files with 651 additions and 680 deletions.
17 changes: 16 additions & 1 deletion docs/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All the datasets have almost similar API. They all have a common argument:
``transform`` to transform the input data.


.. currentmodule:: torchsig.datasets
.. currentmodule:: torchsig.datasets.sig53


Sig53
Expand All @@ -28,24 +28,32 @@ Sig53
.. autoclass:: Sig53


.. currentmodule:: torchsig.datasets.wideband_sig53

WidebandSig53
~~~~~~~~~~~~~~

.. autoclass:: WidebandSig53


.. currentmodule:: torchsig.datasets.modulations

ModulationsDataset
~~~~~~~~~~~~~~~~~~~~

.. autoclass:: ModulationsDataset


.. currentmodule:: torchsig.datasets.wideband

WidebandModulationsDataset
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: WidebandModulationsDataset


.. currentmodule:: torchsig.datasets.synthetic

DigitalModulationDataset
~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -82,6 +90,8 @@ FMDataset
.. autoclass:: FMDataset


.. currentmodule:: torchsig.datasets.wideband

WidebandDataset
~~~~~~~~~~~~~~~~~~

Expand All @@ -94,12 +104,17 @@ SyntheticBurstSourceDataset
.. autoclass:: SyntheticBurstSourceDataset


.. currentmodule:: torchsig.datasets.file_datasets


FileBurstSourceDataset
~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: FileBurstSourceDataset


.. currentmodule:: torchsig.datasets.radioml

RadioML2016
~~~~~~~~~~~~~~

Expand Down
223 changes: 152 additions & 71 deletions docs/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This is useful if you have to build a more complex transformation pipeline
.. contents:: Transforms
:local:

General Transforms
------------------
.. currentmodule:: torchsig.transforms
Transforms
----------
.. currentmodule:: torchsig.transforms.transforms

Transform
^^^^^^^^^
Expand All @@ -23,9 +23,9 @@ Compose
^^^^^^^^^
.. autoclass:: Compose

NoTransform
^^^^^^^^^^^^^
.. autoclass:: NoTransform
Identity
^^^^^^^^^
.. autoclass:: Identity

Lambda
^^^^^^^^^
Expand All @@ -51,48 +51,6 @@ TargetConcatenate
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: TargetConcatenate

RandAugment
^^^^^^^^^^^^^
.. autoclass:: RandAugment


Deep Learning Techniques
------------------------
.. currentmodule:: torchsig.transforms.deep_learning_techniques.dlt

DatasetBasebandMixUp
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetBasebandMixUp

DatasetBasebandCutMix
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetBasebandCutMix

CutOut
^^^^^^^^^
.. autoclass:: CutOut

PatchShuffle
^^^^^^^^^^^^^
.. autoclass:: PatchShuffle

DatasetWidebandMixUp
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetWidebandMixUp

DatasetWidebandCutMix
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetWidebandCutMix

SpectrogramRandomResizeCrop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: SpectrogramRandomResizeCrop


Expert Feature Transforms
-------------------------
.. currentmodule:: torchsig.transforms.expert_feature.eft

InterleaveComplex
^^^^^^^^^^^^^^^^^
.. autoclass:: InterleaveComplex
Expand Down Expand Up @@ -137,24 +95,51 @@ ReshapeTransform
^^^^^^^^^^^^^^^^^
.. autoclass:: ReshapeTransform


Signal Processing Transforms
----------------------------
.. currentmodule:: torchsig.transforms.signal_processing.sp
RandAugment
^^^^^^^^^^^^^
.. autoclass:: RandAugment

Normalize
^^^^^^^^^
.. autoclass:: Normalize


Augmentations
-------------
.. currentmodule:: torchsig.transforms.transforms

DatasetBasebandMixUp
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetBasebandMixUp

DatasetBasebandCutMix
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetBasebandCutMix

CutOut
^^^^^^^^^
.. autoclass:: CutOut

PatchShuffle
^^^^^^^^^^^^^
.. autoclass:: PatchShuffle

DatasetWidebandMixUp
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetWidebandMixUp

DatasetWidebandCutMix
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DatasetWidebandCutMix

SpectrogramRandomResizeCrop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: SpectrogramRandomResizeCrop

RandomResample
^^^^^^^^^^^^^^^^^
.. autoclass:: RandomResample


System Impairment Transforms
-----------------------------
.. currentmodule:: torchsig.transforms.system_impairment.si

RandomTimeShift
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: RandomTimeShift
Expand Down Expand Up @@ -231,11 +216,6 @@ RandomConvolve
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: RandomConvolve


Wireless Channel Transforms
----------------------------
.. currentmodule:: torchsig.transforms.wireless_channel.wce

TargetSNR
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: TargetSNR
Expand All @@ -260,15 +240,6 @@ RandomPhaseShift
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: RandomPhaseShift


Spectrogram Transforms
----------------------------
.. currentmodule:: torchsig.transforms.spectrogram_transforms.spec

SpectrogramResize
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: SpectrogramResize

SpectrogramDropSamples
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: SpectrogramDropSamples
Expand All @@ -288,3 +259,113 @@ SpectrogramMosaicCrop
SpectrogramMosaicDownsample
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: SpectrogramMosaicDownsample


Target Transforms
-----------------
.. currentmodule:: torchsig.transforms.target_transforms

DescToClassName
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToClassName

DescToClassNameSNR
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToClassNameSNR

DescToClassIndex
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToClassIndex

DescToClassIndexSNR
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToClassIndexSNR

DescToMask
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToMask

DescToMaskSignal
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToMaskSignal

DescToMaskFamily
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToMaskFamily

DescToMaskClass
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToMaskClass

DescToSemanticClass
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToSemanticClass

DescToBBox
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToBBox

DescToAnchorBoxes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToAnchorBoxes

DescPassThrough
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescPassThrough

DescToBinary
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToBinary

DescToCustom
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToCustom

DescToClassEncoding
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToClassEncoding

DescToWeightedMixUp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToWeightedMixUp

DescToWeightedCutMix
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToWeightedCutMix

DescToBBoxDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToBBoxDict

DescToBBoxSignalDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToBBoxSignalDict

DescToBBoxFamilyDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToBBoxFamilyDict

DescToInstMaskDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToInstMaskDict

DescToSignalInstMaskDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToSignalInstMaskDict

DescToSignalFamilyInstMaskDict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToSignalFamilyInstMaskDict

DescToListTuple
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: DescToListTuple

ListTupleToDesc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ListTupleToDesc

LabelSmoothing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: LabelSmoothing

4 changes: 2 additions & 2 deletions tests/test_transforms_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def generate_data():
("magnitude_rescale", RandomMagRescale(0.5, 3), RandomMagRescale(0.5, 3)),
(
"drop_samples",
RandomDropSamples(0.3, 50, ["zero"]),
RandomDropSamples(0.3, 50, ["zero"]),
RandomDropSamples(0.01, 50, ["zero"]),
RandomDropSamples(0.01, 50, ["zero"]),
),
("quantize", Quantize(32, ["floor"]), Quantize(32, ["floor"])),
("clip", Clip(0.85), Clip(0.85)),
Expand Down
7 changes: 6 additions & 1 deletion tests/test_transforms_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ def generate_data(modulation_name):


@pytest.mark.parametrize(
"transform, modulation_name", itertools.product(transforms_list, modulations)
"transform, modulation_name",
itertools.product(transforms_list, modulations),
ids=[
"{}-{}".format(x[0], y)
for x, y in itertools.product(transforms_list, modulations)
],
)
def test_transform_figures(transform, modulation_name):
short_data, long_data = generate_data(modulation_name)
Expand Down
Loading

0 comments on commit 54f8200

Please sign in to comment.