def add_cpinfo_to_lclist(<EOL>checkplots,  <EOL>initial_lc_catalog,<EOL>magcol,  <EOL>outfile,<EOL>checkplotglob='<STR_LIT>',<EOL>infokeys=CPINFO_DEFAULTKEYS,<EOL>nworkers=NCPUS<EOL>):
<EOL>if not isinstance(checkplots, list) and os.path.exists(checkplots):<EOL><INDENT>checkplots = sorted(glob.glob(os.path.join(checkplots, checkplotglob)))<EOL><DEDENT>tasklist = [(cpf, infokeys) for cpf in checkplots]<EOL>with ProcessPoolExecutor(max_workers=nworkers) as executor:<EOL><INDENT>resultfutures = executor.map(_cpinfo_key_worker, tasklist)<EOL><DEDENT>results = [x for x in resultfutures]<EOL>executor.shutdown()<EOL>with open(initial_lc_catalog,'<STR_LIT:rb>') as infd:<EOL><INDENT>lc_catalog = pickle.load(infd)<EOL><DEDENT>catalog_objectids = np.array(lc_catalog['<STR_LIT>']['<STR_LIT>'])<EOL>checkplot_objectids = np.array([x[<NUM_LIT:0>] for x in results])<EOL>extrainfokeys = []<EOL>actualkeys = []<EOL>for keyspec in infokeys:<EOL><INDENT>key, dtype, firstlevel, overwrite_append, nonesub, nansub = keyspec<EOL>if firstlevel:<EOL><INDENT>eik = key<EOL><DEDENT>else:<EOL><INDENT>eik = '<STR_LIT>' % (magcol, key)<EOL><DEDENT>extrainfokeys.append(eik)<EOL>eactual = eik.split('<STR_LIT:.>')<EOL>if not eactual[-<NUM_LIT:1>].isdigit():<EOL><INDENT>if not firstlevel:<EOL><INDENT>eactual = '<STR_LIT:.>'.join([eactual[<NUM_LIT:0>], eactual[-<NUM_LIT:1>]])<EOL><DEDENT>else:<EOL><INDENT>eactual = eactual[-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>elastkey = eactual[-<NUM_LIT:2>]<EOL>if elastkey.endswith('<STR_LIT>'):<EOL><INDENT>elastkey = elastkey[:-<NUM_LIT:2>]<EOL><DEDENT>elif elastkey.endswith('<STR_LIT:s>'):<EOL><INDENT>elastkey = elastkey[:-<NUM_LIT:1>]<EOL><DEDENT>if not firstlevel:<EOL><INDENT>eactual = '<STR_LIT:.>'.join([eactual[<NUM_LIT:0>], elastkey])<EOL><DEDENT>else:<EOL><INDENT>eactual = elastkey<EOL><DEDENT><DEDENT>actualkeys.append(eactual)<EOL>if eactual not in lc_catalog['<STR_LIT>']:<EOL><INDENT>lc_catalog['<STR_LIT>'].append(eactual)<EOL><DEDENT>lc_catalog['<STR_LIT>'][eactual] = []<EOL><DEDENT>for catobj in tqdm(catalog_objectids):<EOL><INDENT>cp_objind = np.where(checkplot_objectids == catobj)<EOL>if len(cp_objind[<NUM_LIT:0>]) > <NUM_LIT:0>:<EOL><INDENT>thiscpinfo = results[cp_objind[<NUM_LIT:0>][<NUM_LIT:0>]]<EOL>thiscpinfo = thiscpinfo[<NUM_LIT:1>:]<EOL>for ekind, ek in enumerate(actualkeys):<EOL><INDENT>lc_catalog['<STR_LIT>'][ek].append(<EOL>thiscpinfo[ekind]<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for ekind, ek in enumerate(actualkeys):<EOL><INDENT>thiskeyspec = infokeys[ekind]<EOL>nonesub = thiskeyspec[-<NUM_LIT:2>]<EOL>lc_catalog['<STR_LIT>'][ek].append(<EOL>nonesub<EOL>)<EOL><DEDENT><DEDENT><DEDENT>for ek in actualkeys:<EOL><INDENT>lc_catalog['<STR_LIT>'][ek] = np.array(<EOL>lc_catalog['<STR_LIT>'][ek]<EOL>)<EOL><DEDENT>if '<STR_LIT>' in lc_catalog:<EOL><INDENT>if magcol not in lc_catalog['<STR_LIT>']:<EOL><INDENT>lc_catalog['<STR_LIT>'].append(magcol)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>lc_catalog['<STR_LIT>'] = [magcol]<EOL><DEDENT>with open(outfile, '<STR_LIT:wb>') as outfd:<EOL><INDENT>pickle.dump(lc_catalog, outfd, protocol=pickle.HIGHEST_PROTOCOL)<EOL><DEDENT>return outfile<EOL>
This adds checkplot info to the initial light curve catalogs generated by
    `make_lclist`.

    This is used to incorporate all the extra info checkplots can have for
    objects back into columns in the light curve catalog produced by
    `make_lclist`. Objects are matched between the checkplots and the light
    curve catalog using their `objectid`. This then allows one to search this
    'augmented' light curve catalog by these extra columns. The 'augmented'
    light curve catalog also forms the basis for search interface provided by
    the LCC-Server.

    The default list of keys that will be extracted from a checkplot and added
    as columns in the initial light curve catalog is listed above in the
    `CPINFO_DEFAULTKEYS` list.

    Parameters
    ----------

    checkplots : str or list
        If this is a str, is interpreted as a directory which will be searched
        for checkplot pickle files using `checkplotglob`. If this is a list, it
        will be interpreted as a list of checkplot pickle files to process.

    initial_lc_catalog : str
        This is the path to the light curve catalog pickle made by
        `make_lclist`.

    magcol : str
        This is used to indicate the light curve magnitude column to extract
        magnitude column specific information. For example, Stetson variability
        indices can be generated using magnitude measurements in separate
        photometric apertures, which appear in separate `magcols` in the
        checkplot. To associate each such feature of the object with its
        specific `magcol`, pass that `magcol` in here. This `magcol` will then
        be added as a prefix to the resulting column in the 'augmented' LC
        catalog, e.g. Stetson J will appear as `magcol1_stetsonj` and
        `magcol2_stetsonj` for two separate magcols.

    outfile : str
        This is the file name of the output 'augmented' light curve catalog
        pickle file that will be written.

    infokeys : list of tuples

        This is a list of keys to extract from the checkplot and some info on
        how this extraction is to be done. Each key entry is a six-element
        tuple of the following form:

        - key name in the checkplot
        - numpy dtype of the value of this key
        - False if key is associated with a magcol or True otherwise
        - False if subsequent updates to the same column name will append to
          existing key values in the output augmented light curve catalog or
          True if these will overwrite the existing key value
        - character to use to substitute a None value of the key in the
          checkplot in the output light curve catalog column
        - character to use to substitute a nan value of the key in the
          checkplot in the output light curve catalog column

        See the `CPFINFO_DEFAULTKEYS` list above for examples.

    nworkers : int
        The number of parallel workers to launch to extract checkplot
        information.

    Returns
    -------

    str
        Returns the path to the generated 'augmented' light curve catalog pickle
        file.