:returns: a composite dtype (imt, poe)
548989
def hmap_dt(self):  # used for CSV export
        
        return numpy.dtype([('%s-%s' % (imt, poe), F32)
                            for imt in self.imtls for poe in self.poes])
27892
def targetMed(self):
        
        med_byte = None
        if self.target.addr is not None and self._messageFlags.isBroadcast:
            med_byte = self.target.bytes[1]
        return med_byte
564100
def gmf_data_dt(self):
        
        return numpy.dtype(
            [('rlzi', U16), ('sid', U32),
             ('eid', U64), ('gmv', (F32, (len(self.imtls),)))])
855255
def decode_imod(packet, channel=1):
    """"""
    val = str(packet.get(QSDATA, ''))
    if len(val) == 8 and val.startswith('4e'):
        try:
            _map = ((5, 1), (5, 2), (5, 4), (4, 1), (5, 1), (5, 2))[
                channel - 1]
            return (int(val[_map[0]], 16) & _map[1]) == 0
        except IndexError:
            return None
    return None
686467
def coerce_to_dtypes(result, dtypes):
    
    if len(result) != len(dtypes):
        raise AssertionError("_coerce_to_dtypes requires equal len arrays")

    def conv(r, dtype):
        try:
            if isna(r):
                pass
            elif dtype == _NS_DTYPE:
                r = tslibs.Timestamp(r)
            elif dtype == _TD_DTYPE:
                r = tslibs.Timedelta(r)
            elif dtype == np.bool_:
                # messy. non 0/1 integers do not get converted.
                if is_integer(r) and r not in [0, 1]:
                    return int(r)
                r = bool(r)
            elif dtype.kind == 'f':
                r = float(r)
            elif dtype.kind == 'i':
                r = int(r)
        except Exception:
            pass

        return r

    return [conv(r, dtype) for r, dtype in zip(result, dtypes)]
1130699
def serialize_dtype(o):
    
    if len(o) == 0:
        return dict(
            _type='np.dtype',
            descr=str(o))
    return dict(
        _type='np.dtype',
        descr=o.descr)
3101
def make_iml4(R, iml_disagg, imtls=None, poes_disagg=(None,), curves=()):
    
    if imtls is None:
        imtls = {imt: [iml] for imt, iml in iml_disagg.items()}
    N = len(curves) or 1
    M = len(imtls)
    P = len(poes_disagg)
    arr = numpy.zeros((N, R, M, P))
    imts = [from_string(imt) for imt in imtls]
    for m, imt in enumerate(imtls):
        imls = imtls[imt]
        for p, poe in enumerate(poes_disagg):
            for r in range(R):
                arr[:, r, m, p] = _imls(curves, poe, imt, imls, r)
    return ArrayWrapper(arr, dict(poes_disagg=poes_disagg, imts=imts))
487421
def dtypes(self):
        
        return [(str(f.name), f.dataType.simpleString()) for f in self.schema.fields]
630670
def from_cli(cls, opt, strain):
        
        return cls(strain, segment_length=opt.segment_length,
                   segment_start_pad=opt.segment_start_pad,
                   segment_end_pad=opt.segment_end_pad,
                   trigger_start=opt.trig_start_time,
                   trigger_end=opt.trig_end_time,
                   filter_inj_only=opt.filter_inj_only,
                   injection_window=opt.injection_window,
                   allow_zero_padding=opt.allow_zero_padding)
278031
def gsim_imt_dt(sorted_gsims, sorted_imts):
    
    dtlist = [(imt, numpy.float32) for imt in sorted_imts]
    imt_dt = numpy.dtype(dtlist)
    return numpy.dtype([(str(gsim), imt_dt) for gsim in sorted_gsims])
1260820
def recv_raw(self, x=MTU):
        """"""  # noqa: E501
        pkt, sa_ll = self.ins.recvfrom(x)
        if self.outs and sa_ll[2] == socket.PACKET_OUTGOING:
            return None, None, None
        ts = get_last_packet_timestamp(self.ins)
        return self.LL, pkt, ts
728373
def dtype_for(t):
    
    if t in dtype_dict:
        return dtype_dict[t]
    return np.typeDict.get(t, t)
987356
def type(self):
        """"""
        return ffi.string(lib.EnvGetDefmessageHandlerType(
            self._env, self._cls, self._idx)).decode()
966769
def get_one_meth_type(self, mtype, method_list):
        
        cond = method_list['dtype'] == mtype
        codes = method_list[cond]
        return codes
934430
def format(self, typedval):
        ''
        if typedval is None:
            return None

        if isinstance(typedval, (list, tuple)):
            return '[%s]' % len(typedval)
        if isinstance(typedval, dict):
            return '{%s}' % len(typedval)
        if isinstance(typedval, bytes):
            typedval = typedval.decode(options.encoding, options.encoding_errors)

        return getType(self.type).formatter(self.fmtstr, typedval)
359429
def _aux_type(self, i):
        
        aux_type = ctypes.c_int()
        check_call(_LIB.MXNDArrayGetAuxType(self.handle, i, ctypes.byref(aux_type)))
        return _DTYPE_MX_TO_NP[aux_type.value]
439044
def make_uhs(hmap, info):
    
    uhs = numpy.zeros(len(hmap), info['uhs_dt'])
    for p, poe in enumerate(info['poes']):
        for m, imt in enumerate(info['imtls']):
            if imt.startswith(('PGA', 'SA')):
                uhs[str(poe)][imt] = hmap[:, m, p]
    return uhs