Skip to main content

Guang

image image image image

Universal function library of scientific calculation.

Requirements

Python 3
CUDA >= 10.0
PyTorch >= 1.0
Tensorflow >= 1.12.0
opencv-python
pydub
librosa
pyworld
soundfile
pypinyin
pomegranate
python-Levenshtein
streamlit
pyprobar
fire

Installation

# Before install `guang`, you need to have all the requirements installed.
pip install guang

Nightly Build

git clone https://github.com/beidongjiedeguang/guang.git
cd guang
python ./night_workflow.py

Examples

  • Convert audio in .mp3/ .wav format to (sample rate=16k, single channel) .wav format

    Use in bash/shell

    guang cvt2wav INPUT OUTPUT
    

    Use as function

    from guang.Voice.convert import cvt2wav
    cvt2wav(input_name, output_name, sr=16000)
    
    # Multi-process
    from guang.Voice.convert import multi_cvt2wav 
    multi_cvt2wav(PATH1, PATH2,sr=16000, n_cpu=None)
    
  • Let the video play at N times speed (install ffmpeg first)

    guang av_speed inputname outputname N --cut_frame=False
    
  • Fourier visualization

    guang fourier
    
  • Fourier draw anything you want

  • FFT convolution

    from guang.sci import fft
    A = np.random.rand(100, 100)
    B = np.random.rand(100, 100)
    fft.fft_conv2d(A, B)
    
  • Use dict_dotable to convert a dictionary to dot-able dictionary:

    from guang.Utils.toolsFunc import dict_dotable
    a = {'a':{'b':1}}
    a = dict_dotable(a)
    print(a.a.b)
    
    >> 1
    
  • Use probar to display current progress has separated to pyprobar

    from guang.Utils.bar import bar, probar
    for idx, x in probar(range(10)):
        time.sleep(0.8)
    
    >> 100.00% |█████████████████████████████| 0'7.2"|0'7.2" ETC: 12-2 23:59:8
    
    N = 1024
    a = np.linspace(2, 5, N)
    for idx, i in enumerate(a):
        time.sleep(0.01)
        bar(idx, N)
    >> 100.00% |█████████████████████████████| 0:00:00|0:00:10  ETC: 02-19 20:33:34 
    
  • @broadcast broadcast a non-broadcast function.

    from guang.Utils.toolsFunc import broadcast
    
    @broadcast
    def f(x):
        # A function that can map only a single element
        if x==1 or x==0:
            return x
        else:
            return f(x-1)+f(x-2)
    
    >> f([2,4,10])
    >> array([1, 3, 832040], dtype=object)
    
  • download download files from google drive.

    from guang.Utils.google import download
    url = "https://drive.google.com/open?id=1eU57Fkv1DBEOqi-iOs1AebD02FqVDY23"
    outname = "filename.zip"
    download(url, outname)
    
  • txt2ph Convert Chinese characters to phoneme.

    from guang.Voice.txt2pinyin import txt2ph
    txt2ph('你好,我是光')
    
    >> [('n', 'i3'), ('h', 'ao3'), ('sp1',), ('uo3',), ('sh', 'ii4'), ('g', 'uang1')]
    
  • reduce_from_duration Remove files with duration less than least_time seconds. Note that this function does not work in the interactive interpreter because it uses multiprocessing.pool.Pool

    from guang.Voice.reduce import reduce_from_duration
    
    reduced_list = reduce_from_duration(path_list, least_time=2)
    print(len(path_list), len(reduced_list))
    
    >> (6889, 6714)
    
  • Find NOT silence part of a sound file: find_no_silence

    from guang.Voice.reduce import find_no_silence
    start, end, arg_start, arg_end = find_no_silence(filename)
    
  • Download wechat files.

    from guang.wechat.Utils.download import downloads
    downloads(nickName='caloi', fileType='mp3', d_t=60)
    
  • Plots 3D Scatter:

    from guang.Utils.plotly import Scatter3d
    from guang.Utils.interesting import Lorenz
    trace = Lorenz.Trace()
    x,y,z = trace[:,0], trace[:,1], trace[:,2]
    
    fig = Scatter3d()
    fig.scatter3d(x,y,z,mode="lines+markers",color_line=z,color_marker=None,marker_size=2)
    fig.show()
    
  • Data dimension reduction:

    cd guang/ML/manifold
    python test_digits.py
    
    python test_s_curve
    
  • :smiley:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guang-0.0.8.1.6.tar.gz (112.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guang-0.0.8.1.6-py3-none-any.whl (157.4 kB view details)

Uploaded Python 3

File details

Details for the file guang-0.0.8.1.6.tar.gz.

File metadata

  • Download URL: guang-0.0.8.1.6.tar.gz
  • Upload date:
  • Size: 112.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for guang-0.0.8.1.6.tar.gz
Algorithm Hash digest
SHA256 0b9c52a4f32f6c9905f68cca944914e3172e5d1d78cd775d2e9ae09ea870faa4
MD5 c75d5f2d8d9a26d3761c79189d8f9040
BLAKE2b-256 06f15b86c3b52f01a86fb32ef21d712a00fa2e5396deae9d97cc6ba3bdd32431

See more details on using hashes here.

File details

Details for the file guang-0.0.8.1.6-py3-none-any.whl.

File metadata

  • Download URL: guang-0.0.8.1.6-py3-none-any.whl
  • Upload date:
  • Size: 157.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for guang-0.0.8.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9acf0ccaf4bc80221cd9fc86a7fd2fbfff30ae5ae2977b4993ceeacf38be658f
MD5 e791691aa6b9f84b2d8c9f84865030d2
BLAKE2b-256 800db5f0558ded4acbf71b492a66fcf4fd87cb5205fa6b5baf8e0f1dd12e2e88

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.8.1.6 This release

2 files

0.0.8.1.5

2 files

0.0.8.1.3

2 files

0.0.8.1.0

2 files

0.0.8.0.9

2 files

0.0.8.0.8

2 files

0.0.8.0.7

2 files

0.0.8.0.6

2 files

0.0.8.0.5

2 files

0.0.8.0.3

2 files

0.0.7.9.9

2 files

0.0.7.9.8

2 files

0.0.7.9.7

2 files

0.0.7.9.6

2 files

0.0.7.9.5

2 files

0.0.7.9.4

2 files

0.0.7.9.3

2 files

0.0.7.9.2

2 files

0.0.7.9.1

2 files

0.0.7.9.0

2 files

0.0.7.7.9

2 files

0.0.7.7.8

2 files

0.0.7.7.7

2 files

0.0.7.7.6

2 files

0.0.7.7.5

2 files

0.0.7.7.4

2 files

0.0.7.7.3

2 files

0.0.7.7.0

2 files

0.0.7.6.9

2 files

0.0.7.6.8

2 files

0.0.7.6.7

2 files

0.0.7.6.6

2 files

0.0.7.6.5

2 files

0.0.7.6.2

2 files

0.0.7.6.1

2 files

0.0.7.6.0

2 files

0.0.7.5.6

2 files

0.0.7.5.5

2 files

0.0.7.5.2

2 files

0.0.7.2.7

2 files

0.0.7.2.5

2 files

0.0.7.2.1

2 files

0.0.7.1

2 files

0.0.6.6

2 files

0.0.6.5

2 files

0.0.6.2

2 files

0.0.6.1

2 files

0.0.6

2 files

0.0.5.9

2 files

0.0.5.7

2 files

0.0.5.6.5

2 files

0.0.5.6

2 files

0.0.5.5

2 files

0.0.5.2

2 files

0.0.5

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page