예제 #1
0
def process(name, tcal_path):
    ped_reader = PedestalArrayReader(tcal_path)
    hits_tcal = np.array(ped_reader.GetHits())
    std_tcal = np.array(ped_reader.GetStdDev())

    mask = (hits_tcal < 6) | np.isnan(std_tcal)
    std_tcal = np.ma.masked_array(std_tcal, mask=mask)

    embed()

    # std_values = std_tcal.compressed()
    # std_pix = std_tcal.mean((2, 3)).ravel()
    std_max_pix = std_tcal.max((2, 3)).ravel()

    # p_hist = Hist()
    # p_hist.plot(std_values)
    # p_hist.save(get_plot(f"d190730_pedestal/plot_from_tcals/hist/{name}.png"))
    #
    # p_ci = CameraImage.from_camera_version("1.1.0")
    # p_ci.image = std_pix
    # p_ci.add_colorbar()
    # p_ci.save(get_plot(f"d190730_pedestal/plot_from_tcals/camera/{name}.png"))

    p_ci = CameraImage.from_camera_version("1.1.0")
    p_ci.image = std_max_pix
    p_ci.add_colorbar()
    p_ci.save(
        get_plot(f"d190730_pedestal/plot_from_tcals/camera_max/{name}.png"))
예제 #2
0
def main():
    file = np.load("cherenkov.npz")
    cherenkov = file['frames']
    min_array = file['min']
    max_array = file['max']
    n_pixels, n_frames = cherenkov.shape

    message = np.load("happy_birthday_rich.npy")

    ci = CameraImage.from_camera_version("1.1.0")
    mapping = get_clp_mapping_from_version("1.1.0")
    rows = mapping.metadata['n_rows'] - mapping.row
    # embed()

    for iframe in range(n_frames):
        frame = cherenkov[:, iframe]
        min_ = min_array[iframe]
        max_ = max_array[iframe]
        max_row = iframe // 2

        frame_message = message.copy()
        frame_message[rows > max_row] = False
        frame[frame_message] += (max_ + min_) / 2

        ci.image = frame
        ci.set_limits_minmax(min_, max_)
        ci.save(f"frames/{iframe:03d}.png", dpi=115)
예제 #3
0
def plot_tm_edge_labels():
    """
    Annotate plot with the TM numbers on the edges
    """
    camera_version = "1.1.0"
    camera = CameraImage.from_camera_version(camera_version)
    pixels = np.arange(camera.n_pixels)
    camera.annotate_tm_edge_label()
    plt.show()
예제 #4
0
def plot_pixel_positions():
    """
    Plot pixel positions onto the camera
    """
    camera_version = "1.0.1"
    camera = CameraImage.from_camera_version(camera_version)
    pixels = np.arange(camera.n_pixels)
    camera.add_pixel_text(pixels)
    plt.show()
예제 #5
0
def plot_from_camera_version_single_module():
    """
    Plot a single module by specifying a camera version (requires TargetCalib)
    """
    camera_version = "1.1.0"
    camera = CameraImage.from_camera_version(camera_version, True)
    image = np.zeros(64)
    image[::2] = 1
    camera.image = image
    plt.show()
예제 #6
0
def plot_from_camera_version():
    """
    Plot by specifying a camera version (requires TargetCalib)
    """
    camera_version = "1.1.0"
    camera = CameraImage.from_camera_version(camera_version)
    image = np.zeros(2048)
    image[::2] = 1
    camera.image = image
    plt.show()
예제 #7
0
def plot_with_limits():
    """
    Set the z-axis limits
    """
    camera_version = "1.1.0"
    camera = CameraImage.from_camera_version(camera_version)
    image = np.arange(2048)
    camera.add_colorbar()
    camera.set_limits_minmax(0, 1000)
    camera.image = image
    plt.show()