diff --git a/qpms/argproc.py b/qpms/argproc.py index 2295f72..bdbffb2 100644 --- a/qpms/argproc.py +++ b/qpms/argproc.py @@ -238,12 +238,14 @@ constant_tmatrix_spec = namedtuple("constant_tmatrix_spec", ("bspec", "matrix")) cyl_sph_dimensions = namedtuple("cyl_sph_dimensions", ("radius", "height", "lMax_extend")) tmgen_spec = namedtuple("tmgen_spec", ("bgspec", "fgspec", "dims")) -def string2bspec(string): +def string2bspec_tuple(string): """ - Converts string representation of list to BaseSpec. + Converts string representation of list to BaseSpec... + And then to tuple, because we want the arguments to be picklable :( """ from .cybspec import BaseSpec - return BaseSpec(ast.literal_eval(string)) + bspec = BaseSpec(ast.literal_eval(string)) + return tuple(i for i in bspec.ilist) class ArgParser: ''' Common argument parsing engine for QPMS python CLI scripts. ''' @@ -307,10 +309,10 @@ class ArgParser: help='particle radius (cylinder; labeled)') # Alternatively, add a constant T-matrix mpgrp.add_argument("-w", "--vswf-set", nargs=1, default={}, - action=make_dict_action(argtype=string2bspec, postaction='store', first_is_key=False), + action=make_dict_action(argtype=string2bspec_tuple, postaction='store', first_is_key=False), help='Manual specification of VSWF set codes (format as a python list of integers); see docs on qpms_uvswfi_t for valid codes or simply use --lMax instead. Overrides --lMax.') mpgrp.add_argument("+w", "++vswf-set", nargs=2, default={}, - action=make_dict_action(argtype=string2bspec, postaction='store', first_is_key=True), + action=make_dict_action(argtype=string2bspec_tuple, postaction='store', first_is_key=True), metavar=('LABEL', "VSWF_SET"), help='Manual specification of VSWF set codes (format as a python list of integers); see docs on qpms_uvswfi_t for valid codes or simply use ++lMax instead. Overrides ++lMax and --lMax.') mpgrp.add_argument("-T", "--constant-tmatrix", nargs=1, default={},