Sorry ... I did'not notice
Sujet : | Re: [sage-support] Re: numpy |
---|---|
Date : | Tue, 9 Jan 2018 12:46:13 +0100 |
De : | Simon King <simon...@uni-jena.de> |
Pour : | Girard Henri <henri....@gmail.com> |
Dear Girard, please answer to the list, not to me privately. On the one hand, you are more likely to get an answer when more than just one person reads your question, and on the other hand, other users who might have the same question as you will benefit from being able to read about it in sage-support. Best regards, Simon Am 09.01.2018 um 12:18 schrieb Girard Henri: > An exemple > > from matplotlib import pyplot as plt > from scipy.io import wavfile > import numpy as np > samplerate,data=wavfile.read("test.wav") > times=np.arange(len(data))/float(samplerate) > plt.plot(data[:1000]) > > > > Le 09/01/2018 à 11:30, Simon King a écrit : >> Hi, >> >> On 2018-01-09, Girard Henri <henri....@gmail.com> wrote: >>> I would like to know how to make this command numpy : >>> >>> import numpy as np >>> >>> times=np.arange ? >> What do you mean by "make this command"? numpy is included in SageMath. >> Therefore, >> import numpy as np >> times = np.arange >> just works. >> >> Regards, >> Simon >> >
Nothing goes wrong : My question is sage has already lot of functions
which don't need numpy, but if there is one function which needs numpy I
will have to add it.
And arange needs np then I am asking if there a way
to do it in sage without using numpy,
Dear Emmanuel,
Thank you very much for your explanations... What I should have
said after reading you is "converting"
arange() does a sort of x,-2,2 for example (but I am not sure what it does that why I don't want to use something I don't understand. it's like np.linspace() I wonder if it doesn't come from matlab a kind of conversion ?
I think an academic person wouldn't bother about this and would use numpy or scipy, which I don't want to use as it is already in sage too, but transparent.
from __future__ import division,print_function, absolute_import
import struct,warnings,librosa
import numpy as np
from IPython.display import Audio
def wavPlayer(data, rate):
display(Audio(data, rate=rate))
from matplotlib import pyplot as plt
from scipy.io import wavfile
sr = 22050 # sample rate
T = 2.0 # seconds
t = np.linspace(0, T, int(T*sr), endpoint=False)
x = 0.5*np.sin(2*np.pi*440*t)
librosa.output.write_wav('la440.wav', x, sr)
samplerate,data=wavfile.read("la440.wav")
times=np.arange(len(data))/float(samplerate)
plt.plot(data[:1000]);
Audio(x, rate=sr)
This example shows my interrogation : I need a lot of import to do it... For this program I needed about 2 days looking in google how to find the functions. I don't complaint because people are nicely explaining me what I finished to notice... That's the wonder of mailing list of sage, one never feels lost or not long time.
Regards
Henri
--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
Dear Emmanuel,
Thank you very much for your explanations... What I should have said after reading you is "converting"
arange() does a sort of x,-2,2 for example (but I am not sure what it does that why I don't want to use something I don't understand.
it's like np.linspace() I wonder if it doesn't come from matlab a kind of conversion ?
I think an academic person wouldn't bother about this and would use numpy or scipy, which I don't want to use as it is already in sage too, but transparent.
from __future__ import division,print_function, absolute_import
import struct,warnings,librosa
import numpy as np
from IPython.display import Audio
def wavPlayer(data, rate):
display(Audio(data, rate=rate))
from matplotlib import pyplot as plt
from scipy.io import wavfile
sr = 22050 # sample rate
T = 2.0 # seconds
t = np.linspace(0, T, int(T*sr), endpoint=False)
x = 0.5*np.sin(2*np.pi*440*t)
librosa.output.write_wav('la440.wav', x, sr)
samplerate,data=wavfile.read("la440.wav")
times=np.arange(len(data))/float(samplerate)
plt.plot(data[:1000]);
Audio(x, rate=sr)
This example shows my interrogation : I need a lot of import to do it... For this program I needed about 2 days looking in google how to find the functions. I don't complaint because people are nicely explaining me what I finished to notice... That's the wonder of mailing list of sage, one never feels lost or not long time.