removed iq_channel_models in transform.py
removed view_annotations from view.py
This commit is contained in:
parent
18395a0af8
commit
14539d9269
|
|
@ -101,6 +101,7 @@ pylint = "^3.2.6" # For pyreverse, to automate the creation of UML diagrams
|
|||
|
||||
[tool.poetry.scripts]
|
||||
ria = "ria_toolkit_oss.ria_toolkit_oss_cli.cli:cli"
|
||||
ria-tools = "ria_toolkit_oss.ria_toolkit_oss_cli.cli:cli"
|
||||
|
||||
[tool.black]
|
||||
line-length = 119
|
||||
|
|
|
|||
|
|
@ -655,7 +655,6 @@ class Recording:
|
|||
|
||||
return to_blue(recording=self, filename=filename, path=path, data_format=data_format, overwrite=overwrite)
|
||||
|
||||
|
||||
def trim(self, num_samples: int, start_sample: Optional[int] = 0) -> Recording:
|
||||
"""Trim Recording samples to a desired length, shifting annotations to maintain alignment.
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import os
|
|||
import re
|
||||
import struct
|
||||
from datetime import timezone
|
||||
from typing import Optional
|
||||
from typing import Any, List, Optional
|
||||
|
||||
import numpy as np
|
||||
|
|
@ -21,7 +20,6 @@ from sigmf.utils import get_data_type_str
|
|||
from ria_toolkit_oss.datatypes import Annotation
|
||||
from ria_toolkit_oss.datatypes.recording import Recording
|
||||
|
||||
|
||||
_BLUE_META_PREFIX = "META_"
|
||||
_BLUE_META_TAG_MAX_LEN = 60
|
||||
_BLUE_SKIP_METADATA_KEYS = {"blue_data_format", "blue_endian", "blue_keywords"}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ def determine_output_format(output, output_format, output_dir):
|
|||
# Main command
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("inputs", nargs=-1, required=True, type=click.Path(exists=True))
|
||||
@click.argument("output", nargs=1, required=True, type=click.Path())
|
||||
|
|
@ -302,7 +303,7 @@ def capture(
|
|||
Examples:
|
||||
utils capture -d hackrf -s 2e6 -f 2.44e6 -b 2e6
|
||||
utils capture -d pluto -s 1e6 -f 2e9 -b 2e6 -n 50
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Load config file if specified
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ from pathlib import Path
|
|||
|
||||
import click
|
||||
import numpy as np
|
||||
|
||||
from utils.data import Recording
|
||||
from utils.io import from_npy_legacy, load_recording
|
||||
from utils_cli.utils.common import (
|
||||
from ria_toolkit_oss_cli.ria_toolkit_oss.common import (
|
||||
echo_progress,
|
||||
echo_verbose,
|
||||
format_sample_count,
|
||||
save_recording,
|
||||
)
|
||||
|
||||
from ria_toolkit_oss.datatypes import Recording
|
||||
from ria_toolkit_oss.io import from_npy_legacy, load_recording
|
||||
|
||||
|
||||
def load_recording_list(inputs, legacy, verbose, quiet):
|
||||
recordings = []
|
||||
|
|
@ -395,10 +395,10 @@ def combine(
|
|||
Examples:
|
||||
# Concatenate recordings
|
||||
utils combine chunk1.npy chunk2.npy chunk3.npy full.npy
|
||||
\b
|
||||
\b
|
||||
# Add signal and noise
|
||||
utils combine signal.npy noise.npy noisy.npy --mode add\n
|
||||
\b
|
||||
\b
|
||||
# Add with center alignment
|
||||
utils combine long.npy short.npy output.npy --mode add --align-mode pad-center\n
|
||||
\b
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ from .convert import convert
|
|||
|
||||
# Import all command functions
|
||||
from .discover import discover
|
||||
from .generate import generate
|
||||
|
||||
# from .generate import generate
|
||||
from .init import init
|
||||
from .split import split
|
||||
from .transform import transform
|
||||
|
|
@ -17,9 +18,7 @@ from .transmit import transmit
|
|||
from .view import view
|
||||
|
||||
# Aliases
|
||||
synth = generate
|
||||
# synth = generate
|
||||
|
||||
# All commands will be automatically registered by cli.py
|
||||
# Commands must be click.Command instances
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import click
|
|||
import yaml
|
||||
|
||||
from ria_toolkit_oss.datatypes.recording import Recording
|
||||
from src.ria_toolkit_oss.io.recording import to_blue, to_npy, to_sigmf, to_wav
|
||||
from ria_toolkit_oss.io.recording import to_blue, to_npy, to_sigmf, to_wav
|
||||
|
||||
|
||||
def load_yaml_config(config_file: str) -> Dict[str, Any]:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,15 @@ import os
|
|||
from pathlib import Path
|
||||
|
||||
import click
|
||||
from ria_toolkit_oss_cli.ria_toolkit_oss.common import (
|
||||
check_for_overwriting,
|
||||
detect_file_format,
|
||||
echo_progress,
|
||||
echo_verbose,
|
||||
format_sample_count,
|
||||
)
|
||||
|
||||
from utils.io.recording import (
|
||||
from ria_toolkit_oss.io.recording import (
|
||||
from_npy,
|
||||
load_recording,
|
||||
to_blue,
|
||||
|
|
@ -13,13 +20,6 @@ from utils.io.recording import (
|
|||
to_sigmf,
|
||||
to_wav,
|
||||
)
|
||||
from utils_cli.utils.common import (
|
||||
check_for_overwriting,
|
||||
detect_file_format,
|
||||
echo_progress,
|
||||
echo_verbose,
|
||||
format_sample_count,
|
||||
)
|
||||
|
||||
from .config import load_user_config
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ def convert( # noqa: C901
|
|||
|
||||
If OUTPUT is not specified, the input filename is used with a new extension
|
||||
based on the --format option.
|
||||
|
||||
|
||||
\b
|
||||
Examples:
|
||||
# SigMF to NumPy (explicit output)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,9 +4,7 @@ from pathlib import Path
|
|||
|
||||
import click
|
||||
import numpy as np
|
||||
|
||||
from utils.io import from_npy_legacy, load_recording
|
||||
from utils_cli.utils.common import (
|
||||
from ria_toolkit_oss_cli.ria_toolkit_oss.common import (
|
||||
detect_file_format,
|
||||
echo_progress,
|
||||
echo_verbose,
|
||||
|
|
@ -14,6 +12,8 @@ from utils_cli.utils.common import (
|
|||
save_recording,
|
||||
)
|
||||
|
||||
from ria_toolkit_oss.io import from_npy_legacy, load_recording
|
||||
|
||||
|
||||
def get_output_extension(format_name):
|
||||
"""Get file extension for format name."""
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@ import os
|
|||
from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
from utils.data.recording import Recording
|
||||
from utils.io.recording import load_recording
|
||||
from utils.transforms import iq_augmentations, iq_channel_models, iq_impairments
|
||||
from utils_cli.utils.common import (
|
||||
from ria_toolkit_oss_cli.ria_toolkit_oss.common import (
|
||||
echo_progress,
|
||||
echo_verbose,
|
||||
format_sample_count,
|
||||
save_recording,
|
||||
)
|
||||
|
||||
from ria_toolkit_oss.datatypes.recording import Recording
|
||||
from ria_toolkit_oss.io.recording import load_recording
|
||||
from ria_toolkit_oss.transforms import iq_augmentations, iq_impairments
|
||||
|
||||
|
||||
def get_available_transforms(module):
|
||||
"""Get list of public transform functions from a module.
|
||||
|
|
@ -89,7 +89,7 @@ def show_transform_help(transform_name, func):
|
|||
def quick_view_transform(recording, output_path, title="Transform Result"):
|
||||
"""Create a quick PNG visualization of transformed recording using constellation plot."""
|
||||
try:
|
||||
from utils.view.view_signal_simple import view_simple_sig
|
||||
from ria_toolkit_oss.view.view_signal_simple import view_simple_sig
|
||||
|
||||
# Create PNG in same directory as output
|
||||
output_dir = Path(output_path).parent
|
||||
|
|
@ -249,6 +249,7 @@ def load_input(input, verbose):
|
|||
echo_verbose(f"Loaded {format_sample_count(recording.data.shape[-1])} samples", verbose)
|
||||
return recording
|
||||
|
||||
|
||||
@click.group()
|
||||
def transform():
|
||||
"""Apply signal transformations to recordings.
|
||||
|
|
@ -260,20 +261,20 @@ def transform():
|
|||
|
||||
Each operation is applied independently. Chain multiple transforms by
|
||||
running this command multiple times.
|
||||
|
||||
|
||||
\b
|
||||
Examples:
|
||||
# List available augmentations
|
||||
utils transform augment --list
|
||||
# List available augmentations
|
||||
ria_toolkit_oss transform augment --list
|
||||
\b
|
||||
# Apply channel swap
|
||||
utils transform augment channel_swap input.npy
|
||||
ria_toolkit_oss transform augment channel_swap input.npy
|
||||
\b
|
||||
# Apply AWGN impairment
|
||||
utils transform impair awgn input.npy --snr-db 15
|
||||
ria_toolkit_oss transform impair awgn input.npy --snr-db 15
|
||||
\b
|
||||
# Apply Rayleigh fading channel
|
||||
utils transform apply_channel rayleigh input.npy --num-paths 5
|
||||
ria_toolkit_oss transform apply_channel rayleigh input.npy --num-paths 5
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
@ -299,19 +300,19 @@ def augment(augmentation, input, output, list_transforms, help_transform, params
|
|||
|
||||
# List all augmentations
|
||||
\b
|
||||
utils transform augment --list
|
||||
ria_toolkit_oss transform augment --list
|
||||
|
||||
# Show parameters for an augmentation
|
||||
\b
|
||||
utils transform augment channel_swap --help-transform
|
||||
ria_toolkit_oss transform augment channel_swap --help-transform
|
||||
|
||||
# Apply augmentation
|
||||
\b
|
||||
utils transform augment channel_swap input.npy
|
||||
ria_toolkit_oss transform augment channel_swap input.npy
|
||||
|
||||
# Apply with parameters and save visualization
|
||||
\b
|
||||
utils transform augment drop_samples input.npy --params max_section_size=5 --view
|
||||
ria_toolkit_oss transform augment drop_samples input.npy --params max_section_size=5 --view
|
||||
"""
|
||||
available = get_available_transforms(iq_augmentations)
|
||||
|
||||
|
|
@ -406,19 +407,19 @@ def impair(impairment, input, output, list_transforms, help_transform, params, v
|
|||
|
||||
# List all impairments
|
||||
\b
|
||||
utils transform impair --list
|
||||
ria_toolkit_oss transform impair --list
|
||||
|
||||
# Show parameters for an impairment
|
||||
\b
|
||||
utils transform impair add_awgn_to_signal --help-transform
|
||||
ria_toolkit_oss transform impair add_awgn_to_signal --help-transform
|
||||
|
||||
# Apply impairment
|
||||
\b
|
||||
utils transform impair add_awgn_to_signal input.npy --params snr=10
|
||||
ria_toolkit_oss transform impair add_awgn_to_signal input.npy --params snr=10
|
||||
|
||||
# Apply with visualization
|
||||
\b
|
||||
utils transform impair add_phase_noise input.npy --params phase_variance=0.001 --view
|
||||
ria_toolkit_oss transform impair add_phase_noise input.npy --params phase_variance=0.001 --view
|
||||
"""
|
||||
available = get_available_transforms(iq_impairments)
|
||||
|
||||
|
|
@ -514,10 +515,10 @@ def apply_channel(
|
|||
|
||||
\b
|
||||
Examples:
|
||||
utils transform apply_channel rayleigh_fading_channel input.npy --params num_paths=3 snr_db=15
|
||||
ria_toolkit_oss transform apply_channel rayleigh_fading_channel input.npy --params num_paths=3 snr_db=15
|
||||
|
||||
\b
|
||||
utils transform apply_channel doppler_channel recordings/input.npy \\
|
||||
ria_toolkit_oss transform apply_channel doppler_channel recordings/input.npy \\
|
||||
--params satellite_velocity=7500 \\
|
||||
--params satellite_initial_distance=400000 \\
|
||||
--params frequency=1e9 \\
|
||||
|
|
@ -637,19 +638,19 @@ def custom(
|
|||
|
||||
# List all custom transforms in directory
|
||||
\b
|
||||
utils transform custom --transform-dir ~/my_transforms --list
|
||||
ria_toolkit_oss transform custom --transform-dir ~/my_transforms --list
|
||||
|
||||
# Show parameters for a transform
|
||||
\b
|
||||
utils transform custom my_filter --transform-dir ~/my_transforms --help-transform
|
||||
ria_toolkit_oss transform custom my_filter --transform-dir ~/my_transforms --help-transform
|
||||
|
||||
# Apply custom transform
|
||||
\b
|
||||
utils transform custom my_filter input.npy --transform-dir ~/my_transforms
|
||||
ria_toolkit_oss transform custom my_filter input.npy --transform-dir ~/my_transforms
|
||||
|
||||
# With parameters and visualization
|
||||
\b
|
||||
utils transform custom my_filter input.npy --transform-dir ~/my_transforms \\
|
||||
ria_toolkit_oss transform custom my_filter input.npy --transform-dir ~/my_transforms \\
|
||||
--params cutoff_freq=5000 order=4 --view
|
||||
"""
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import time
|
|||
|
||||
import click
|
||||
|
||||
from utils.data import Recording
|
||||
from utils.io import from_npy_legacy, load_recording
|
||||
from ria_toolkit_oss.datatypes import Recording
|
||||
from ria_toolkit_oss.io import from_npy_legacy, load_recording
|
||||
|
||||
from .common import (
|
||||
echo_progress,
|
||||
|
|
@ -374,12 +374,12 @@ def transmit(
|
|||
quiet,
|
||||
):
|
||||
"""Transmit IQ samples from file using SDR device.
|
||||
|
||||
|
||||
\b
|
||||
Examples:
|
||||
utils transmit -d hackrf --generate lfm --continuous
|
||||
utils transmit -d pluto -f 2.44G -g -10 -in recordings/rec_HackRF_2MHz_2025-12-01_15-36-21_80fc33f.sigmf-data
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Load config file if specified
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ from typing import Optional
|
|||
|
||||
import click
|
||||
|
||||
from utils.io.recording import from_npy, load_recording
|
||||
from utils.view.view_signal import view_annotations, view_channels, view_sig
|
||||
from utils.view.view_signal_simple import view_simple_sig
|
||||
from ria_toolkit_oss.io.recording import from_npy, load_recording
|
||||
from ria_toolkit_oss.view.view_signal import view_channels, view_sig
|
||||
from ria_toolkit_oss.view.view_signal_simple import view_simple_sig
|
||||
|
||||
from .common import echo_progress, echo_verbose, load_yaml_config
|
||||
|
||||
|
|
@ -34,11 +34,6 @@ VISUALIZATION_TYPES = {
|
|||
"spines",
|
||||
],
|
||||
},
|
||||
"annotations": {
|
||||
"function": view_annotations,
|
||||
"description": "Annotation-focused spectrogram view",
|
||||
"options": ["channel", "dark"],
|
||||
},
|
||||
"channels": {"function": view_channels, "description": "Multi-channel IQ and spectrogram view", "options": []},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ def set_spines(ax, spines):
|
|||
ax.spines["bottom"].set_visible(False)
|
||||
ax.spines["left"].set_visible(False)
|
||||
|
||||
|
||||
def view_channels(
|
||||
recording: Recording,
|
||||
output_path: Optional[str] = "images/signal.png",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user