当前位置: 首页>>代码示例>>Python>>正文


Python numpy.set_string_function方法代码示例

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


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

示例1: get_dataset

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def get_dataset(dataset):
    """
    >>> np.set_string_function(lambda a: f'array(shape={a.shape}, dtype={a.dtype})')
    >>> pprint(get_dataset('cv_dev93')[0])  # doctest: +ELLIPSIS
    {'audio_path': ...,
     ...,
     'example_id': '4k0c0301_4k6c030t_0',
     ...,
     'kaldi_transcription': ...,
     ...,
     'audio_data': {'speech_source': array(shape=(2, 103650), dtype=float64),
      'rir': array(shape=(2, 6, 8192), dtype=float64),
      'speech_image': array(shape=(2, 6, 103650), dtype=float64),
      'speech_reverberation_early': array(shape=(2, 6, 103650), dtype=float64),
      'speech_reverberation_tail': array(shape=(2, 6, 103650), dtype=float64),
      'noise_image': array(shape=(1, 1), dtype=float64),
      'observation': array(shape=(6, 103650), dtype=float64)},
     'snr': 29.749852569493584}
    """
    db = SmsWsj()
    ds = db.get_dataset(dataset)
    ds = ds.map(AudioReader())
    return ds 
开发者ID:fgnt,项目名称:sms_wsj,代码行数:25,代码来源:metric_target_comparison.py

示例2: get_printoptions

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def get_printoptions():
    """
    Return the current print options.

    Returns
    -------
    print_opts : dict
        Dictionary of current print options with keys

          - precision : int
          - threshold : int
          - edgeitems : int
          - linewidth : int
          - suppress : bool
          - nanstr : str
          - infstr : str
          - formatter : dict of callables
          - sign : str

        For a full description of these options, see `set_printoptions`.

    See Also
    --------
    set_printoptions, set_string_function

    """
    return _format_options.copy() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:29,代码来源:arrayprint.py

示例3: test_set_string_function

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def test_set_string_function(self):
        a = np.array([1])
        np.set_string_function(lambda x: "FOO", repr=True)
        assert_equal(repr(a), "FOO")
        np.set_string_function(None, repr=True)
        assert_equal(repr(a), "array([1])")

        np.set_string_function(lambda x: "FOO", repr=False)
        assert_equal(str(a), "FOO")
        np.set_string_function(None, repr=False)
        assert_equal(str(a), "[1]") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:test_numeric.py

示例4: low_reverberation_data

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def low_reverberation_data():
    """
    >>> import numpy as np
    >>> np.set_string_function(lambda a: f'array(shape={a.shape}, dtype={a.dtype})')
    >>> from IPython.lib.pretty import pprint
    >>> pprint(low_reverberation_data())  # doctest: +ELLIPSIS
    {'audio_path': ...,
     'gender': ['m', 'm'],
     'kaldi_transcription': ["NOR IS MISTER QUILTER'S MANNER LESS INTERESTING THAN HIS MATTER",
      'MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL'],
     'log_weights': [1.2027951449295022, -1.2027951449295022],
     'num_samples': {'observation': 38520, 'speech_source': [38520, 46840]},
     'num_speakers': 2,
     'offset': [0, 0],
     'room_dimensions': [[8.196200148369396],
      [6.05928772400428],
      [3.1540068920818385]],
     'sensor_position': ...,
     'snr': 29.749852569493584,
     'sound_decay_time': 0,
     'source_id': ['4k0c0301', '4k6c030t'],
     'source_position': ...,
      [1.6594772807620646, 1.6594772807620646]],
     'speaker_id': ['1272-128104', '1272-128104'],
     'example_id': 'low_reverberation',
     'dataset': 'test',
     'audio_data': {'noise_image': array(shape=(6, 38520), dtype=float64),
      'observation': array(shape=(6, 38520), dtype=float64),
      'speech_image': array(shape=(2, 6, 38520), dtype=float64),
      'speech_reverberation_early': array(shape=(2, 6, 38520), dtype=float64),
      'speech_reverberation_tail': array(shape=(2, 6, 38520), dtype=float64),
      'speech_source': array(shape=(2, 38520), dtype=float64)}}
    >>> np.set_string_function(None)  # needed for pytest. np.set_string_function is not properly reseted.
    """
    return _get_data()['low_reverberation'] 
开发者ID:fgnt,项目名称:pb_bss,代码行数:37,代码来源:dummy_data.py

示例5: reverberation_data

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def reverberation_data():
    """

    >>> import numpy as np
    >>> np.set_string_function(lambda a: f'array(shape={a.shape}, dtype={a.dtype})')
    >>> from IPython.lib.pretty import pprint
    >>> pprint(reverberation_data())  # doctest: +ELLIPSIS
    {'audio_path': ...,
     'gender': ['m', 'm'],
     'kaldi_transcription': ["NOR IS MISTER QUILTER'S MANNER LESS INTERESTING THAN HIS MATTER",
      'MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL'],
     'log_weights': [1.2027951449295022, -1.2027951449295022],
     'num_samples': {'observation': 38520, 'speech_source': [38520, 46840]},
     'num_speakers': 2,
     'offset': [0, 0],
     'room_dimensions': ...,
     'sensor_position': ...,
     'snr': 29.749852569493584,
     'sound_decay_time': 0.354,
     'source_id': ['4k0c0301', '4k6c030t'],
     'source_position': ...,
     'speaker_id': ['1272-128104', '1272-128104'],
     'example_id': 'reverberation',
     'dataset': 'test',
     'audio_data': ...
    >>> np.set_string_function(None)  # needed for pytest. np.set_string_function is not properly reseted.

    """
    return _get_data()['reverberation'] 
开发者ID:fgnt,项目名称:pb_bss,代码行数:31,代码来源:dummy_data.py

示例6: get_dataset

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import set_string_function [as 别名]
def get_dataset(dataset, json_path):
    """
    >>> from IPython.lib.pretty import pprint
    >>> np.set_string_function(lambda a: f'array(shape={a.shape}, dtype={a.dtype})')
    >>> pprint(get_dataset('cv_dev93')[0])  # doctest: +ELLIPSIS
    {...
     'example_id': '0_4k6c0303_4k4c0319',
     ...
     'snr': 23.287502642941252,
     'dataset': 'cv_dev93',
     'audio_data': {'observation': array(shape=(6, 93389), dtype=float64),
      'speech_source': array(shape=(2, 93389), dtype=float64),
      'speech_reverberation_early': array(shape=(2, 6, 93389), dtype=float64),
      'speech_reverberation_tail': array(shape=(2, 6, 93389), dtype=float64),
      'noise_image': array(shape=(6, 93389), dtype=float64),
      'speech_image': array(shape=(2, 6, 93389), dtype=float64),
      'Speech_source': array(shape=(2, 733, 257), dtype=complex128),
      'Speech_reverberation_early': array(shape=(2, 6, 733, 257), dtype=complex128),
      'Speech_reverberation_tail': array(shape=(2, 6, 733, 257), dtype=complex128),
      'Speech_image': array(shape=(2, 6, 733, 257), dtype=complex128),
      'Noise_image': array(shape=(6, 733, 257), dtype=complex128),
      'Observation': array(shape=(6, 733, 257), dtype=complex128)}}

    """
    db = SmsWsj(json_path=json_path)
    ds = db.get_dataset(dataset)
    ds = ds.map(AudioReader())

    def calculate_stfts(ex):
        ex['audio_data']['Speech_source'] = stft(ex['audio_data']['speech_source'])
        ex['audio_data']['Speech_reverberation_early'] = stft(ex['audio_data']['speech_reverberation_early'])
        ex['audio_data']['Speech_reverberation_tail'] = stft(ex['audio_data']['speech_reverberation_tail'])
        ex['audio_data']['Speech_image'] = stft(ex['audio_data']['speech_image'])
        ex['audio_data']['Noise_image'] = stft(ex['audio_data']['noise_image'])
        ex['audio_data']['Observation'] = stft(ex['audio_data']['observation'])
        return ex

    return ds.map(calculate_stfts) 
开发者ID:fgnt,项目名称:sms_wsj,代码行数:40,代码来源:reference_systems.py


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