Exemple #1
0
    if not os.path.exists(resultspath):
        raise IOError("The results path does not exist: {}".format(args.resultspath))

    datafile = os.path.abspath(os.path.join(args.resultspath, args.datafile))
    parametersfile = os.path.abspath(os.path.join(args.resultspath, args.parametersfile))

    # Read file with simulation data
    iom = IOManager()
    iom.open_file(filename=datafile)

    # Read file with parameter data for grid
    parameters = iom.load_parameters()

    if args.parametersfile:
        PL = ParameterLoader()
        gridparams = PL.load_from_file(parametersfile)
    else:
        gridparams = parameters

    # The axes rectangle that is plotted
    view = args.xrange + args.yrange

    if parameters["dimension"] == 1:
        Potential = BlockFactory().create_potential(parameters)
        Grid = TensorProductGrid(gridparams["limits"], gridparams["number_nodes"])
        plot_potential(Grid, Potential, view=view, path=resultspath)
    else:
        print("Not a potential in one space dimension, silent return!")

    iom.finalize()
                        action="store_false")

    parser.add_argument("--noPQ",
                        help="Do not compute the parameters Q and P.",
                        action="store_false")

    args = parser.parse_args()

    # File with the simulation data
    resultspath = os.path.abspath(args.resultspath)

    if not os.path.exists(resultspath):
        raise IOError("The results path does not exist: " + args.resultspath)

    parametersfile = os.path.abspath(
        os.path.join(args.resultspath, args.parametersfile))
    outputfile = os.path.abspath(
        os.path.join(args.resultspath, args.outputfile))

    # Read the path for the configuration file we use for this simulation.
    print("Using configuration from file: " + parametersfile)

    # Set up the parameter provider singleton
    PA = ParameterLoader().load_from_file(parametersfile)
    compute_eigenstate(PA,
                       filename=outputfile,
                       computepq=args.nopq,
                       computePQ=args.noPQ)

    print("Eigenstate computation finished")
Exemple #3
0
    if not os.path.exists(resultspath):
        raise IOError("The results path does not exist: {}".format(
            args.resultspath))

    datafile = os.path.abspath(os.path.join(args.resultspath, args.datafile))
    parametersfile = os.path.abspath(
        os.path.join(args.resultspath, args.parametersfile))

    # Read file with simulation data
    iom = IOManager()
    iom.open_file(filename=datafile)

    # Read file with parameter data for grid
    if args.parametersfile:
        PL = ParameterLoader()
        PP = PL.load_from_file(args.parametersfile)
    else:
        PP = None

    # Which blocks to handle
    blockids = iom.get_block_ids()
    if "all" not in args.blockid:
        blockids = [bid for bid in args.blockid if bid in blockids]

    # The axes rectangle that is plotted
    view = args.xrange + args.yrange

    # Iterate over all blocks
    for blockid in blockids:
        print("Plotting frames of data block '{}'".format(blockid))

if __name__ == "__main__":
    iom = IOManager()

    # Read file with simulation data
    try:
        iom.open_file(filename=sys.argv[1])
    except IndexError:
        iom.open_file()

    parameters = iom.load_parameters()

    # Read file with parameter data for grid
    try:
        PL = ParameterLoader()
        gridparams = PL.load_from_file(sys.argv[2])
    except IndexError:
        gridparams = parameters

    # Manually adjust the plotting region
    # view = [xmin, xmax, ymin, ymax, zmin, zmax]
    view = [None, None, None, None, 0, 10]

    if view[0] is None:
        view[0] = gridparams["limits"][0][0]
    if view[1] is None:
        view[1] = gridparams["limits"][0][1]
    if view[2] is None:
        view[2] = gridparams["limits"][1][0]
    if view[3] is None:
Exemple #5
0
        raise IOError("The results path does not exist: {}".format(
            args.resultspath))

    datafile = os.path.abspath(os.path.join(args.resultspath, args.datafile))
    parametersfile = os.path.abspath(
        os.path.join(args.resultspath, args.parametersfile))

    # Read file with simulation data
    iom = IOManager()
    iom.open_file(filename=datafile)

    # Read file with parameter data for grid
    parameters = iom.load_parameters()

    if args.parametersfile:
        PL = ParameterLoader()
        gridparams = PL.load_from_file(parametersfile)
    else:
        gridparams = parameters

    # The axes rectangle that is plotted
    view = args.xrange + args.yrange + args.zrange

    # Plot
    if parameters["dimension"] == 2:
        Potential = BlockFactory().create_potential(parameters)
        Grid = TensorProductGrid(gridparams["limits"],
                                 gridparams["number_nodes"])
        plot_potential(Grid,
                       Potential,
                       sparsify=args.sparsify,
    # File with the simulation data
    resultspath = os.path.abspath(args.resultspath)

    if not os.path.exists(resultspath):
        raise IOError("The results path does not exist: {}".format(args.resultspath))

    datafile = os.path.abspath(os.path.join(args.resultspath, args.datafile))
    parametersfile = os.path.abspath(os.path.join(args.resultspath, args.parametersfile))

    # Read file with simulation data
    iom = IOManager()
    iom.open_file(filename=datafile)

    # Read file with parameter data for grid
    if args.parametersfile:
        PL = ParameterLoader()
        PP = PL.load_from_file(parametersfile)
    else:
        PP = None

    # Which blocks to handle
    blockids = iom.get_block_ids()
    if "all" not in args.blockid:
        blockids = [bid for bid in args.blockid if bid in blockids]

    # The axes rectangle that is plotted
    view = args.xrange + args.yrange + args.zrange

    # Iterate over all blocks
    for blockid in blockids:
        print("Plotting frames of data block '{}'".format(blockid))
    # File with the simulation data
    resultspath = os.path.abspath(args.resultspath)

    if not os.path.exists(resultspath):
        raise IOError("The results path does not exist: {}".format(args.resultspath))

    datafile = os.path.abspath(os.path.join(args.resultspath, args.datafile))
    parametersfile = os.path.abspath(os.path.join(args.resultspath, args.parametersfile))

    # Read file with simulation data
    iom = IOManager()
    iom.open_file(filename=datafile)

    # Read file with parameter data for grid
    if args.parametersfile:
        PL = ParameterLoader()
        PP = PL.load_from_file(args.parametersfile)
    else:
        PP = None

    # Which blocks to handle
    blockids = iom.get_block_ids()
    if "all" not in args.blockid:
        blockids = [bid for bid in args.blockid if bid in blockids]

    # The axes rectangle that is plotted
    view = args.xrange + args.yrange

    # Iterate over all blocks
    for blockid in blockids:
        print("Plotting frames of data block '{}'".format(blockid))
            z = z.reshape(G.get_number_nodes())

            subplot(N,1,level+1)
            #plotcm(z.reshape(G.get_number_nodes()), darken=0.3)
            plotcf2d(u, v, z, darken=0.3, limits=limits)

        savefig("wavepacket_block_"+str(blockid)+"_level_"+str(level)+"_timestep_"+(5-len(str(step)))*"0"+str(step)+".png")
        close(fig)

    print(" Plotting frames finished")



if __name__ == "__main__":
    iom = IOManager()
    PL = ParameterLoader()

    # Read file with simulation data
    try:
        iom.open_file(filename=sys.argv[1])
    except IndexError:
        iom.open_file()

    # Read file with parameter data for grid
    try:
        PP = PL.load_from_file(sys.argv[2])
    except IndexError:
        PP = None

    # The axes rectangle that is plotted
    #view = [-3, 3, -3, 3]
# Read file with simulation data
iom = IOManager()
iom.open_file(filename=args.simfile)

# Which blocks to handle
if "all" in args.blockid:
    blocks_to_handle = iom.get_block_ids()
else:
    blocks_to_handle = map(int, args.blockid)

# Do we have a specifc configuration file holding
# the definitions for inner products to use?
if args.params:
    parametersfile = args.params
    PA = ParameterLoader().load_from_file(parametersfile)
else:
    # None given, try to load from simulation file
    try:
        PA = iom.load_parameters()
    except:
        PA = None

# See if we have a description for observables and
# especially autocorrelation computation
if PA is not None:
    if PA.has_key("observables"):
        PA = PA["observables"]
        if PA.has_key("autocorrelation"):
            PA = PA["autocorrelation"]
        else: