airpack.tf2.fileio

Module Contents

airpack.tf2.fileio.bytes2signal(inset, dtype=tf.int16, scalar=1.0)

Inputs a set of raw data (bytes), decodes it to dtype. It then normalizes to be between (-1, 1) if the data type is an integer.

Parameters
  • inset (bytes) – Inputs a set of raw data (bytes)

  • dtype (tensorflow.dtypes.DType) – dtype to convert raw data to (tf.int16 or tf.float32)

  • scalar (float) – Scalar gain value (linear units)

Returns

A Tensor object storing the decoded bytes.

Return type

tensorflow.Tensor

airpack.tf2.fileio.pars_folder(datapath, shuffle=True)

Recursively find all files with the “.bin” extension in the data path and shuffle the data set if requested.

Note

The numeric label is the name of the bottom-most folder in the tree of data: e.g., for file ‘data/train/x/y/file.bin’, the label is ‘y’.

Parameters
  • datapath (Union[str, os.PathLike]) – Directory that the data resides in

  • shuffle (bool) – Shuffle the data set if requrested

Returns

(filenames, labels)

Return type

Tuple[List[str], List[int]]

airpack.tf2.fileio.datareader(data_folder, input_len, output_len, batch_size, dtype=tf.dtypes.DType, nthread=4, buffer_size=16, interweaved=True, scalar=1.0)

Data pipeline optimized for reading signal data (I/Q) and feeding it to a deep learning model.

Parameters
  • data_folder (Union[str, os.PathLike]) – Directory that the data resides in

  • input_len (int) – Number of complex samples as the input to the neural network.

  • output_len (int) – Number of labels possible (defines output layer length)

  • batch_size (int) – Number of batches to read for each iteration

  • dtype – dtype of the data in datafiles

  • nthread (int) – Number of CPU threads to use when pipelining data reads

  • buffer_size (int) – Buffer size used for shuffling the data

  • interweaved (bool) – Is data interweaved I/Q or not

  • scalar (float) – scalar multiplied by signal for data normalization

Returns

The tensorflow Dataset object

Return type

tensorflow.data.Dataset