AmmosReader 0.314 documentation

This Page

ammosreader package

Submodules

ammosreader.AmmosAudioDataHeader module

I provide an AMMOS data header for audio data frames.

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

Bases: object

I implement an AMMOS data header for audio data frames.

HEADER_SIZE = 36
classmethod from_bytes(bytes)[source]

I return an AMMOS data header from given bytes.

ammosreader.AmmosAudioReader module

I provide a specialized Ammos Reader for audio data.

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

Bases: ammosreader.AbstractAmmosReader.AbstractAmmosReader

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

pcm_for_channel(a_channel)[source]

I return the raw pcm audio data for a given channel.

Parameters

a_channel (int) – the channel I have to extract

Return type

bytes

read_next_audio_data_body(number_of_samples, number_of_channels, sample_size)[source]

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

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

  • number_of_channels (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(data_header_length)[source]

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

Parameters

global_frame_header

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

ammosreader.AmmosAudioSocketReader module

I read a Ammos datastream from a socket.

class ammosreader.AmmosAudioSocketReader.AmmosAudioSocketReader(socket: socket.socket, debug=True)[source]

Bases: object

read_next_frame() tuple[numpy.ndarray, int][source]

Reads the next ammos audio frame from socket

Raises

TimeoutError – Raisees TimeoutError if the socket does not serve data anymore

Returns

Contains the audio data and the sample rate

Return type

tuple[np.ndarray, int]

ammosreader.AmmosContainer module

I store the content of an R&S Ammos file in a more accessible way.

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

Bases: object

add_frame(frame)[source]
add_tag(tag)[source]
data_only()[source]
frequencies()[source]
property global_frames
property name
size()[source]

ammosreader.AmmosExtendedAudioDataHeader module

I provide an Ammos extended data header for audio data frames.

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

Bases: object

HEADER_SIZE = 44
classmethod from_bytes(bytes)[source]

I return a new AMMOS extended data header for audio frames built from given bytes.

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

I implement an Ammos extended data header for IF data frames.

HEADER_SIZE = 76
classmethod from_bytes(bytes)[source]

I return an AMMOS extended data header from given bytes.

ammosreader.AmmosGlobalFrameBody module

I provide an AMMOS global frame body.

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

Bases: object

I implement an AMMOS global frame body.

AMMOS frames can store data of various types. The data is described in the data header. The raw data is then stored in the data body.

property data_body
data_bytes_only()[source]
property data_header

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(header, data)[source]

Bases: object

property data
property header

ammosreader.AmmosIFDataHeader module

I provide a Ammos data header for IF data frames.

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

I implement an Ammos data header for IF data frames.

HEADER_SIZE = 56
classmethod from_bytes(bytes)[source]

I return an AMMOS data header from given bytes.

ammosreader.AmmosIFReader module

I provide a specialized Ammos Reader for IF data.

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

Bases: ammosreader.AbstractAmmosReader.AbstractAmmosReader

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

data()[source]
read_next_global_frame_body(data_header_length)[source]

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

Parameters

data_header_length (int) – the length of the data header

read_next_global_frame_body_data_header()[source]
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 Extended IF data header or None if incomplete

Return type

AmmosExtendedIFDataHeader

read_next_if_data_body(number_of_data_blocks, data_length)[source]

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

Parameters
  • number_of_data_blocks (int) – the number of data blocks inside the body

  • data_length (int) – the length of the raw data inside a single block

ammosreader.AmmosSingleFrame module

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

Bases: object

data()[source]
property global_frame_body
property global_frame_header
size_correct()[source]

ammosreader.IQDWTXBlock module

class ammosreader.IQDWTXBlock.IQDWTXBLOCK(pdw, iq)[source]

Bases: object

classmethod from_bytes(byte_string)[source]

ammosreader.PDW module

I store the information of a single PDW block.

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]

I return an instance of an Pulse Data word.

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 – elevation of incoming signal (from -90 to 90 degree) in steps of 0.1 degree

minus 102.4 means unknown :type elevation: Float :param azimuth: azimuth of incoming signal (from 0 to 359.9 degree) in steps of 0.1 degree plus 409.5 means unknown :type azimuth: Float :param channel: detecting channel (0-16) - Zero means unknown :type channel: Integer :return: An instance of class PDW with attributes set according to the data of a data body :rtype: 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

to_json()[source]

ammosreader.PPDWContainer module

class ammosreader.PPDWContainer.PPDWContainer(name, signals=None)[source]

Bases: object

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

add(a_pdw)[source]
bandwidths()[source]
center_frequencies()[source]
channels()[source]
end_time()[source]
julian_date_string()[source]
modulations()[source]
start_time()[source]
to_json()[source]

Module contents