Пример #1
0
        # exporting plot to pdf
        pdf.savefig(fig)
        plt.close()
        vmaps[period] = v
    # closing pdf file
    pdf.close()

    # merging pages of pdf with similar period
    pagenbs = list(range(len(param_lists)))

    def key(pagenb):
        period = param_lists[pagenb][0]
        return period

    pagesgroups = psutils.groupbykey(pagenbs, key=key)
    print("\nMerging pages of pdf...")
    psutils.combine_pdf_pages(pdfname, pagesgroups, verbose=True)

    #Export pickle Louis

    print('Export to pickle')

    usersuffix = input("\nEnter suffix to append: [none]\n").strip()

    try:
        os.makedirs(TOMO_DIR)
    except:
        pass
    basename = os.path.basename(pickle_file).replace('FTAN',
                                                     '2-pass-tomography')
        # - 2nd panel = map of interstation paths and path densities
        # - 3rd panel = resolution map
        #
        # See doc of VelocityMap.plot(), VelocityMap.plot_velocity(),
        # VelocityMap.plot_pathdensity(), VelocityMap.plot_resolution()
        # for a detailed description of the input arguments.

        title = ("Period = {0} s, grid {1} x {1} deg, min SNR = {2}, corr. length "
                 "= {3} km, alpha = {4}, beta = {5}, lambda = {6} ({7} paths)")
        title = title.format(period, grid_step, minspectSNR, corr_length,
                             alpha, beta, lambda_, len(v.paths))
        fig = v.plot(title=title, showplot=False)

        # exporting plot to pdf
        pdf.savefig(fig)
        plt.close()

    # closing pdf file
    pdf.close()

    # merging pages of pdf with similar period
    pagenbs = range(len(param_lists))

    def key(pagenb):
        period = param_lists[pagenb][0]
        return period

    pagesgroups = psutils.groupbykey(pagenbs, key=key)
    print "\nMerging pages of pdf..."
    psutils.combine_pdf_pages(pdfname, pagesgroups, verbose=True)