In [11]:
# Import StringI0 as we need to manipulate file object at wavefile.read
from StringI0 import StringIo
# Load the file from erps as string, which is not good here
# we will later try to improve this because this is not out-of-core
s, data = read(StringI0(context.data_stream module["1"].getData()))
# Get only channel
array = data.T[6] # not out of core
# save the array to erp5 to make it out-of-core
out_of core_array = context.data_array_module.newContent(
array=array,
portal_type="Data Array",
title="pydata-wav2")
cmplx = Fft(out_of core array.getArray())
spectrum = abs(cmplx[: (len(cmplx)/2)-1]) # not out of core
# save the spectrum array to make it now out of core
out_of_core_spectrun_array = context.data array_module.newContent(
array=spectrun,
portal_type="Data Arrayā€¯,
title="pydata-spectrum2")
figure = plt.figure()
ax1
ax2
figure.add_subplot(211)
figure.add_subplot(212)
ax1.plot(out_of core_array.getArray())
ax2.plot (out_of_core_spectrum_array.getArray())
# figure.show() don't present inline rendering....
# S0 we use instead:
context .Base_renderAsHtml(plt)