diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-21 13:15:55 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-21 13:15:55 +0800 |
commit | 537e6c810cbfe8c1d4c81fdcc6d0908d468598ef (patch) | |
tree | 38d73fe1b9e3488b25bf5aed3cade87f291656fe /fg21sim/products.py | |
parent | dc06505e902d3a2b8fdcc276b61db0636308d1e6 (diff) | |
download | fg21sim-537e6c810cbfe8c1d4c81fdcc6d0908d468598ef.tar.bz2 |
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"
Diffstat (limited to 'fg21sim/products.py')
-rw-r--r-- | fg21sim/products.py | 10 |
1 files 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: |