Example #1
0
def get_potential(V_bias, n_eff):
    try:
        return tools.load(
            os.path.join(DATAFOLDER, 'pot_descr_%d_%d_%d_3D' %
                         (V_bias, n_eff, RESOLUTION)))
    except IOError:
        V_readout = 0.
        V_bi = -silicon.get_diffusion_potential(n_eff / 1e12, temperature=TEMP)

        mesh = get_mesh()
        potential = fields.calculate_3D_sensor_potential(
            mesh, WIDTH_X, WIDTH_Y, NPIXEL_X, NPIXEL_Y, RADIUS, ND, n_eff,
            V_bias, V_readout, V_bi)

        min_x, max_x, min_y, max_y = GEOM_DESCR.get_array_corners()
        nx = WIDTH_X * NPIXEL_X * 4
        ny = WIDTH_Y * NPIXEL_Y * 4

        pot_descr = fields.Description(
            potential,
            min_x=min_x,
            max_x=max_x,
            min_y=min_y,
            max_y=max_y,
            nx=nx,  # um res.
            ny=ny,  # um res.
            smoothing=SMOOTHING)

        tools.save(
            pot_descr,
            os.path.join(DATAFOLDER, 'pot_descr_%d_%d_%d_3D' %
                         (V_bias, n_eff, RESOLUTION)))

    return pot_descr
Example #2
0
def get_w_potential():
    try:
        return tools.load(
            os.path.join(DATAFOLDER, 'pot_w_descr_%d_3D' % RESOLUTION))
    except IOError:

        mesh = get_mesh()

        min_x, max_x, min_y, max_y = GEOM_DESCR.get_array_corners()
        nx = WIDTH_X * NPIXEL_X * 4
        ny = WIDTH_Y * NPIXEL_Y * 4

        w_potential = fields.calculate_3D_sensor_w_potential(mesh,
                                                             WIDTH_X,
                                                             WIDTH_Y,
                                                             NPIXEL_X,
                                                             NPIXEL_Y,
                                                             RADIUS,
                                                             nD=ND)
        pot_w_descr = fields.Description(w_potential,
                                         min_x=min_x,
                                         max_x=max_x,
                                         min_y=min_y,
                                         max_y=max_y,
                                         nx=nx,
                                         ny=ny,
                                         smoothing=SMOOTHING)

        tools.save(pot_w_descr,
                   os.path.join(DATAFOLDER, 'pot_w_descr_%d_3D' % RESOLUTION))

    return pot_w_descr
Example #3
0
def get_w_potential(thickness):
    try:
        return tools.load(
            os.path.join(DATAFOLDER, 'pot_w_descr_%d' % thickness))
    except IOError:
        mesh = get_mesh(n_pixel=NPIXEL,
                        width=WIDTH,
                        thickness=thickness,
                        resolution=RESOLUTION_1
                        if thickness == THICKNESS_1 else RESOLUTION_2)

        w_potential = fields.calculate_planar_sensor_w_potential(
            mesh=mesh,
            width=WIDTH,
            pitch=PITCH,
            n_pixel=NPIXEL,
            thickness=thickness)

        pot_w_descr = fields.Description(
            w_potential,
            min_x=float(mesh.getFaceCenters()[0, :].min()),
            max_x=float(mesh.getFaceCenters()[0, :].max()),
            min_y=0,
            max_y=thickness,
            nx=WIDTH * NPIXEL,
            ny=thickness,
            smoothing=SMOOTHING)

        tools.save(pot_w_descr,
                   os.path.join(DATAFOLDER, 'pot_w_descr_%d' % thickness))

    return pot_w_descr
Example #4
0
def get_mesh():
    try:
        return tools.load(
            os.path.join(DATAFOLDER, 'mesh_%d_3D' % (int(RESOLUTION))))
    except IOError:
        mesh = geometry.mesh_3D_sensor(width_x=WIDTH_X,
                                       width_y=WIDTH_Y,
                                       n_pixel_x=NPIXEL_X,
                                       n_pixel_y=NPIXEL_Y,
                                       radius=RADIUS,
                                       nD=ND,
                                       resolution=RESOLUTION)
        tools.save(mesh,
                   os.path.join(DATAFOLDER, 'mesh_%d_3D' % (int(RESOLUTION))))
        return mesh
Example #5
0
def get_potential(V_bias, n_eff, thickness):
    try:
        return tools.load(
            os.path.join(DATAFOLDER,
                         'pot_descr_%d_%d_%d' % (V_bias, n_eff, thickness)))
    except IOError:
        V_readout = 0.
        V_bi = -silicon.get_diffusion_potential(n_eff / 1e12, temperature=TEMP)

        #         mesh = MESH_1 if thickness == THICKNESS_1 else MESH_2
        mesh = get_mesh(n_pixel=NPIXEL,
                        width=WIDTH,
                        thickness=thickness,
                        resolution=RESOLUTION_1
                        if thickness == THICKNESS_1 else RESOLUTION_2)

        potential = fields.calculate_planar_sensor_potential(
            mesh=mesh,
            width=WIDTH,
            pitch=PITCH,
            n_pixel=NPIXEL,
            thickness=thickness,
            n_eff=n_eff,
            V_bias=V_bias,
            V_readout=V_readout,
            V_bi=V_bi)

        min_x = float(mesh.getFaceCenters()[0, :].min())
        max_x = float(mesh.getFaceCenters()[0, :].max())
        nx = WIDTH * NPIXEL
        ny = thickness

        pot_descr = fields.Description(potential,
                                       min_x=min_x,
                                       max_x=max_x,
                                       min_y=0,
                                       max_y=thickness,
                                       nx=nx,
                                       ny=ny,
                                       smoothing=SMOOTHING)

        tools.save(
            pot_descr,
            os.path.join(DATAFOLDER,
                         'pot_descr_%d_%d_%d' % (V_bias, n_eff, thickness)))

    return pot_descr
Example #6
0
    def test_save_and_load(self):
        ''' Check the saving and loading to disk.
        '''

        # Create data
        mesh = geometry.mesh_planar_sensor(n_pixel=9,
                                           width=50.,
                                           thickness=300.,
                                           resolution=50.,
                                           filename='planar_mesh_example.msh')
        potential = fields.calculate_planar_sensor_potential(mesh=mesh,
                                                             width=50.,
                                                             pitch=45.,
                                                             n_pixel=9,
                                                             thickness=300.,
                                                             n_eff=5e12,
                                                             V_bias=-160.,
                                                             V_readout=0.,
                                                             V_bi=1.5)
        min_x = float(mesh.getFaceCenters()[0, :].min())
        max_x = float(mesh.getFaceCenters()[0, :].max())
        description = fields.Description(potential,
                                         min_x=min_x,
                                         max_x=max_x,
                                         min_y=0,
                                         max_y=300.,
                                         nx=202,
                                         ny=200)

        # Force the creation of the potential and field functions
        description.get_field(0, 0)

        # Store and reload object
        tools.save(description, 'tmp.sc')
        description_2 = tools.load('tmp.sc')

        self.assertTrue(np.all(description.pot_data == description_2.pot_data))
        self.assertTrue(
            np.all(description.potential_grid == description_2.potential_grid))
        self.assertTrue(
            np.all(
                np.array(
                    description.get_field(description._xx, description._yy)) ==
                np.array(
                    description_2.get_field(description_2._xx,
                                            description_2._yy))))
Example #7
0
def get_mesh(n_pixel, width, thickness, resolution):
    try:
        return tools.load(
            os.path.join(
                DATAFOLDER, 'mesh_%d_%d_%d_%d' %
                (n_pixel, int(width), int(thickness), int(resolution))))
    except IOError:
        mesh = geometry.mesh_planar_sensor(n_pixel=n_pixel,
                                           width=width,
                                           thickness=thickness,
                                           resolution=resolution)
        tools.save(
            mesh,
            os.path.join(
                DATAFOLDER, 'mesh_%d_%d_%d_%d' %
                (n_pixel, int(width), int(thickness), int(resolution))))
        return mesh
Example #8
0
    resolution = 251

    # Unirradiated charge map
    (edge_x, edge_y, charge), pot_descr = cc_planar.cc(n_eff=1.475e12,
                                                       bias=-80,
                                                       V_readout=V_readout,
                                                       temperature=temperature,
                                                       t_e_trapping=None,
                                                       t_h_trapping=None,
                                                       n_pixel=n_pixel,
                                                       width=width,
                                                       pitch=pitch,
                                                       thickness=thickness,
                                                       resolution=resolution,
                                                       smoothing=smoothing)
    tools.save(obj=(edge_x, edge_y, charge), filename='charge_planar_unirrad')

    # Irradiated charge map
    (edge_x, edge_y, charge), pot_descr = cc_planar.cc(n_eff=8.8e12,
                                                       bias=-150,
                                                       V_readout=V_readout,
                                                       temperature=temperature,
                                                       t_e_trapping=4.82,
                                                       t_h_trapping=4.82,
                                                       n_pixel=n_pixel,
                                                       width=width,
                                                       pitch=pitch,
                                                       thickness=thickness,
                                                       resolution=resolution,
                                                       smoothing=smoothing)
    tools.save(obj=(edge_x, edge_y, charge), filename='charge_planar_irrad')