# Path: thrifty/toads_data.py
# class DetectionResult(object):
#     def __init__(self, timestamp, block, soa, carrier_info, corr_info,
#                  rxid=None, txid=None):
#     def serialize(self):
#     def deserialize(cls, string, with_rxid=False, with_txid=False):
# def _load_toads(stream, with_rxid=True, with_txid=True):
# def load_toad(stream):
# def load_toads(stream):
# def toads_array(detections, with_ids=True):
# 
# Path: thrifty/util.py
# def snr(peak_ampl, noise_rms):
# def fft_bin(idx, fft_len):
# def find_nearest(array, values):
# 
# Path: thrifty/matchmaker.py
# def match_toads(toads, window, min_match=2):
# def load_matches(file_):
# def save_matches(matches, file_):
# def extract_match_matrix(detections, matches, rxids, txids=None):
# def _main():


import argparse
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
from thrifty import toads_data
from thrifty import util
from thrifty import matchmaker

    peak = data['carrier_energy']
    print("Carrier peak: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(peak), np.std(peak), np.min(peak), np.max(peak)))

    noise = data['carrier_noise']
    print("Carrier noise: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(noise), np.std(noise), np.min(noise), np.max(noise)))

    snr = util.snr(peak, noise)
    print("Carrier SNR (dB): mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(snr), np.std(snr), np.min(snr), np.max(snr)))

    freq = data['carrier_bin']
    print("Carrier bin: mean={:.0f}, std={:.3f}, min={:.0f}, max={:.0f}"
          .format(np.mean(freq), np.std(freq), np.min(freq), np.max(freq)))

    offset = data['carrier_offset']
    print("Carrier offset: mean={:.3f}, std={:.3f}, min={:.3f}, max={:.3f}"
          .format(np.mean(offset), np.std(offset),
                  np.min(offset), np.max(offset)))

    peak = data['energy']
    print("Corr peak: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(peak), np.std(peak), np.min(peak), np.max(peak)))

    noise = data['noise']
    print("Corr noise: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(noise), np.std(noise), np.min(noise), np.max(noise)))


# Path: thrifty/toads_data.py
# class DetectionResult(object):
#     def __init__(self, timestamp, block, soa, carrier_info, corr_info,
#                  rxid=None, txid=None):
#     def serialize(self):
#     def deserialize(cls, string, with_rxid=False, with_txid=False):
# def _load_toads(stream, with_rxid=True, with_txid=True):
# def load_toad(stream):
# def load_toads(stream):
# def toads_array(detections, with_ids=True):
# 
# Path: thrifty/util.py
# def snr(peak_ampl, noise_rms):
# def fft_bin(idx, fft_len):
# def find_nearest(array, values):
# 
# Path: thrifty/matchmaker.py
# def match_toads(toads, window, min_match=2):
# def load_matches(file_):
# def save_matches(matches, file_):
# def extract_match_matrix(detections, matches, rxids, txids=None):
# def _main():


# Path: thrifty/toads_analysis.py
import argparse
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
from thrifty import toads_data
from thrifty import util
from thrifty import matchmaker


    peak = data['carrier_energy']
    print("Carrier peak: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(peak), np.std(peak), np.min(peak), np.max(peak)))

    noise = data['carrier_noise']
    print("Carrier noise: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(noise), np.std(noise), np.min(noise), np.max(noise)))

    snr = util.snr(peak, noise)
    print("Carrier SNR (dB): mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(snr), np.std(snr), np.min(snr), np.max(snr)))

    freq = data['carrier_bin']
    print("Carrier bin: mean={:.0f}, std={:.3f}, min={:.0f}, max={:.0f}"
          .format(np.mean(freq), np.std(freq), np.min(freq), np.max(freq)))

    offset = data['carrier_offset']
    print("Carrier offset: mean={:.3f}, std={:.3f}, min={:.3f}, max={:.3f}"
          .format(np.mean(offset), np.std(offset),
                  np.min(offset), np.max(offset)))

    peak = data['energy']
    print("Corr peak: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(peak), np.std(peak), np.min(peak), np.max(peak)))

    noise = data['noise']
    print("Corr noise: mean={:.1f}, std={:.2f}, min={:.1f}, max={:.1f}"
          .format(np.mean(noise), np.std(noise), np.min(noise), np.max(noise)))


    snr = util.snr(peak, noise)