コード例 #1
0
ファイル: mixins.py プロジェクト: jbradt/atmc
    def __init__(self, config):
        self._vd = np.array(config['vd'])
        self.mass_num = config['mass_num']
        self.pad_rot_angle = config['pad_rot_angle'] * degrees
        self.padrotmat = rot_matrix(self.pad_rot_angle)
        self.ioniz = config['ioniz']
        self.gain = config['micromegas_gain']
        self.clock = config['clock']
        self.shape = float(config['shape'])
        self._tilt = config['tilt'] * degrees
        self.diff_sigma = config['diffusion_sigma']

        with h5py.File(config['lut_path'], 'r') as hf:
            lut = hf['LUT'][:]
        self.padplane = PadPlane(lut, -0.280, 0.0001, -0.280, 0.0001, self.pad_rot_angle)
        self.evtgen = EventGenerator(self.padplane, self.vd, self.clock, self.shape, self.mass_num,
                                     self.ioniz, self.gain, self.tilt, self.diff_sigma)

        super().__init__(config)
コード例 #2
0
ファイル: mixins.py プロジェクト: chchen123/pytpc
    def __init__(self, config):
        self._vd = np.array(config['vd'])
        self.mass_num = config['mass_num']
        self.pad_rot_angle = config['pad_rot_angle'] * degrees
        self.padrotmat = rot_matrix(self.pad_rot_angle)
        self.ioniz = config['ioniz']
        self.micromegas_gain = float(config['micromegas_gain'])
        self.electronics_gain = float(config['electronics_gain'])
        self.clock = config['clock']
        self.shape = float(config['shape'])
        self._tilt = config['tilt'] * degrees
        self.diff_sigma = config['diffusion_sigma']

        with h5py.File(config['lut_path'], 'r') as hf:
            lut = hf['LUT'][:]
        self.padplane = PadPlane(lut, -0.280, 0.0001, -0.280, 0.0001,
                                 self.pad_rot_angle)
        self.evtgen = EventGenerator(self.padplane, self.vd, self.clock,
                                     self.shape, self.mass_num, self.ioniz,
                                     self.micromegas_gain,
                                     self.electronics_gain, self.tilt,
                                     self.diff_sigma)

        super().__init__(config)
コード例 #3
0
ファイル: padplane.py プロジェクト: tarvos14/pytpc
        rotmat = np.array([[cos(rotation_angle), -sin(rotation_angle)],
                              [sin(rotation_angle), cos(rotation_angle)]])

        # reshape the pads array so we can easily iterate over it
        sh = pads.shape
        pads.shape = (-1, 2)
        for i, v in enumerate(pads):
            pads[i] = np.dot(rotmat, v)
        pads.shape = sh

    return pads


_leftskewmat = skew_matrix(-60.*degrees)
_rightskewmat = skew_matrix(60.*degrees)
_rotneg120mat = rot_matrix(-120*degrees)
_rotpos120mat = rot_matrix(120*degrees)
_rotneg240mat = rot_matrix(-240*degrees)
_rotpos240mat = rot_matrix(240*degrees)
_idmat = np.eye(2)


def _two_pt_line(x, x1, y1, x2, y2):
    """Find the y-value of the equation of the line connecting [x1, y1] to [x2, y2] at the point x.
    """

    return (y2-y1)/(x2-x1) * (x-x1) + y1


def find_pad_coords(x, y):
    """Find the center of the nearest pad to the provided x and y coordinates.
コード例 #4
0
                           [sin(rotation_angle),
                            cos(rotation_angle)]])

        # reshape the pads array so we can easily iterate over it
        sh = pads.shape
        pads.shape = (-1, 2)
        for i, v in enumerate(pads):
            pads[i] = np.dot(rotmat, v)
        pads.shape = sh

    return pads


_leftskewmat = skew_matrix(-60. * degrees)
_rightskewmat = skew_matrix(60. * degrees)
_rotneg120mat = rot_matrix(-120 * degrees)
_rotpos120mat = rot_matrix(120 * degrees)
_rotneg240mat = rot_matrix(-240 * degrees)
_rotpos240mat = rot_matrix(240 * degrees)
_idmat = np.eye(2)


def _two_pt_line(x, x1, y1, x2, y2):
    """Find the y-value of the equation of the line connecting [x1, y1] to [x2, y2] at the point x.
    """

    return (y2 - y1) / (x2 - x1) * (x - x1) + y1


def find_pad_coords(coords):
    """Find the center of the nearest pad to the provided x and y coordinates.