当前位置: 首页>>代码示例>>Python>>正文


Python CameraGeometry.make_rectangular方法代码示例

本文整理汇总了Python中ctapipe.instrument.CameraGeometry.make_rectangular方法的典型用法代码示例。如果您正苦于以下问题:Python CameraGeometry.make_rectangular方法的具体用法?Python CameraGeometry.make_rectangular怎么用?Python CameraGeometry.make_rectangular使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ctapipe.instrument.CameraGeometry的用法示例。


在下文中一共展示了CameraGeometry.make_rectangular方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_tailcuts_clean_min_neighbors_1

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
def test_tailcuts_clean_min_neighbors_1():
    """
    requiring that picture pixels have at least one neighbor above picture_thres:
    """

    # start with simple 3-pixel camera
    geom = CameraGeometry.make_rectangular(3, 1, (-1, 1))

    p = 15  # picture value
    b = 7  # boundary value

    testcases = {(p, p, 0): [True, True, False],
                 (p, 0, p): [False, False, False],
                 (p, b, p): [False, False, False],
                 (p, b, 0): [False, False, False],
                 (b, b, 0): [False, False, False],
                 (0, p, 0): [False, False, False],
                 (p, p, p): [True, True, True]}

    for image, mask in testcases.items():
        result = cleaning.tailcuts_clean(geom, np.array(image),
                                         picture_thresh=15,
                                         boundary_thresh=5,
                                         min_number_picture_neighbors=1,
                                         keep_isolated_pixels=False)
        assert (result == mask).all()
开发者ID:ParsonsRD,项目名称:ctapipe,代码行数:28,代码来源:test_cleaning.py

示例2: test_neighbor_pixels

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
def test_neighbor_pixels():
    hexgeom = CameraGeometry.from_name("LSTCam")
    recgeom = CameraGeometry.make_rectangular()

    # most pixels should have 4 neighbors for rectangular geometry and 6 for
    # hexagonal
    assert int(median(recgeom.neighbor_matrix.sum(axis=1))) == 4
    assert int(median(hexgeom.neighbor_matrix.sum(axis=1))) == 6
开发者ID:epuesche,项目名称:ctapipe,代码行数:10,代码来源:test_camera.py

示例3: test_tailcuts_clean_with_isolated_pixels

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
def test_tailcuts_clean_with_isolated_pixels():
    # start with simple 3-pixel camera
    geom = CameraGeometry.make_rectangular(3, 1, (-1, 1))

    p = 15  # picture value
    b = 7  # boundary value

    testcases = {(p, p, 0): [True, True, False],
                 (p, 0, p): [True, False, True],
                 (p, b, p): [True, True, True],
                 (p, b, 0): [True, True, False],
                 (0, p, 0): [False, True, False],
                 (b, b, 0): [False, False, False]}

    for image, mask in testcases.items():
        result = cleaning.tailcuts_clean(geom, np.array(image),
                                         picture_thresh=15,
                                         boundary_thresh=5,
                                         keep_isolated_pixels=True)
        assert (result == mask).all()
开发者ID:ParsonsRD,项目名称:ctapipe,代码行数:22,代码来源:test_cleaning.py

示例4: test_make_rectangular_camera_geometry

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
def test_make_rectangular_camera_geometry():
    geom = CameraGeometry.make_rectangular()
    assert geom.pix_x.shape == geom.pix_y.shape
开发者ID:dipierr,项目名称:ctapipe,代码行数:5,代码来源:test_camera.py

示例5: imshow

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
"""Example how to make a toymodel shower image and plot it.
"""
import matplotlib.pyplot as plt
from ctapipe.image.toymodel import generate_2d_shower_model, \
    make_toymodel_shower_image
from ctapipe.instrument import CameraGeometry

NX = 40
NY = 40

geom = CameraGeometry.make_rectangular(NX, NY)

showermodel = generate_2d_shower_model(centroid=[0.25, 0.0], length=0.1,
                                       width=0.02, psi='40d')

image, signal, noise = make_toymodel_shower_image(geom, showermodel.pdf,
                                                  intensity=20, nsb_level_pe=30)

# make them into 2D arrays so we can plot them with imshow
image.shape = (NX, NY)
signal.shape = (NX, NY)
noise.shape = (NX, NY)

# here we just plot the images using imshow().  For a more general
# case, one should use a ctapipe.visualization.CameraDisplay
plt.figure(figsize=(10, 3))
plt.subplot(1, 3, 1)
plt.imshow(signal, interpolation='nearest', origin='lower')
plt.title("Signal")
plt.colorbar()
plt.subplot(1, 3, 2)
开发者ID:ParsonsRD,项目名称:ctapipe,代码行数:33,代码来源:image_example.py

示例6: tailcuts_clean

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import make_rectangular [as 别名]
        )

        mask = tailcuts_clean(
            geom,
            image,
            picture_thresh=6 * image.mean(),
            boundary_thresh=4 * image.mean()
        )
        cleaned = image.copy()
        cleaned[~mask] = 0

        hillas = hillas_parameters(geom, cleaned)

        disp.image = image
        disp.add_colorbar(ax=axs[ii])

        disp.set_limits_percent(95)
        disp.overlay_moments(hillas, linewidth=3, color='blue')


if __name__ == '__main__':

    hexgeom = CameraGeometry.from_name("LSTCam")
    recgeom = CameraGeometry.make_rectangular()

    draw_several_cams(recgeom)
    draw_several_cams(hexgeom)

    plt.tight_layout()
    plt.show()
开发者ID:ParsonsRD,项目名称:ctapipe,代码行数:32,代码来源:camera_display_multi.py


注:本文中的ctapipe.instrument.CameraGeometry.make_rectangular方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。