<commit_before>/*
 * Copyright (c) 2007, 2009 <NAME>
 * Copyright (c) 2007, 2009 Virginia Polytechnic Institute & State University
 *
 * This file is part of liquid.
 *
 * liquid is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * liquid is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with liquid.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __MODEM_PHASE_ERROR_AUTOTEST_H__
#define __MODEM_PHASE_ERROR_AUTOTEST_H__

#include <stdio.h>

#include "autotest/autotest.h"
#include "liquid.h"

// Helper function to keep code base small
void modem_test_phase_error(modulation_scheme _ms, unsigned int _bps)
{
    // generate mod/demod
    modem mod = modem_create(_ms, _bps);
    modem demod = modem_create(_ms, _bps);

    // run the test
    unsigned int i, s, M=1<<_bps;
    float complex x;
    float complex x_phi_pos;    // positive phase error demod input
    float complex x_phi_neg;    // negative phase error demod input
    float phase_error;
    float phi = 0.01f;

    for (i=0; i<M; i++) {
        // modulate symbol
        modem_modulate(mod, i, &x);

        // add phase offsets
        x_phi_pos = x * cexpf( phi*_Complex_I);
        x_phi_neg = x * cexpf(-phi*_Complex_I);<commit_msg>modem|autotest: adding condition to test for magnitude of modulated symbol; ignore test if zero<commit_after>/*
 * Copyright (c) 2007, 2009 <NAME>
 * Copyright (c) 2007, 2009 Virginia Polytechnic Institute & State University
 *
 * This file is part of liquid.
 *
 * liquid is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * liquid is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with liquid.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __MODEM_PHASE_ERROR_AUTOTEST_H__
#define __MODEM_PHASE_ERROR_AUTOTEST_H__

#include <stdio.h>

#include "autotest/autotest.h"
#include "liquid.h"

// Helper function to keep code base small
void modem_test_phase_error(modulation_scheme _ms, unsigned int _bps)
{
    // generate mod/demod
    modem mod = modem_create(_ms, _bps);
    modem demod = modem_create(_ms, _bps);

    // run the test
    unsigned int i, s, M=1<<_bps;
    float complex x;
    float complex x_phi_pos;    // positive phase error demod input
    float complex x_phi_neg;    // negative phase error demod input
    float phase_error;
    float phi = 0.01f;

    for (i=0; i<M; i++) {
        // modulate symbol
        modem_modulate(mod, i, &x);

        // ignore rare condition where modulated symbol is (0,0)
        // (e.g. APSK-8)
        if (cabsf(x) < 1e-3f) continue;

        // add phase offsets
        x_phi_pos = x * cexpf( phi*_Complex_I);
        x_phi_neg = x * cexpf(-phi*_Complex_I);
{'fraction_non_alphanumeric': 0.08627008739780095, 'fraction_numerical': 0.01381449111925571, 'mean_word_length': 3.223809523809524, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1877759', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1082, 'n_words': 428}