pip install ndx-spectrum
from ndx_spectrum import Spectrum
from datetime import datetime
from pynwb import NWBFile
nwb = NWBFile('session_description', 'identifier', datetime.now().astimezone())
spectrum = Spectrum('test_spectrum', frequencies=[1.,2.,3.], power=[1.,2.,3.],
phase=[1.,2.,3.])