コード例 #1
0
def plot_depos(ctx, json_path, plot, input_file, output_file):
    '''
    Make a plot from a WCT JSON depo file
    '''
    import depos as deposmod
    plotter = getattr(deposmod, "plot_" + plot)
    depos = deposmod.load(input_file)
    plotter(depos, output_file)
コード例 #2
0
def move_depos(ctx, json_path, center, offset, input_file, output_file):
    '''
    Apply some transformations to a file of JSON depos and create a new file.
    '''
    import depos as deposmod
    depos = deposmod.load(input_file)

    if center:
        center = tuple([float(eval(c, units.__dict__)) for c in center])
        depos = deposmod.center(depos, center)

    if offset:
        offset = tuple([float(eval(c, units.__dict__)) for c in offset])
        depos = deposmod.move(depos, offset)
    deposmod.dump(output_file, depos)
コード例 #3
0
def unitify_depos(ctx, json_path, distance_unit, time_unit, energy_unit,
                  step_unit, input_file, output_file):
    '''
    Set units for a WCT JSON deposition file.

    The units given are what the input file should be assumed to
    follow.  The output file will then be in WCT's system of units.

    '''

    import depos as deposmod
    depos = deposmod.load(input_file)
    depos = deposmod.apply_units(depos, distance_unit, time_unit, energy_unit,
                                 step_unit)
    deposmod.dump(output_file, depos)