コード例 #1
0
        # create a clean mask of pixels above the threshold
        cleanmask = tailcuts_clean(camgeom, image, picture_thresh=10, boundary_thresh=5)
        # set all rejected pixels to zero
        cleaned_image[~cleanmask] = 0

        # Calulate hillas parameters
        # It fails for empty pixels   
        try:
            hillas_params[tel_id] = hillas_parameters(camgeom, cleaned_image)
        except:
            pass

    if len(hillas_params) < 2: 
        continue

    reco.get_great_circles(hillas_params, event.inst.subarray,
                           point_azimuth, point_altitude)  

    # fit the gamma's direction of origin
    # return reconstructed direction (3 components) with errors on the values
    reco_direction, reco_dir_err = reco.fit_origin_crosses()

    # In case fit fails to get any real value
    if np.isnan(reco_direction).any():
        continue

    # get angular offset between reconstructed shower direction and MC
    # generated shower direction
    off_angle = linalg.angle(reco_direction, shower_direction)

    # Appending all estimated off angles
    off_angles.append(off_angle.to(u.deg).value)
コード例 #2
0
                Imagecutflow.count("Hillas")
                '''
                get some more parameters and put them in an astropy.table.Table '''
                sum_p = np.sum(pmt_signal_p)
                sum_w = np.sum(pmt_signal_w)
                sum_t = np.sum(pmt_signal_t)

                Epsilon_intensity_w = abs(sum_w - sum_p) / sum_p
                Epsilon_intensity_t = abs(sum_t - sum_p) / sum_p

                alpha = {}
                length = {}
                width = {}
                for k, h in hillas.items():

                    fit.get_great_circles({tel_id: h}, event.inst.subarray,
                                          tel_phi, tel_theta)
                    c = fit.circles[tel_id]

                    alpha[k] = abs((angle(c.norm, shower_org) * u.rad) -
                                   90 * u.deg).to(u.deg)
                    length[k] = h.length
                    width[k] = h.width

                for k, signal in {  # 'p': pmt_signal_p,
                        'w': pmt_signal_w
                }.items():

                    h = hillas[k]

                    p1_x = h.cen_x
                    p1_y = h.cen_y