def read_hatpi_textlc(lcfile):
if '<STR_LIT>' in lcfile:<EOL><INDENT>thiscoldefs = COLDEFS + [('<STR_LIT>',float)]<EOL><DEDENT>elif '<STR_LIT>' in lcfile:<EOL><INDENT>thiscoldefs = COLDEFS + [('<STR_LIT>',float)]<EOL><DEDENT>elif '<STR_LIT>' in lcfile:<EOL><INDENT>thiscoldefs = COLDEFS + [('<STR_LIT>',float)]<EOL><DEDENT>LOGINFO('<STR_LIT>' % lcfile)<EOL>if lcfile.endswith('<STR_LIT>'):<EOL><INDENT>infd = gzip.open(lcfile,'<STR_LIT:r>')<EOL><DEDENT>else:<EOL><INDENT>infd = open(lcfile,'<STR_LIT:r>')<EOL><DEDENT>with infd:<EOL><INDENT>lclines = infd.read().decode().split('<STR_LIT:\n>')<EOL>lclines = [x.split() for x in lclines if ('<STR_LIT:#>' not in x and len(x) > <NUM_LIT:0>)]<EOL>ndet = len(lclines)<EOL>if ndet > <NUM_LIT:0>:<EOL><INDENT>lccols = list(zip(*lclines))<EOL>lcdict = {x[<NUM_LIT:0>]:y for (x,y) in zip(thiscoldefs, lccols)}<EOL>for col in thiscoldefs:<EOL><INDENT>lcdict[col[<NUM_LIT:0>]] = np.array([col[<NUM_LIT:1>](x) for x in lcdict[col[<NUM_LIT:0>]]])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>lcdict = {}<EOL>LOGWARNING('<STR_LIT>' % lcfile)<EOL>for col in thiscoldefs:<EOL><INDENT>lcdict[col[<NUM_LIT:0>]] = np.array([])<EOL><DEDENT><DEDENT>hatid = HATIDREGEX.findall(lcfile)<EOL>lcdict['<STR_LIT>'] = hatid[<NUM_LIT:0>] if hatid else '<STR_LIT>'<EOL>lcdict['<STR_LIT>'] = [x[<NUM_LIT:0>] for x in thiscoldefs]<EOL>lcdict['<STR_LIT>'] = {<EOL>'<STR_LIT>':ndet,<EOL>'<STR_LIT>':hatid[<NUM_LIT:0>] if hatid else '<STR_LIT>',<EOL>'<STR_LIT>':'<STR_LIT>',<EOL>}<EOL>framekeyelems = FRAMEREGEX.findall('<STR_LIT:\n>'.join(lcdict['<STR_LIT>']))<EOL>lcdict['<STR_LIT>'] = np.array([(int(x[<NUM_LIT:0>]) if x[<NUM_LIT:0>].isdigit() else np.nan)<EOL>for x in framekeyelems])<EOL>lcdict['<STR_LIT>'] = np.array([(int(x[<NUM_LIT:1>]) if x[<NUM_LIT:0>].isdigit() else np.nan)<EOL>for x in framekeyelems])<EOL>lcdict['<STR_LIT>'] = np.array([x[<NUM_LIT:2>] for x in framekeyelems])<EOL>lcdict['<STR_LIT>'] = np.array([(int(x[<NUM_LIT:3>]) if x[<NUM_LIT:0>].isdigit() else np.nan)<EOL>for x in framekeyelems])<EOL>lcdict['<STR_LIT>'].extend(['<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>'])<EOL>lcdict['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL>lcdict['<STR_LIT>']['<STR_LIT>'] = [<EOL>'<STR_LIT>' % x for x in np.unique(lcdict['<STR_LIT>']).tolist()<EOL>]<EOL><DEDENT>return lcdict<EOL>
This reads in a textlc that is complete up to the TFA stage.