Talk to an expert
December 31st, 2019
December 31st, 2019

    SIGN FOR NEWS

    sign for news

    Lorem ipsum dolor amet, consectetur adipiscing elit, sed do eiusmod tempor.


    Notebook for the slow performance post (https://www.translucentcomputing.com/2019/12/performance-in-jupyter-python/). The slow method has been moved into another file. The mprun magic command requires for the profiled code to be in another file.

    slow_example.py

    import math
    import random
    
    # Really slow generation of synthetic data
    def reallySlowGenerateTimeSeriesData(seconds,samples_per_second):
        """Generate synthetic data"""
        
        time = []
        signal = []   
        
        # generate signal
        sample_time = 0
        for s in range(seconds):        
            for sps in range(samples_per_second):
                sample_time += 1/samples_per_second
                noise = random.random()
                scaled_noise = -1 + (noise * 2)
                sample = math.sin(2*math.pi*10*sample_time) + scaled_noise
                time.append(sample_time)
                signal.append(sample)
        
        # return time and signal
        return [time,signal]
    0 0 votes
    Article Rating

    We treat your business like our own.

    Let's talk!
    0
    Would love your thoughts, please comment.x
    ()
    x