<commit_before>''' Example that creates a 3D pixel array with a given geometry (number of pixels in x/y, height, width, and readout columns per pixel)
    and calculates the potential and fields.

    .. WARNING::
       The calculation of a partially depleted sensor is not supported right now.
'''

from scarce import fields, plot, geometry, silicon


def sensor_3D():
    # Number of pixels influences how correct the field for the
    # center pixel(s) is due to more correct boundary condition
    n_pixel_x, n_pixel_y = 1, 1

    # Geometry of one pixel
    width_x = 250.
    width_y = 50.
    radius = 6.
    nD = 2  # Number of columns per pixel

    n_eff = 0.8e13  # n_eff [cm^-3]
    temperature = 300

    # Potentials
    V_bias = -200.
    V_readout = 0.
    V_bi = -silicon.get_diffusion_potential(n_eff, temperature)

    mesh = geometry.mesh_3D_sensor(width_x=width_x,
                                   width_y=width_y,
                                   n_pixel_x=n_pixel_x,
                                   n_pixel_y=n_pixel_y,
                                   radius=radius,
                                   nD=nD,
                                   resolution=300.)

    potential = fields.calculate_3D_sensor_potential(mesh,
                                                     width_x,
                                                     width_y,
                                                     n_pixel_x,
                                                     n_pixel_y,
                                                     radius,
                                                     nD,
                                                     n_eff,
                                                     V_bias,
                                                     V_readout,
                                                     V_bi)

    # Describe the 3D sensor array<commit_msg>ENH: better values<commit_after>''' Example that creates a 3D pixel array with a given geometry (number of pixels in x/y, height, width, and readout columns per pixel)
    and calculates the potential and fields.

    .. WARNING::
       The calculation of a partially depleted sensor is not supported right now.
'''

from scarce import fields, plot, geometry, silicon


def sensor_3D():
    # Number of pixels influences how correct the field for the
    # center pixel(s) is due to more correct boundary condition
    n_pixel_x, n_pixel_y = 1, 1

    # Geometry of one pixel
    width_x = 250.
    width_y = 50.
    radius = 6.
    nD = 2  # Number of columns per pixel

    n_eff = 1e12  # n_eff [cm^-3]
    temperature = 300

    # Potentials
    V_bias = -20.
    V_readout = 0.
    V_bi = -silicon.get_diffusion_potential(n_eff, temperature)

    mesh = geometry.mesh_3D_sensor(width_x=width_x,
                                   width_y=width_y,
                                   n_pixel_x=n_pixel_x,
                                   n_pixel_y=n_pixel_y,
                                   radius=radius,
                                   nD=nD,
                                   resolution=300.)

    potential = fields.calculate_3D_sensor_potential(mesh,
                                                     width_x,
                                                     width_y,
                                                     n_pixel_x,
                                                     n_pixel_y,
                                                     radius,
                                                     nD,
                                                     n_eff,
                                                     V_bias,
                                                     V_readout,
                                                     V_bi)

    # Describe the 3D sensor array
{'fraction_non_alphanumeric': 0.050078247261345854, 'fraction_numerical': 0.014606155451225874, 'mean_word_length': 0.9079601990049752, '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': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4412843', 'n_tokens_mistral': 918, 'n_tokens_neox': 834, 'n_words': 263}