<commit_before># coding: utf-8

""" Test action-angle stuff """

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Standard library
from collections import OrderedDict
import logging
import os
import re

# Third-party
import astropy.coordinates as coord
import astropy.units as u
from astropy import log as logger
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelmax

# Project
from ..naff import NAFF, poincare_polar
from ...integrate import DOPRI853Integrator
from ... import potential as gp
from ... import dynamics as gd
from ...units import galactic

plot_path = "plots/tests/dynamics/naff"
if not os.path.exists(plot_path):
    os.makedirs(plot_path)

logger.important("Plots located at: {}".format(plot_path))

# TODO: config item to specify path to test data?
test_data_path = os.path.abspath(os.path.join(os.path.split(__file__)[0],
                                 "../../../test-data/"))

logger.setLevel(logging.DEBUG)


def test_simple_f():
    true_ws = 2*np.pi*np.array([0.581, 0.73])
    true_as = np.array([5*(np.cos(np.radians(15.)) + 1j*np.sin(np.radians(15.))),
                        1.8*(np.cos(np.radians(85.)) + 1j*np.sin(np.radians(85.)))])
    true_A = np.sqrt(true_as.imag**2 + true_as.real**2)
    true_phi = np.arctan2(true_as.imag, true_as.real)
<commit_msg>stuck<commit_after># coding: utf-8

""" Test action-angle stuff """

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Standard library
from collections import OrderedDict
import logging
import os
import re

# Third-party
import astropy.coordinates as coord
import astropy.units as u
from astropy import log as logger
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelmax

# Project
from ..naff import NAFF, poincare_polar
from ...integrate import DOPRI853Integrator
from ... import potential as gp
from ... import dynamics as gd
from ...units import galactic

plot_path = "plots/tests/dynamics/naff"
if not os.path.exists(plot_path):
    os.makedirs(plot_path)

logger.important("Plots located at: {}".format(plot_path))

# TODO: config item to specify path to test data?
test_data_path = os.path.abspath(os.path.join(os.path.split(__file__)[0],
                                 "../../../test-data/"))

logger.setLevel(logging.DEBUG)

def test_cy_naff():
    from .._naff import naff_frequency

    t = np.linspace(0., 300., 12000)
    naff = gd.NAFF(t)

    true_ws = 2*np.pi*np.array([0.581, 0.73])
    true_as = np.array([5*(np.cos(np.radians(15.)) + 1j*np.sin(np.radians(15.))),
                        1.8*(np.cos(np.radians(85.)) + 1j*np.sin(np.radians(85.)))])
    f = np.sum(true_as[None] * np.exp(1j * true_ws[None] * t[:,None]), axis=1)

    naff_frequency(naff.tz, naff.chi,
                   np.ascontiguousarray(f.real),
                   np.ascontiguousarray(f.imag),
                   naff.T)

def test_simple_f():
    true_ws = 2*np.pi*np.array([0.581, 0.73])
    true_as = np.array([5*(np.cos(np.radians(15.)) + 1j*np.sin(np.radians(15.))),
                        1.8*(np.cos(np.radians(85.)) + 1j*np.sin(np.radians(85.)))])
    true_A = np.sqrt(true_as.imag**2 + true_as.real**2)
    true_phi = np.arctan2(true_as.imag, true_as.real)

{'fraction_non_alphanumeric': 0.14652014652014653, 'fraction_numerical': 0.027472527472527472, 'mean_word_length': 3.2175032175032174, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5373642', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1182, 'n_words': 263}