Exemple #1
0
        'pick labels for output figures')
label_args.add_argument('--xlabel', default='Time (ps)')
label_args.add_argument('--ylabel', default='Maximum shear (1/ps)')
label_args.add_argument('--title', default='Maximum found shear of system per time')

# Parse and control for action
args = parser.parse_args()

# Plot options
colours = get_colours(args.colour, 2)
linestyles = get_linestyles(args.linestyle, 2)
labels, draw_legend = get_labels(args.label, 2)

# Define system and add data maps
system = System()
system.files(base=args.datamap, start=args.begin, end=args.end)

# Collect shear data in list
frames = []
max_shear = []

floor = args.floor
ceil = floor + args.num_shear
if ceil <= floor:
    parser.error('number of cell rows to calculate shear over (--number) must be positive')

rows = [floor, ceil]

for i, _file in enumerate(system.datamaps):
    print("Reading %s (%d of %d) ... " % (_file, i+1, len(system.datamaps)), end='')
    sys.stdout.flush()
label_args.add_argument('--xlabel', default='Time (ps)')
label_args.add_argument('--ylabel', default='Dissipated energy (kJ/mol)')
label_args.add_argument('--title', default='')

args = parser.parse_args()

xlims = [args.xmin, args.xmax]
ylims = [args.ymin, args.ymax]

times = []
d_visc_energy = []
d_slip_energy = []

# Create system
system = System(base = args.base)
system.files(start = args.start, end = args.end)

for frame, _file in enumerate(system.datamaps):
    datamap = DataMap(_file, min_mass = args.min_mass)

    times.append(frame*args.delta_t)
    d_visc_energy.append(datamap._sum_viscous_dissipation(args.width,
            args.delta_t, args.num_cells, args.viscosity, args.mass_flow))

    if args.slip:
        d_slip_energy.append(calc_slip_dissipation(datamap, args.floor))

times = list(np.array(times) + args.time_start)

if args.print:
    for i, (time, energy) in enumerate(zip(times, d_visc_energy)):
parser.add_argument('-vadj', '--adjust_velocity', action='store_true',
        help="remove averaged contact line velocity from flow velocity")
parser.add_argument('-dt', '--delta_t', type=float, default=10.,
        help="time between frames in ps (default: 10)")
parser.add_argument('--noheaders', action='store_false', dest='header',
        help="do not output position and height headers")
parser.add_argument('--nooutput', action='store_false', dest='do_output',
        help="do not output cells")

# Parse and control for action
args = parser.parse_args()

# If base given, create system
if args.base != None:
    system = System(base = args.base)
    system.files(start = args.begin, end = args.end)

else:
    system = System()
    system.datamaps = [args.file]

if args.average:
    args.do_output = False

var = []
if args.type == 'temp':
    var.append('T')
elif args.type == 'flow':
    var.append('U')
    var.append('V')
else:
Exemple #4
0
# Decorations
label_args = parser.add_argument_group('label options',
        'pick labels for output figures')
label_args.add_argument('--xlabel', default='Mass flow along x (nm/ps)')
label_args.add_argument('--ylabel', default='Height (nm)')
label_args.add_argument('--title', default='')

# Parse and control for action
args = parser.parse_args()

# Define system and add data maps
system = System()
if args.num_combine == 0:
    system.datamaps.append(args.datamap)
elif args.num_combine >= 1:
    system.files(base=args.datamap, start=args.start, end=args.start+args.num_combine-1)
else:
    parser.error('negative -n supplied')

# Collect profile data into 2D arrays
profile = {'data': [], 'count': [], 'std': [], 'error': []}

for i, _file in enumerate(system.datamaps):
    datamap = DataMap(_file, min_mass=args.min_mass)
    height = {'data': []}

    for _type in profile.keys():
        profile[_type].append([])

    for row in datamap.cells:
        count = 0
                i += 1
            else:
                combined.update({"U": 0.0, "V": 0.0})

            # Append to container
            output.cells.append(combined)

    # Convert by hand to good format and save
    output.cells = np.array(output.cells)
    output._info = output.info
    output._grid()

    return output


# Create containers
dens = System(base=args.dens)
dens.files(start=args.start, end=args.end, numdigits=args.numdigits, ext=args.extension)

flow = System(base=args.flow)
flow.files(start=args.start, end=args.end, numdigits=args.numdigits, ext=args.extension)

# Combine and output one by one
for i, _list in enumerate(zip(dens.datamaps, flow.datamaps)):
    print("\rCombining maps %d ..." % (i + 1), end=" ")
    output = combine(dict(zip(["dens", "flow"], _list)))

    num = ("%%0%dd" % args.numdigits) % (i + args.start)
    save = "%s%s%s" % (args.output, num, args.extension)
    output.save(save)