23 def dump(filename, spectra):
25 Save a list of wirecell.sigproc.noise.NoiseSpectrum objects to a 26 file of the given name. 28 File is saved depending on extension. .json, .json.bz2 and 29 .json.gz are supported. 31 text =
dumps(spectra,indent=4)
32 if filename.endswith(
".json"):
35 if filename.endswith(
".json.bz2"):
37 bz2.BZ2File(filename,
'w').
write(text)
39 if filename.endswith(
".json.gz"):
41 gzip.open(filename,
"wb").
write(text)
43 raise ValueError(
"unknown file format: %s" % filename)
def dumps(spectra, indent=4)
def dump(filename, spectra)
int open(const char *, int)
Opens a file descriptor.
size_t write(int, const char *, size_t)
Writes count bytes from buf to the filedescriptor fd.