Example #1
0
    def get_profile(self):
        ch, th = list(zip(*sorted([(t.charge, t.phi) for
                              t in itertools.chain(*self.trk_lst) if
                              t.charge and len(t) > 15],
                             key=lambda x: x[-1])))

        dh, th_new = infra.construct_corrected_profile((th, ch))

        return th_new, dh
Example #2
0
    def get_xyz_curve(self, min_track_length=15):
        q, ch, th = list(zip(*sorted([(t.q, t.charge, t.phi) for
                                 t in itertools.chain(*self.trk_lst) if
                                 t.charge and len(t) > min_track_length],
                                key=lambda x: x[-1])))

        # scale the radius
        x, y = self.curve.q_phi_to_xy(q, th)

        z, th_new = infra.construct_corrected_profile((th, ch))

        return x, y, z
Example #3
0
    def get_xyz_points(self, min_track_length=15):

        X, Y, ch, th = list(zip(
            *sorted([tuple(t.get_xy(self.curve)) + (t.charge, t.phi) for
                     t in itertools.chain(*self.trk_lst) if
                     t.charge and len(t) > 15],
                    key=lambda x: x[-1])))

        dh, th_new = infra.construct_corrected_profile((th, ch))
        Z = [z * np.ones(x.shape) for z, x in zip(dh, X)]

        return X, Y, Z
Example #4
0
    def update(self, backend, j, delta_h=0):
        mbe = backend.get_frame(j, False, False)

        th = np.hstack([mbe.res[0][1], mbe.res[1][1]])
        ch = np.hstack([mbe.res[0][0], mbe.res[1][0]])

        XY = np.vstack(mbe.curve.q_phi_to_xy(0, np.linspace(0, 2 * np.pi, 2 ** 10)))
        center = np.mean(XY, 1)
        first_pt = center - XY[:, 0]

        th_offset = np.arctan2(first_pt[1], first_pt[0])

        dh, th_new = infra.construct_corrected_profile((th, ch), th_offset)
        dh -= np.min(dh)
        dh += delta_h
        dh *= 0.632 / 4

        self.prof_ln.set_xdata(th_new)
        self.prof_ln.set_ydata(dh)
        return (self.prof_ln,)
Example #5
0
    def update(self, backend, j, delta_h=0):
        mbe = backend.get_frame(j, False, False)

        th = np.hstack([mbe.res[0][1], mbe.res[1][1]])
        ch = np.hstack([mbe.res[0][0], mbe.res[1][0]])

        XY = np.vstack(mbe.curve.q_phi_to_xy(0,
                                            np.linspace(0, 2 * np.pi, 2 ** 10)))
        center = np.mean(XY, 1)
        first_pt = center - XY[:, 0]

        th_offset = np.arctan2(first_pt[1], first_pt[0])

        dh, th_new = infra.construct_corrected_profile((th, ch), th_offset)
        dh -= np.min(dh)
        dh += delta_h
        dh *= (.632 / 4)

        self.prof_ln.set_xdata(th_new)
        self.prof_ln.set_ydata(dh)
        return (self.prof_ln, )