Example #1
0
                    help = "The simulation data file",
                    nargs = "?",
                    default = GD.file_resultdatafile)

parser.add_argument("-b", "--blockid",
                    type = str,
                    help = "The data block to handle",
                    nargs = "*",
                    default = ["all"])

args = parser.parse_args()

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

# 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]

# Iterate over all blocks
for blockid in blockids:
    if iom.has_wavefunction(blockid=blockid):
        print("Deleting grid and wavefunction data in block '{}'".format(blockid))
        iom.delete_wavefunction(blockid=blockid)
        if iom.has_grid(blockid=blockid):
            iom.delete_grid(blockid=blockid)

iom.finalize()
Example #2
0
    # 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))

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

    # 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.trange + args.vrange

    # Iterate over all blocks
    for blockid in iom.get_block_ids():
        print("Plotting energies in data block '{}'".format(blockid))

        if iom.has_energy(blockid=blockid):
            plot_energies(read_data(iom, blockid=blockid),
                          blockid=blockid,
                          view=view,
                          path=resultspath)
Example #3
0
        filename = GD.file_resultdatafile

    iomc.open_file(filename=filename)

    # New file for eigen transformed data
    P = iomc.load_parameters()
    iome.create_file(P, filename=filename[:-5]+"_eigen.hdf5")

    # Iterate over all groups
    for groupid in iomc.get_group_ids():

        # Create the group if necessary
        if not groupid in iome.get_group_ids():
            iome.create_group(groupid=groupid)

        for blockid in iomc.get_block_ids(groupid=groupid):
            print("Computing eigentransformation of data in block '"+str(blockid)+"'")

            # Create the block if necessary
            if not blockid in iome.get_block_ids(groupid=groupid):
                iome.create_block(blockid=blockid, groupid=groupid)

            # See if we have a wavefunction
            if iomc.has_wavefunction(blockid=blockid):
                from EigentransformWavefunction import transform_wavefunction_to_eigen
                transform_wavefunction_to_eigen(iomc, iome, blockidin=blockid, blockidout=blockid)

            # See if we have a homogeneous wavepacket next
            if iomc.has_wavepacket(blockid=blockid):
                from EigentransformHagedornWavepacket import transform_hawp_to_eigen
                transform_hawp_to_eigen(iomc, iome, blockidin=blockid, blockidout=blockid)
from WaveBlocksND import IOManager


if __name__ == "__main__":

    iom = IOManager()

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

    # Iterate over all blocks
    for blockid in iom.get_block_ids():
        print("Computing the energies in data block '" + str(blockid) + "'")

        if iom.has_energy(blockid=blockid):
            print("Datablock '" + str(blockid) + "' already contains energy data, silent skip.")
            continue

        # TODO: Add new algorithms here

        # We test for an inhomogeneous wavepacket next
        if iom.has_inhomogwavepacket(blockid=blockid):
            import EnergiesWavepacket

            EnergiesWavepacket.compute_energy_inhawp(iom, blockid=blockid)
        # We test for a homogeneous wavepacket next
        elif iom.has_wavepacket(blockid=blockid):
args = parser.parse_args()

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

# Read the additional grid parameters
if args.params:
    parametersfile = args.params
    PA = ParameterLoader().load_from_file(parametersfile)
else:
    PA = None

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

# Iterate over all blocks
for blockid in blocks_to_handle:
    print("Evaluating wavepackets in data block '"+str(blockid)+"'")

    if iom.has_wavefunction(blockid=blockid):
        print("Datablock '"+str(blockid)+"' already contains wavefunction data, silent skip.")
        continue

    # NOTE: Add new algorithms here

    if iom.has_wavepacket(blockid=blockid):
        import EvaluateWavepackets