Skip to content

Commit

Permalink
add mixed signal
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiim committed Dec 25, 2024
1 parent 9dff3c3 commit dcc76bc
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 67 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Check [examples](https://github.com/zhiim/doa_py/tree/master/examples) for more
- **Broadband**
- _ChirpSignal_: Chirp signals with different chirp bandwidths within the sampling period.
- _MultiFreqSignal_: Broadband signals formed by the superposition of multiple single-frequency signals within a certain frequency band.
- _MixedSignal_: Narrorband and broadband mixed signal

### Algorithms

Expand Down
32 changes: 17 additions & 15 deletions doa_py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
# DOA_py
# DOA_Py
DOA Estimation algorithms implemented in Python. It can be used for ULA, UCA and
broadband/wideband DOA estimation.
Expand Down Expand Up @@ -65,7 +65,8 @@
You will a get a figure like this:
![music_spectrum](https://github.com/zhiim/doa_py/blob/master/pics/music_spectrum.svg)
Check `examples` for more examples.
Check [examples](https://github.com/zhiim/doa_py/tree/master/examples) for more
examples.
## What's implemented
Expand All @@ -77,16 +78,17 @@
### Signal Models
- Narrowband
**ComplexStochasticSignal**: The amplitude of signals at each sampling point
is a complex random variable.
**RandomFreqSignal**: Signals transmitted by different sources have different
intermediate frequencies (IF).
- Broadband
**ChirpSignal**: Chirp signals with different chirp bandwidths within the
sampling period.
**MultiFreqSignal**: Broadband signals formed by the superposition of multiple
single-frequency signals within a certain frequency band.
- **Narrowband**
- _ComplexStochasticSignal_: The amplitude of signals at each sampling point
is a complex random variable.
- _RandomFreqSignal_: Signals transmitted by different sources have different
intermediate frequencies (IF).
- **Broadband**
- _ChirpSignal_: Chirp signals with different chirp bandwidths within the
sampling period.
- _MultiFreqSignal_: Broadband signals formed by the superposition of multiple
single-frequency signals within a certain frequency band.
- _MixedSignal_: Narrorband and broadband mixed signal
### Algorithms
Expand All @@ -109,9 +111,9 @@
## License
This project is licensed under the [MIT](LICENSE) License - see the LICENSE
file for details.
This project is licensed under the [MIT](LICENSE) License - see the LICENSE file
for details.
"""

__version__ = "0.2.3"
__version__ = "0.3.0"
__author__ = "Qian Xu"
18 changes: 6 additions & 12 deletions doa_py/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ def received_signal(
snr=None,
nsamples=100,
amp=None,
min_length_ratio=0.1,
no_overlap=False,
unit="deg",
**kwargs,
):
"""Generate array received signal based on array signal model
Expand All @@ -112,12 +111,10 @@ def received_signal(
snr: Signal-to-noise ratio. If set to None, no noise will be added
nsamples (int): Number of snapshots, defaults to 100
amp: The amplitude of each signal, 1d numpy array
min_length_ratio (float): Minimum length ratio of the frequency
range in (f_max - f_min)
no_overlap (bool): If True, generate signals with non-overlapping
subbands
unit: The unit of the angle, `rad` represents radian,
`deg` represents degree. Defaults to 'deg'.
**kwargs: Additional parameters for generating broadband signal,
check `gen` method of `BroadSignal`.
"""
# Convert the angle from degree to radians
angle_incidence = self._unify_unit(angle_incidence, unit)
Expand All @@ -129,8 +126,7 @@ def received_signal(
nsamples,
angle_incidence,
amp,
min_length_ratio,
no_overlap,
**kwargs,
)
if isinstance(signal, NarrowSignal):
received = self._gen_narrowband(
Expand Down Expand Up @@ -171,8 +167,7 @@ def _gen_broadband(
nsamples,
angle_incidence,
amp,
min_length_ratio=0.1,
no_overlap=False,
**kwargs,
):
"""Generate broadband received signal
Expand All @@ -188,9 +183,8 @@ def _gen_broadband(
incidence_signal = signal.gen(
n=num_signal,
nsamples=nsamples,
min_length_ratio=min_length_ratio,
no_overlap=no_overlap,
amp=amp,
**kwargs,
)

# generate array signal in frequency domain
Expand Down
17 changes: 1 addition & 16 deletions doa_py/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,10 @@ def plot_spatial_spectrum_2d(
def plot_estimated_value_2d(
estimated_azimuth,
estimated_elevation,
num_signal,
ground_truth=None,
unit="deg",
x_label="Angle",
y_label="Spectrum",
):
"""Display estimated angle values
Args:
estimates: Angle estimates
num_signal: Number of signals
ground_truth: True incident angles
ticks_min (int, optional): Minimum value for x-axis ticks.
Defaults to -90.
ticks_max (int, optional): Maximum value for x-axis ticks.
Defaults to 90.
x_label (str, optional): x-axis label. Defaults to "Angle".
y_label (str, optional): y-axis label. Defaults to "Spetrum".
"""
"""Display estimated angle values"""
if unit == "deg":
estimated_azimuth = estimated_azimuth / 180 * np.pi

Expand Down
Loading

0 comments on commit dcc76bc

Please sign in to comment.