<commit_before>"""Compute the sound fields generated by a sound source"""

import numpy as np


def point(k, x0, x, y, z):
    """Acoustic point source"""
    xx, yy, zz = np.meshgrid(x - x0[0], y - x0[1], z - x0[2], sparse=True)
    r = np.sqrt((xx) ** 2 + (yy) ** 2 + (zz) ** 2)
    return np.squeeze(np.exp(-1j * k * r) / r)


def plane_wave(k, npw, x, y, z):
    """Acoustic plane wave"""
    xx, yy, zz = np.meshgrid(x, y, z, sparse=True)
    npw = np.asarray(npw)
    return np.squeeze(np.exp(-1j * k * np.inner(np.array([xx, yy, zz]), npw)))<commit_msg>Added line source<commit_after>"""Compute the sound fields generated by a sound source"""

import numpy as np


def point(k, x0, x, y, z):
    """Acoustic point source"""
    #              1  e^(-j k |x-x0|)
    # G(x-xs,w) = --- ---------------
    #             4pi      |x-x0|
    xx, yy, zz = np.meshgrid(x - x0[0], y - x0[1], z - x0[2], sparse=True)
    r = np.sqrt((xx) ** 2 + (yy) ** 2 + (zz) ** 2)
    return np.squeeze(np.exp(-1j * k * r) / r)


def line(k, x0, x, y, z):
    """Acoustic line source"""
    #              j   (2)
    # G(x-xs,w) =  -  H0  ( k |x-x0| )
    #              4
    xx, yy, zz = np.meshgrid(x - x0[0], y - x0[1], z - x0[2], sparse=True)
    r = np.sqrt((xx) ** 2 + (yy) ** 2 + (zz) ** 2)
    return np.squeeze(1j * np.hankel2(0, k * r))


def plane_wave(k, n, x, y, z):
    """Acoustic plane wave"""
    # G(x,w) = e^(-i w/c n x)
    xx, yy, zz = np.meshgrid(x, y, z, sparse=True)
    n = np.asarray(n)
    return np.squeeze(np.exp(-1j * k * np.inner(np.array([xx, yy, zz]), n)))
{'fraction_non_alphanumeric': 0.2238427393785669, 'fraction_numerical': 0.028535193405199746, 'mean_word_length': 2.1686746987951806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '53197', 'n_tokens_mistral': 712, 'n_tokens_neox': 696, 'n_words': 189}