From 537e6c810cbfe8c1d4c81fdcc6d0908d468598ef Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 21 Nov 2016 13:15:55 +0800 Subject: products.py: Fix three bugs. * Convert "range()" to list, also make sure "value" is a Python list * Parameter "outfile" of "dump()" is optional * Correct the wrong "self.userconfig" to "self.manifestfile" --- fg21sim/products.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fg21sim/products.py b/fg21sim/products.py index 5df7d7a..b7a1590 100644 --- a/fg21sim/products.py +++ b/fg21sim/products.py @@ -82,8 +82,8 @@ class Products: Each frequency has an ID (also its index in the frequencies list). """ self.manifest["frequency"] = { - "frequencies": value, - "id": range(len(value)), + "frequencies": list(value), + "id": list(range(len(value))), } logger.info("Number of frequencies: {0}".format(len(value))) @@ -233,13 +233,13 @@ class Products: """ raise NotImplementedError("TODO") - def dump(self, outfile, clobber=False, backup=True): + def dump(self, outfile=None, clobber=False, backup=True): """ Dump the manifest as a JSON file. Parameters ---------- - outfile : str + outfile : str, optional The path to the output manifest file. If not provided, then use ``self.manifestfile``. NOTE: @@ -260,7 +260,7 @@ class Products: If the target filename already exists and ``clobber=False``. """ if outfile is None: - if self.userconfig is None: + if self.manifestfile is None: raise ValueError("outfile is missing and " + "self.manifestfile is None") else: -- cgit v1.2.2