AmmosReader 0.314 documentation

This Page

ammosreader package

Submodules

ammosreader.AmmosAudioDataHeader module

class ammosreader.AmmosAudioDataHeader.AmmosAudioDataHeader(sample_rate, status, frequency, demod_bandwidth, demod_type, sample_count, channel_count, sample_size)[source]

Bases: object

classmethod from_bytes(bytes)[source]
class ammosreader.AmmosAudioDataHeader.AmmosAudioDemodType(demod_type)[source]

Bases: object

class property mapping

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

ammosreader.AmmosAudioReader module

I parse an R&S AMMOS recording.

class ammosreader.AmmosAudioReader.AmmosAudioReader(file_name)[source]

Bases: object

I read the audio data embedded in an R&S AMMOS recording.

EXTENDED_AUDIO_DATA_HEADER_SIZE = 44
GLOBAL_HEADER_SIZE = 24
STANDARD_AUDIO_DATA_HEADER_SIZE = 36
add_tag(tag)[source]

I add a tag to my tag list.

Parameters

tag (dict) – The tag to add to my tag list

read_all_frames_left()[source]

I read all remaining frames into my container until end of file is reached.

Returns

a container containing all frames read

Return type

AmmosContainer

read_next_audio_data_body(sample_count, channel_count, sample_size)[source]

I return the next audio data read from current position in file.

Parameters
  • sample_count (int) – the number of samples per channel inside data body

  • channel_count (int) – number of channels (e.g. mono, stereo or even more)

  • sample_size (int) – sample size in bytes (1, 2 or 4 bytes)

Returns

the next audio data or None if incomplete

Return type

bytes

read_next_global_frame_body(global_frame_header)[source]
read_next_global_frame_body_data_header()[source]

I return the next global frame body data header from current position in file.

Parameters

data_header_size (int) – the number of bytes to read

Returns

the next Ammos Audio Data header or None if incomplete

Return type

AmmosAudioDataHeader

read_next_global_frame_body_extended_data_header()[source]

I return the next global frame body extended data header from current position in file.

Returns

the next Ammos Audio Extended Data header or None if incomplete

Return type

AmmosExtendedAudioDataHeader

read_next_global_frame_header()[source]

I return the next global frame header read from current position in file.

Returns

the next global frame header or None if incomplete

Return type

AmmosGlobalFrameHeader

read_next_single_frame()[source]
rewind_to_start()[source]

I set the file pointer to the beginning of the file for the next operation.

ammosreader.AmmosAudioSocketReader module

class ammosreader.AmmosAudioSocketReader.AmmosAudioSocketReader(socket: socket.socket)[source]

Bases: object

read_next_frame() tuple[bytearray, int][source]

reads the next ammos audio frame

Returns:

tuple[bytearray, int]: contains the audio data and the sample rate

ammosreader.AmmosContainer module

class ammosreader.AmmosContainer.AmmosContainer(name, frames)[source]

Bases: object

add_frame(frame)[source]
add_tag(tag)[source]
frequencies()[source]
size()[source]

ammosreader.AmmosExtendedAudioDataHeader module

class ammosreader.AmmosExtendedAudioDataHeader.AmmosExtendedAudioDataHeader(sample_rate, status, frequency, demod_bandwidth, demod_type, sample_count, channel_count, sample_size, timestamp)[source]

Bases: object

classmethod from_bytes(bytes)[source]

ammosreader.AmmosExtendedIFDataHeader module

class ammosreader.AmmosExtendedIFDataHeader.AmmosExtendedIFDataHeader(size, block_count, block_length, timestamp, status, source_id, source_state, frequency, bandwidth, sample_rate, interpolation, decimation, voltage_ref, stream_start, sample_counter, antenna_correction)[source]

Bases: object

classmethod from_bytes(bytes)[source]

ammosreader.AmmosGlobalFrameBody module

class ammosreader.AmmosGlobalFrameBody.AmmosGlobalFrameBody(data_header, data_body)[source]

Bases: object

data_bytes_only()[source]

ammosreader.AmmosGlobalFrameHeader module

class ammosreader.AmmosGlobalFrameHeader.AmmosGlobalFrameHeader(magic_word, frame_length, running_frame_number, frame_type, data_header_length, reserved)[source]

Bases: object

MAGIC_WORD = '726574fb'
classmethod from_bytes(bytes)[source]
size()[source]

ammosreader.AmmosIFDataBlock module

class ammosreader.AmmosIFDataBlock.AmmosIFDataBlock(if_datablock_header, if_data)[source]

Bases: object

ammosreader.AmmosIFDataHeader module

class ammosreader.AmmosIFDataHeader.AmmosIFDataHeader(block_count, block_length, timestamp, status, source_id, source_state, frequency, bandwidth, sample_rate, interpolation, decimation, voltage_ref)[source]

Bases: object

classmethod from_bytes(bytes)[source]
header_size()[source]

ammosreader.AmmosIFReader module

class ammosreader.AmmosIFReader.AmmosIFReader(file_name)[source]

Bases: object

add_tag(tag)[source]
read_all_frames_left()[source]
read_next_global_frame_body(global_frame_header)[source]
read_next_global_frame_body_data_header()[source]
read_next_global_frame_body_extended_data_header()[source]
read_next_global_frame_header()[source]
read_next_if_data_blocks(n, length)[source]
read_next_single_frame()[source]
rewind_to_start()[source]

ammosreader.AmmosSingleFrame module

class ammosreader.AmmosSingleFrame.AmmosSingleFrame(global_frame_header, global_frame_body)[source]

Bases: object

data()[source]
size_correct()[source]

ammosreader.IQDWTXBlock module

ammosreader.PDW module

class ammosreader.PDW.PDW(time_of_arrival, pdw_format_identifier, center_frequency, is_valid, is_pulse, level_unit, signal_start_missing, signal_end_missing, pulse_width, frequency_shift_or_bandwidth, pulse_level_or_pulse_field_strength, region_of_interest, azimuth_confidence, modulation, sector, polarity, df_quality, elevation, azimuth, channel)[source]

Bases: object

I store information from a single ppdw data block.

__init__(time_of_arrival, pdw_format_identifier, center_frequency, is_valid, is_pulse, level_unit, signal_start_missing, signal_end_missing, pulse_width, frequency_shift_or_bandwidth, pulse_level_or_pulse_field_strength, region_of_interest, azimuth_confidence, modulation, sector, polarity, df_quality, elevation, azimuth, channel)[source]
Parameters
  • time_of_arrival (Integer) – nanoseconds since 1970-01-01 00:00:00

  • pdw_format (Integer) – format code

  • center_frequency (Integer) – center frequency in KHz

  • is_valid (Boolean) – flag to mark if pdw data body is valid

  • is_pulse (Boolean) – flag to mark if pdw data body contains a pulse or a continuous wave signal

  • level_unit (Integer) – 0 means dBµV - 1 means dBµV/m

  • signal_start_missing (Boolean) – signal started before time of arrival

  • signal_end_missing (Boolean) – signal stops after time of arrival

  • pulse_width (Integer) – pulse width in nanoseconds - Zero if no valid pulse detected

  • frequency_shift_or_bandwidth (Integer) – Value in KHz - Value set to 1048575 means Unknown

  • pulse_level_or_pulse_field_strength (Float) – Pulse level or Pulse Field Strength depending on level_unit (-200.0…200.0) in 0.1 steps / minus 204.8 means no valid level detected

  • region_of_interest (Boolean) – Marks if signal is from region of interest

  • azimuth_confidence (Float) – degree in steps of 0.1 (0.0-6.2) / 6.3 means confidence unknown

  • modulation (String) – type of modulation (e.g. PSK-2, PSK-4, FM etc.)

  • sector (Integer) – reference antenna sector (0-15)

  • polarity (String) – Horizontal, Vertical, Clockwise, Counter clockwise

  • df_quality (Integer) – Direction finding quality in percent (0-100) - Zero means unknown

  • elevation (Float) – elevation of incoming signal (from -90 to 90 degree) in steps of 0.1 degree minus 102.4 means unknown

  • azimuth (Float) – azimuth of incoming signal (from 0 to 359.9 degree) in steps of 0.1 degree plus 409.5 means unknown

  • channel (Integer) – detecting channel (0-16) - Zero means unknown

Returns

An instance of class PDW with attributes set according to the data of a data body

Return type

PDW

classmethod from_bytes(byte_string)[source]

I create an instance of class PDW from data body (8 * 32 bits)

Parameters

byte_string (byte string) – a byte string containing a single data body read from a ppdw file

Returns

an instance of class PDW with attributes set according to the data of a data body

Return type

PDW

ammosreader.PPDWContainer module

class ammosreader.PPDWContainer.PPDWContainer(signals)[source]

Bases: object

I store multiple signals imported from one or more .ppdw files

__init__(signals)[source]

Module contents