"beta = {5}, lambda = {6} ({7} paths)") title = title.format(period, GRID_STEPS[1], MINPECTSNRS[1], CORR_LENGTHS[1], ALPHAS[1], BETAS[1], LAMBDAS[1], len(v.paths)) fig = v.plot(title=title, showplot=False) # appending fig to figures of period periodfigs.append(fig) # exporting figs to pdf for fig in periodfigs: pdf.savefig(fig) plt.close(fig) # closing pdf file pagenbs = range(pdf.get_pagecount()) pdf.close() # merging pages of pdf with similar period key = lambda pagenb: int(pagenb / 3) # grouping pages 0-1-2, then 3-4-5 etc. #pagesgroups = psutils.groupbykey(pagenbs, key=key) #print "\nMerging pages of pdf..." #psutils.combine_pdf_pages(pdfname, pagesgroups, verbose=True) # exporting final maps (using pickle) as a dict: # {period: instance of pstomo.VelocityMap} print "\nExporting final velocity maps to file: " + picklename f = psutils.openandbackup(picklename, 'wb') pickle.dump(vmaps, f, protocol=2) f.close()
#print "FTAN outputs 1: ", cleanvgcurves cleanvgcurves = list(cleanvgcurves) #print "FTAN outputs 2: ", cleanvgcurves # convert FTAN_outputs into numpy array cleanvgcurves = np.asarray(cleanvgcurves) FTAN_delta = (dt.datetime.now() - FTAN_t0).total_seconds() print "\nIt took {:.1f} seconds to process {} station pairs' FTANS in {}"\ .format(FTAN_delta, len(pairs), process_type) print "\nFTAN outputs: ", np.asarray(cleanvgcurves) #print "FTAN outputs type: ", type(cleanvgcurves) #print "FTAN outputs shape: ", cleanvgcurves.shape print "\nExporting FTANs ... " # exporting vg curves to pickle file f = psutils.openandbackup(outputpath + '.pickle', mode='wb') pickle.dump(cleanvgcurves, f, protocol=2) f.close() print "\nFTAN calculations completed and saved.\n" # delete xc and cleanvgcurves in an attempt to free up memory del xc del cleanvgcurves
title = title.format(period, GRID_STEPS[1], MINPECTSNRS[1], CORR_LENGTHS[1], ALPHAS[1], BETAS[1], LAMBDAS[1], len(v.paths)) fig = v.plot(title=title, showplot=False) # appending fig to figures of period periodfigs.append(fig) # exporting figs to pdf for fig in periodfigs: pdf.savefig(fig) plt.close(fig) # closing pdf file pagenbs = range(pdf.get_pagecount()) pdf.close() # merging pages of pdf with similar period key = lambda pagenb: int(pagenb / 3 ) # grouping pages 0-1-2, then 3-4-5 etc. #pagesgroups = psutils.groupbykey(pagenbs, key=key) #print "\nMerging pages of pdf..." #psutils.combine_pdf_pages(pdfname, pagesgroups, verbose=True) # exporting final maps (using pickle) as a dict: # {period: instance of pstomo.VelocityMap} print "\nExporting final velocity maps to file: " + picklename f = psutils.openandbackup(picklename, 'wb') pickle.dump(vmaps, f, protocol=2) f.close()
cleanvgcurves = np.asarray(cleanvgcurves) # remove None types from cleanvgcurves cleanvgcurves = cleanvgcurves[cleanvgcurves != np.array(None)] print cleanvgcurves FTAN_delta = (dt.datetime.now() - FTAN_t0).total_seconds() print "\nIt took {:.1f} seconds to process {} station pairs' FTANS in {}"\ .format(FTAN_delta, len(pairs), process_type) print "\nFTAN outputs: ", np.asarray(cleanvgcurves) #print "FTAN outputs type: ", type(cleanvgcurves) #print "FTAN outputs shape: ", cleanvgcurves.shape print "\nExporting FTANs ... " # exporting vg curves to pickle file f = psutils.openandbackup(outputpath + '.pickle', mode='wb') pickle.dump(cleanvgcurves, f, protocol=2) f.close() print "\nFTAN calculations completed and saved.\n" # delete xc and cleanvgcurves in an attempt to free up memory del xc del cleanvgcurves