示例#1
0
            )

        ### If no picklefile found try reading in datafile directly
        else:
            if len(infiles) == 2:
                timefile = [afile for afile in infiles if "time" in afile.lower()]
                if len(timefile) == 1:
                    infiles.remove(timefile[0])
                    ts_full = from_timefile_datafile(datafile=infiles[0], timefile=timefile[0])
                    lf.write(
                        "Loading contents of folder, %s, using the timefile/datafile conventional import\n\n" % folder
                    )

                ### ACCOUNT FOR REMOTE POSSIBILITY THAT 2 FILES COULD STILL JUST BE TWO RAW DATA FILES INSTEAD OF DATAFILE/TIMEFILE
                elif len(timefile) == 0:
                    ts_full = from_spec_files(infiles)
                    lf.write(
                        'Loading contents of folder, %s, multiple raw spectral files %s.  (If these were \
                    supposed to be datafile/timefile and not raw files, couldnt find word "time" in filename.) \
                    \n\n'
                        % (folder, len(infiles))
                    )

                else:
                    lf.write("Failure: multiple timefile matches found in folder %s\n\n" % folder)
                    raise IOError('Timefile not found.  File must contain word "time"')

            else:
                ts_full = from_spec_files(infiles)
                lf.write("Loading contents of folder, %s, multiple raw spectral files %s.\n\n" % (folder, len(infiles)))
示例#2
0
        elif len(picklefile)==1:
            df_full=df_load(picklefile[0])        
            lf.write('Loaded contents of folder, %s, using the ".pickle" file, %s.\n\n'%(folder, get_shortname(picklefile[0])))            

        ### If no picklefile found try reading in datafile directly
        else:
            if len(infiles) == 2:
                timefile=[afile for afile in infiles if 'time' in afile.lower()]
                if len(timefile) == 1:
                    infiles.remove(timefile[0])
                    df_full=from_timefile_datafile(datafile=infiles[0], timefile=timefile[0])
                    lf.write('Loading contents of folder, %s, using the timefile/datafile conventional import\n\n'%folder)   

                ### ACCOUNT FOR REMOTE POSSIBILITY THAT 2 FILES COULD STILL JUST BE TWO RAW DATA FILES INSTEAD OF DATAFILE/TIMEFILE
                elif len(timefile) == 0:
                    df_full=from_spec_files(infiles)
                    lf.write('Loading contents of folder, %s, multiple raw spectral files %s.  (If these were \
                    supposed to be datafile/timefile and not raw files, couldnt find word "time" in filename.) \
                    \n\n'%(folder, len(infiles))) 

                else:
                    lf.write('Failure: multiple timefile matches found in folder %s\n\n'%folder)                                
                    raise IOError('Timefile not found.  File must contain word "time"')                    

            else:
                df_full=from_spec_files(infiles)
                lf.write('Loading contents of folder, %s, multiple raw spectral files %s.\n\n'%(folder, len(infiles)))                    

        ### Output the pickled dataframe    
        df_dump(df_full, od+'/rundata.pickle')
        df_full.to_csv(od+'/rundata.csv')