• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python numpy.uint64函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.uint64函数的典型用法代码示例。如果您正苦于以下问题:Python uint64函数的具体用法?Python uint64怎么用?Python uint64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: check_synapse

 def check_synapse(self, id):
     """ Get neuron pairs and coordinates
     """
     # Get the resolution and the scale
     res = 0
     sc = 0.5**res
     scales = np.array([sc, sc, 1])
     # If synapse exists
     if self.is_synapse(id):
         # Get the neuron pairs
         parents = self.synapse_parent(id)['parent_neurons']
         # Reverse the dictionary
         parents = {i[1]:i[0] for i in parents.items()}
         # If bidirectionl synapse
         if 3 in parents:
             neurons = [parents[3], parents[3]]
         # If two neuron parents
         else:
             neurons = [parents[1], parents[2]]
         # Get the synapse coordinates
         keypoint = self.synapse_keypoint(res, id)['keypoint']
         full_keypoint = np.uint64(keypoint / scales).tolist()
         # Return all neuron ids and cooridnates
         return np.uint64(neurons + full_keypoint)
     # Return nothing if non-existent
     return np.uint64([])
开发者ID:Rhoana,项目名称:butterfly,代码行数:26,代码来源:NDA.py


示例2: uint64_from_uint63

def uint64_from_uint63(x):
    out = np.empty(len(x) // 2, dtype=np.uint64)
    for i in range(0, len(x), 2):
        a = x[i] & np.uint64(0xffffffff00000000)
        b = x[i + 1] >> np.uint64(32)
        out[i // 2] = a | b
    return out
开发者ID:afvincent,项目名称:ng-numpy-randomstate,代码行数:7,代码来源:test_direct.py


示例3: calculateComplexDerefOpAddress

    def calculateComplexDerefOpAddress(complexDerefOp, registerMap):

        match = re.match("((?:\\-?0x[0-9a-f]+)?)\\(%([a-z0-9]+),%([a-z0-9]+),([0-9]+)\\)", complexDerefOp)
        if match != None:
            offset = 0L
            if len(match.group(1)) > 0:
                offset = long(match.group(1), 16)

            regA = RegisterHelper.getRegisterValue(match.group(2), registerMap)
            regB = RegisterHelper.getRegisterValue(match.group(3), registerMap)

            mult = long(match.group(4), 16)

            # If we're missing any of the two register values, return None
            if regA == None or regB == None:
                if regA == None:
                    return (None, "Missing value for register %s" % match.group(2))
                else:
                    return (None, "Missing value for register %s" % match.group(3))

            if RegisterHelper.getBitWidth(registerMap) == 32:
                val = int32(uint32(regA)) + int32(uint32(offset)) + (int32(uint32(regB)) * int32(uint32(mult)))
            else:
                # Assume 64 bit width
                val = int64(uint64(regA)) + int64(uint64(offset)) + (int64(uint64(regB)) * int64(uint64(mult)))
            return (long(val), None)

        return (None, "Unknown failure.")
开发者ID:terminiter,项目名称:FuzzManager,代码行数:28,代码来源:CrashInfo.py


示例4: _ints_arr_to_bits

def _ints_arr_to_bits(ints_arr, out):
    """
    Convert an array of integers representing the set bits into the
    corresponding integer.

    Compiled as a ufunc by Numba's `@guvectorize`: if the input is a
    2-dim array with shape[0]=K, the function returns a 1-dim array of
    K converted integers.

    Parameters
    ----------
    ints_arr : ndarray(int32, ndim=1)
        Array of distinct integers from 0, ..., 63.

    Returns
    -------
    np.uint64
        Integer with set bits represented by the input integers.

    Examples
    --------
    >>> ints_arr = np.array([0, 1, 2], dtype=np.int32)
    >>> _ints_arr_to_bits(ints_arr)
    7
    >>> ints_arr2d = np.array([[0, 1, 2], [3, 0, 1]], dtype=np.int32)
    >>> _ints_arr_to_bits(ints_arr2d)
    array([ 7, 11], dtype=uint64)

    """
    m = ints_arr.shape[0]
    out[0] = 0
    for i in range(m):
        out[0] |= np.uint64(1) << np.uint64(ints_arr[i])
开发者ID:AsiaBartnik,项目名称:QuantEcon.py,代码行数:33,代码来源:vertex_enumeration.py


示例5: get_bucket

def get_bucket(uhash, pieces, first_bucket_vector, second_bucket_vector):
    h_index = np.uint64(first_bucket_vector[0]) + np.uint64(second_bucket_vector[0 + 2])
    if h_index >= const.prime_default:
        h_index -= const.prime_default
    assert(h_index < const.prime_default)
    h_index = np.uint32(h_index)
    h_index = h_index % uhash.table_size

    control = np.uint64(first_bucket_vector[1]) + np.uint64(second_bucket_vector[1 + 2])
    if control >= const.prime_default:
        control -= const.prime_default
    assert(control < const.prime_default)
    control = np.uint32(control)
    
    if uhash.t == 2:
        index_hybrid = uhash.hybrid_hash_table[h_index]

        while index_hybrid:
            if index_hybrid.control_value == control:
                index_hybrid = C.pointer(index_hybrid)[1]
                return index_hybrid
            else:
                index_hybrid = C.pointer(index_hybrid)[1]
                if index_hybrid.point.is_last_bucket:
                    return None
                l = index_hybrid.point.bucket_length
                index_hybrid = C.pointer(index_hybrid)[l]
        return None
开发者ID:ajauhri,项目名称:knn-exps,代码行数:28,代码来源:lsh_helper.py


示例6: __init__

 def __init__(self, index, desc):
     opt_lis = desc.split(',')
     self.key = opt_lis[0]
     self.index = index
     self.control = False
     self.event = False
     self.width = None
     self.mult = None
     self.unit = None
     # TODO Add gauge.
     for opt in opt_lis[1:]:
         if len(opt) == 0:
             continue
         elif opt[0] == 'C':
             self.control = True
         elif opt[0] == 'E':
             self.event = True
         elif opt[0:2] == 'W=':
             self.width = int(opt[2:])
         elif opt[0:2] == 'U=':
             i = 2
             while i < len(opt) and opt[i].isdigit():
                 i += 1
             if i > 2:
                 self.mult = numpy.uint64((opt[2:i]))
             if i < len(opt):
                 self.unit = opt[i:]
             if self.unit == "KB":
                 self.mult = numpy.uint64(1024)
                 self.unit = "B"
         else:
             error("unrecognized option `%s' in schema entry spec `%s'\n", opt, desc)
开发者ID:charngda,项目名称:tacc_stats,代码行数:32,代码来源:job_stats.py


示例7: testInt

    def testInt(self):
        num = np.int(2562010)
        self.assertEqual(np.int(ujson.decode(ujson.encode(num))), num)

        num = np.int8(127)
        self.assertEqual(np.int8(ujson.decode(ujson.encode(num))), num)

        num = np.int16(2562010)
        self.assertEqual(np.int16(ujson.decode(ujson.encode(num))), num)

        num = np.int32(2562010)
        self.assertEqual(np.int32(ujson.decode(ujson.encode(num))), num)

        num = np.int64(2562010)
        self.assertEqual(np.int64(ujson.decode(ujson.encode(num))), num)

        num = np.uint8(255)
        self.assertEqual(np.uint8(ujson.decode(ujson.encode(num))), num)

        num = np.uint16(2562010)
        self.assertEqual(np.uint16(ujson.decode(ujson.encode(num))), num)

        num = np.uint32(2562010)
        self.assertEqual(np.uint32(ujson.decode(ujson.encode(num))), num)

        num = np.uint64(2562010)
        self.assertEqual(np.uint64(ujson.decode(ujson.encode(num))), num)
开发者ID:paddymul,项目名称:pandas,代码行数:27,代码来源:test_ujson.py


示例8: _combine_hash_arrays

def _combine_hash_arrays(arrays, num_items):
    """
    Parameters
    ----------
    arrays : generator
    num_items : int

    Should be the same as CPython's tupleobject.c
    """
    try:
        first = next(arrays)
    except StopIteration:
        return np.array([], dtype=np.uint64)

    arrays = itertools.chain([first], arrays)

    mult = np.uint64(1000003)
    out = np.zeros_like(first) + np.uint64(0x345678)
    for i, a in enumerate(arrays):
        inverse_i = num_items - i
        out ^= a
        out *= mult
        mult += np.uint64(82520 + inverse_i + inverse_i)
    assert i + 1 == num_items, 'Fed in wrong num_items'
    out += np.uint64(97531)
    return out
开发者ID:TomAugspurger,项目名称:pandas,代码行数:26,代码来源:hashing.py


示例9: __init__

 def __init__(self, i, s):
     opt_lis = s.split(',')
     self.key = opt_lis[0]
     self.index = i
     self.is_control = False
     self.is_event = False
     self.width = None
     self.mult = None
     self.unit = None
     for opt in opt_lis[1:]:
         if len(opt) == 0:
             continue
         elif opt[0] == 'C':
             self.is_control = True
         elif opt[0] == 'E':
             self.is_event = True
         elif opt[0:2] == 'W=':
             self.width = int(opt[2:])
         elif opt[0:2] == 'U=':
             j = 2
             while j < len(opt) and opt[j].isdigit():
                 j += 1
             if j > 2:
                 self.mult = numpy.uint64(opt[2:j])
             if j < len(opt):
                 self.unit = opt[j:]
             if self.unit == "KB":
                 self.mult = numpy.uint64(1024)
                 self.unit = "B"
         else:
             # XXX
             raise ValueError("unrecognized option `%s' in schema entry spec `%s'\n", opt, s)
开发者ID:ubccr,项目名称:tacc_stats,代码行数:32,代码来源:job_stats.py


示例10: __compile_kernels

  def __compile_kernels(self):
    """ DFS module """
    f = self.forest
    self.find_min_kernel = f.find_min_kernel  
    self.fill_kernel = f.fill_kernel 
    self.scan_reshuffle_tex = f.scan_reshuffle_tex 
    self.comput_total_2d = f.comput_total_2d 
    self.reduce_2d = f.reduce_2d
    self.scan_total_2d = f.scan_total_2d 
    self.scan_reduce = f.scan_reduce 
    
    """ BFS module """
    self.scan_total_bfs = f.scan_total_bfs
    self.comput_bfs_2d = f.comput_bfs_2d
    self.fill_bfs = f.fill_bfs 
    self.reshuffle_bfs = f.reshuffle_bfs 
    self.reduce_bfs_2d = f.reduce_bfs_2d 
    self.get_thresholds = f.get_thresholds 

    """ Other """
    self.predict_kernel = f.predict_kernel 
    self.mark_table = f.mark_table
    const_sorted_indices = f.bfs_module.get_global("sorted_indices_1")[0]
    const_sorted_indices_ = f.bfs_module.get_global("sorted_indices_2")[0]
    cuda.memcpy_htod(const_sorted_indices, np.uint64(self.sorted_indices_gpu.ptr)) 
    cuda.memcpy_htod(const_sorted_indices_, np.uint64(self.sorted_indices_gpu_.ptr)) 
开发者ID:phecy,项目名称:CudaTree,代码行数:26,代码来源:random_tree.py


示例11: __init__

 def __init__(self, fpga, comb, f_start, f_stop, logger=logging.getLogger(__name__)):
     """ f_start and f_stop must be in Hz
     """
     self.logger = logger
     snap_name = "snap_{a}x{b}".format(a=comb[0], b=comb[1])
     self.snapshot0 = Snapshot(fpga,
                              "{name}_0".format(name = snap_name),
                              dtype='>i8',
                              cvalue=True,
                              logger=self.logger.getChild("{name}_0".format(name = snap_name)))
     self.snapshot1 = Snapshot(fpga,
                              "{name}_1".format(name = snap_name),
                              dtype='>i8',
                              cvalue=True,
                              logger=self.logger.getChild("{name}_1".format(name = snap_name)))
     self.f_start = np.uint64(f_start)
     self.f_stop = np.uint64(f_stop)
     # this will change from None to an array of phase offsets for each frequency bin 
     # if calibration gets applied at a later stage.
     # this is an array of phases introduced by the system. So if a value is positive, 
     # it means that the system is introducing a phase shift between comb[0] and comb[1]
     # in other words comb1 is artificially delayed. 
     self.calibration_phase_offsets = None
     self.calibration_cable_length_offsets = None
     self.arm()
     self.fetch_signal()
     self.frequency_bins = np.linspace(
         start = self.f_start,
         stop = self.f_stop,
         num = len(self.signal),
         endpoint = False)
开发者ID:jgowans,项目名称:directionFinder_backend,代码行数:31,代码来源:correlation.py


示例12: hash_array

    def hash_array(vals):
        """Given a 1d array, return an array of deterministic integers."""
        # work with cagegoricals as ints. (This check is above the complex
        # check so that we don't ask numpy if categorical is a subdtype of
        # complex, as it will choke.
        if is_categorical_dtype(vals.dtype):
            vals = vals.codes

        # we'll be working with everything as 64-bit values, so handle this
        # 128-bit value early
        if np.issubdtype(vals.dtype, np.complex128):
            return hash_array(vals.real) + 23 * hash_array(vals.imag)

        # MAIN LOGIC:

        # First, turn whatever array this is into unsigned 64-bit ints, if we can
        # manage it.
        if vals.dtype == np.bool:
            vals = vals.astype('u8')

        elif (np.issubdtype(vals.dtype, np.datetime64) or
              np.issubdtype(vals.dtype, np.timedelta64) or
              np.issubdtype(vals.dtype, np.number)) and vals.dtype.itemsize <= 8:

            vals = vals.view('u{}'.format(vals.dtype.itemsize)).astype('u8')
        else:
            vals = np.array([hash(x) for x in vals], dtype=np.uint64)

        # Then, redistribute these 64-bit ints within the space of 64-bit ints
        vals ^= vals >> 30
        vals *= np.uint64(0xbf58476d1ce4e5b9)
        vals ^= vals >> 27
        vals *= np.uint64(0x94d049bb133111eb)
        vals ^= vals >> 31
        return vals
开发者ID:gameduell,项目名称:dask,代码行数:35,代码来源:hashing.py


示例13: write_mwhite_subsample

    def write_mwhite_subsample(self, subsample, output):
        size = self.comm.allreduce(len(subsample))
        offset = sum(self.comm.allgather(len(subsample))[: self.comm.rank])

        if self.comm.rank == 0:
            with open(output, "wb") as ff:
                dtype = numpy.dtype(
                    [
                        ("eflag", "int32"),
                        ("hsize", "int32"),
                        ("npart", "int32"),
                        ("nsph", "int32"),
                        ("nstar", "int32"),
                        ("aa", "float"),
                        ("gravsmooth", "float"),
                    ]
                )
                header = numpy.zeros((), dtype=dtype)
                header["eflag"] = 1
                header["hsize"] = 20
                header["npart"] = size
                header.tofile(ff)

        self.comm.barrier()

        with open(output, "r+b") as ff:
            ff.seek(28 + offset * 12)
            numpy.float32(subsample["Position"]).tofile(ff)
            ff.seek(28 + offset * 12 + size * 12)
            numpy.float32(subsample["Velocity"]).tofile(ff)
            ff.seek(28 + offset * 4 + size * 24)
            numpy.float32(subsample["Density"]).tofile(ff)
            ff.seek(28 + offset * 8 + size * 28)
            numpy.uint64(subsample["ID"]).tofile(ff)
开发者ID:rainwoodman,项目名称:nbodykit,代码行数:34,代码来源:Subsample.py


示例14: testIntMax

    def testIntMax(self):
        num = np.int(np.iinfo(np.int).max)
        self.assertEqual(np.int(ujson.decode(ujson.encode(num))), num)

        num = np.int8(np.iinfo(np.int8).max)
        self.assertEqual(np.int8(ujson.decode(ujson.encode(num))), num)

        num = np.int16(np.iinfo(np.int16).max)
        self.assertEqual(np.int16(ujson.decode(ujson.encode(num))), num)

        num = np.int32(np.iinfo(np.int32).max)
        self.assertEqual(np.int32(ujson.decode(ujson.encode(num))), num)

        num = np.uint8(np.iinfo(np.uint8).max)
        self.assertEqual(np.uint8(ujson.decode(ujson.encode(num))), num)

        num = np.uint16(np.iinfo(np.uint16).max)
        self.assertEqual(np.uint16(ujson.decode(ujson.encode(num))), num)

        num = np.uint32(np.iinfo(np.uint32).max)
        self.assertEqual(np.uint32(ujson.decode(ujson.encode(num))), num)

        if platform.architecture()[0] != '32bit':
            num = np.int64(np.iinfo(np.int64).max)
            self.assertEqual(np.int64(ujson.decode(ujson.encode(num))), num)

            # uint64 max will always overflow as it's encoded to signed
            num = np.uint64(np.iinfo(np.int64).max)
            self.assertEqual(np.uint64(ujson.decode(ujson.encode(num))), num)
开发者ID:paddymul,项目名称:pandas,代码行数:29,代码来源:test_ujson.py


示例15: FromByteString

	def FromByteString(cls,bytestr):
		"""
		Initialize Packet from the given byte string
		"""
		# check correct size packet
		len_bytes = len(bytestr)
		if not len_bytes == cls.BYTES_IN_PACKET:
			raise ValueError("Packet should comprise {0} bytes, but has {1} bytes".format(len_bytes,cls.BYTES_IN_PACKET))
		# unpack header
		hdr = unpack(">{0}Q".format(cls.BYTES_IN_HEADER/8),bytestr[:cls.BYTES_IN_HEADER])
		ut = uint32(hdr[0] & 0xFFFFFFFF)
		pktnum = uint32((hdr[0]>>uint32(32)) & 0xFFFFF)
		did = uint8(hdr[0]>>uint32(52) & 0x3F)
		ifid = uint8(hdr[0]>>uint32(58) & 0x3F)
		ud1 = uint32(hdr[1] & 0xFFFFFFFF)
		ud0 = uint32((hdr[1]>>uint32(32)) & 0xFFFFFFFF)
		res0 = uint64(hdr[2])
		res1 = uint64(hdr[3]&0x7FFFFFFFFFFFFFFF)
		fnt = not (hdr[3]&0x8000000000000000 == 0)
		# unpack data in 64bit mode to correct for byte-order
		data_64bit = array(unpack(">{0}Q".format(cls.BYTES_IN_PAYLOAD/8),bytestr[cls.BYTES_IN_HEADER:]),dtype=uint64)
		data = zeros(cls.BYTES_IN_PAYLOAD,dtype=int8)
		for ii in xrange(len(data_64bit)):
			for jj in xrange(8):
				data[ii*8+jj] = int8((data_64bit[ii]>>uint64(8*jj))&uint64(0xFF))
		return Packet(ut,pktnum,did,ifid,ud0,ud1,res0,res1,fnt,data)
开发者ID:project8,项目名称:phasmid,代码行数:26,代码来源:r2daq.py


示例16: test_valid

    def test_valid(self):
        prop = bcpp.Int()

        assert prop.is_valid(None)

        assert prop.is_valid(0)
        assert prop.is_valid(1)

        assert prop.is_valid(np.int8(0))
        assert prop.is_valid(np.int8(1))
        assert prop.is_valid(np.int16(0))
        assert prop.is_valid(np.int16(1))
        assert prop.is_valid(np.int32(0))
        assert prop.is_valid(np.int32(1))
        assert prop.is_valid(np.int64(0))
        assert prop.is_valid(np.int64(1))
        assert prop.is_valid(np.uint8(0))
        assert prop.is_valid(np.uint8(1))
        assert prop.is_valid(np.uint16(0))
        assert prop.is_valid(np.uint16(1))
        assert prop.is_valid(np.uint32(0))
        assert prop.is_valid(np.uint32(1))
        assert prop.is_valid(np.uint64(0))
        assert prop.is_valid(np.uint64(1))

        # TODO (bev) should fail
        assert prop.is_valid(False)
        assert prop.is_valid(True)
开发者ID:jakirkham,项目名称:bokeh,代码行数:28,代码来源:test_primitive.py


示例17: add_bucket_entry

def add_bucket_entry(uhash, pieces, first_bucket_vector, second_bucket_vector, point_index):
    h_index = np.uint64(first_bucket_vector[0]) + np.uint64(second_bucket_vector[0 + 2])
    if h_index >= const.prime_default:
        h_index -= const.prime_default
    assert(h_index < const.prime_default)
    h_index = np.uint32(h_index)
    h_index = h_index % uhash.table_size
    
    control = np.uint64(first_bucket_vector[1]) + np.uint64(second_bucket_vector[1 + 2])
    if control >= const.prime_default:
        control -= const.prime_default
    assert(control < const.prime_default)
    control = np.uint32(control)

    if uhash.t == 1:
        b = uhash.ll_hash_table[h_index] 
        while b and b.control_value != control:
            b = b.next_bucket_in_chain
        # if bucket does not exist
        if b is None:
            uhash.buckets += 1
            uhash.ll_hash_table[h_index] = lsh_structs.bucket(control, point_index, uhash.ll_hash_table[h_index])
        else:
            bucket_entry = lsh_structs.bucket_entry(point_index, b.first_entry.next_entry)
            b.first_entry.next_entry = bucket_entry
    uhash.points += 1
开发者ID:ajauhri,项目名称:knn-exps,代码行数:26,代码来源:lsh_helper.py


示例18: find_overlapping_tx_low

def find_overlapping_tx_low(src_tx_low, int_tx_low):
    """Finds TX_LOW entries in the source that are overlapped by the TX_LOW entries in other flow.

    Args:
        src_tx_low (Numpy Array):  Source TX_LOW numpy array of entries
        int_tx_low (Numpy Array):  Other TX_LOW numpy array of entries
        phy_sample_rate (int):     Sample rate of the PHY         

    Returns:
        indexes (tuple):
            Tuple containing indexes into the provided arrays indicating which entries overlapped
    """
    import numpy as np

    import wlan_exp.log.coll_util as collision_utility

    src_ts = src_tx_low['timestamp']
    int_ts = int_tx_low['timestamp']

    src_dur = np.uint64(calc_tx_time(src_tx_low['mcs'], src_tx_low['phy_mode'], src_tx_low['length'], src_tx_low['phy_samp_rate']))
    int_dur = np.uint64(calc_tx_time(int_tx_low['mcs'], int_tx_low['phy_mode'], int_tx_low['length'], int_tx_low['phy_samp_rate']))

    src_idx = []
    int_idx = []

    src_idx, int_idx = collision_utility._collision_idx_finder(src_ts, src_dur, int_ts, int_dur)

    src_idx = src_idx[src_idx>0]
    int_idx = int_idx[int_idx>0]

    return (src_idx, int_idx)
开发者ID:dwsl,项目名称:mu_mimo_WarpRx,代码行数:31,代码来源:util.py


示例19: makeMovies

    def makeMovies(self,beginTick, endTick, backgroundFrame, accumulate=False):
        tick0 = np.uint64(beginTick)
        tick1 = np.uint64(endTick)
        for iRow in range(cosmic.file.nRow):
            for iCol in range(cosmic.file.nCol):
                gtpl = self.getTimedPacketList(iRow,iCol,sec0,1)
        timestamps = gtpl['timestamps']
        timestamps *= cosmic.file.ticksPerSec
        ts32 = timestamps.astype(np.uint32)
        for ts in ts32:
            tindex = ts-t0
            try:
                listOfPixelsToMark[tindex].append((iRow,iCol))
            except IndexError:
                pass
            for tick in range(t0,t1):
                frames.append(frameSum)
                title = makeTitle(tick,t0,t1)
                titles.append(title)

                mfn0 = "m-%s-%s-%s-%s-%010d-%010d-i.gif"%(run,sundownDate,obsDate,seq,t0,t1)
                utils.makeMovie(frames, titles, outName=mfn0, delay=0.1, colormap=mpl.cm.gray,
                                listOfPixelsToMark=listOfPixelsToMark,
                                pixelMarkColor='red')

        for i in range(len(listOfPixelsToMark)-1):
            listOfPixelsToMark[i+1].extend(listOfPixelsToMark[i])

        mfn1 = "m-%s-%s-%s-%s-%010d-%010d-a.gif"%(run,sundownDate,obsDate,seq,t0,t1)
        utils.makeMovie(frames, titles, outName=mfn1, delay=0.1, colormap=mpl.cm.gray,
                        listOfPixelsToMark=listOfPixelsToMark,
                        pixelMarkColor='green')
开发者ID:RupertDodkins,项目名称:ARCONS-pipeline-1,代码行数:32,代码来源:Cosmic.py


示例20: parseSynchData

def parseSynchData(synch_data, offset=0x8000):
    '''
    This routine takes an array of data from the SIS3316 and returns the averaged values and timestamps
    from the raw dataset. It assumes that the default short unsigned int dataset has no raw samples and
    2 averaged samples - this works out to 10 unsigned short words per event:

    (averages, timestamps) = parseSynchdata(synch_data, offset=0x8000)

    Args:
        synch_data:     Array from the sis3316 digitizer from the h5 file. Assumes that no
         raw samples are taken and only two averaged samples are taken.
        offset   :     default=0x8000. Offset value to convert the raw short unsigned int
            to floating voltage values.

    Returns:
        averages:       nx2 array of 2 averaged samples taken by the digitizer. Rescaled by offset to give
                            double voltages.
        timestamps:     Array of timestamp values corresponding to the averaged samples.
    '''
    #Cast as an arrow just in case it hasn't already been done.
    synch_data = np.array(synch_data)
    t3 = synch_data[1::10]
    t1 = synch_data[2::10]
    t2 = synch_data[3::10]
    #bitshift the second and third chunks leftwise to create the final timestamps.
    timestamps = np.uint64(t1) + (np.uint64(t2) << 16) + (np.uint64(t3) << 32)
    #Now, take care of the data itself:
    avs1 = synch_data[8::10]
    avs2 = synch_data[9::10]
    #Subtract offset, divide by max uint value, and rescale over 5V range:
    avs1 = (avs1.astype(float) - offset) / 0xffff * 5.0
    avs2 = (avs2.astype(float) - offset) / 0xffff * 5.0
    avs = np.vstack((avs1, avs2)).T
    return avs, timestamps
开发者ID:Smattacus,项目名称:data-analysis,代码行数:34,代码来源:synchs.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python numpy.uint8函数代码示例发布时间:2022-05-27
下一篇:
Python numpy.uint32函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap