1 year ago

#332729

test-img

ConsistentC

Package colorednoise.py working in jupyter notebook but no script under the same environment

When I run the code:


import sys
import math
import numpy as np
import matplotlib.pyplot as plt
from typing import List, Tuple
import os
import scipy.io, scipy.signal
import colorednoise as cn

def generate_pink_noise(singal_length):
    beta = 1      
    samples = singal_length  
    noise = cn.powerlaw_psd_gaussian(beta, samples)
    return noise

I get:

Traceback (most recent call last):
  File "...MEA_foward_model.py", line 11, in <module>
    import colorednoise as cn
ModuleNotFoundError: No module named 'colorednoise'

Note the 'test' environment I'm using shown here when I get the error: environment. However the same code runs without error in Jupiter notebook:


import colorednoise as cn
signal_length =10
beta = 1         # the exponent: 0=white noite; 1=pink noise;  2=red noise (also "brownian noise")
samples = signal_length  # number of samples to generate (time series extension)
noise = cn.powerlaw_psd_gaussian(beta, samples)

This image shows (see top right corner) shows that the same environment is used jupyter notebook output. What is causing this dissonance between the two different behaviours?

python

jupyter-notebook

environment

noise

0 Answers

Your Answer

Accepted video resources