Exemplo n.º 1
0
def main(args):
    """ Main function performing the rendering """
    logger.info(" Total time: %d (frames: %d)", SETTINGS.Duration,
                eval(SETTINGS.NumberFrames))
    pypovray.render_scene_to_mp4(frame)

    return 0
def main(args):
    """ Runs the simulation """

    # Load a user defined configuration file
    if args.config:
        pypovray.SETTINGS = load_config(args.config)
    if args.frame:
        # Create objects for the scene (i.e. parse PDB files)
        scene_objects()
        # User entered the specific frame to render
        pypovray.render_scene_to_png(frame, args.frame)
    else:
        # No output file type and no specific frame, exit
        if not args.gif and not args.mp4:
            parser.print_help()
            sys.exit('\nPlease specify either a specific frame number or ' +
                     'output format for a movie file')
        else:
            # Create objects for the scene (i.e. parse PDB files)
            scene_objects()
        # Render a movie, depending on output type selected (both files is possible)
        if args.gif:
            pypovray.render_scene_to_gif(frame)
        if args.mp4:
            pypovray.render_scene_to_mp4(frame)
    return 0
Exemplo n.º 3
0
def main(args):
    """ Main function of this program """
    make_objects()
    logger.info(" Total time: %d (frames: %d)", SETTINGS.Duration,
                eval(SETTINGS.NumberFrames))
    pypovray.render_scene_to_mp4(frame)
    return 0
def main(args):
    """ Runs the simulation """
    if args.config:
        pypovray.SETTINGS = load_config(args.config)
    if args.range:
        # User entered a range of frames to render
        start, stop = ast.literal_eval(args.range)
        frame_range = range(start, stop)
    else:
        # No range entered, use default 0, n_frames
        print(pypovray.SETTINGS.NumberFrames)
        frame_range = range(0, eval(pypovray.SETTINGS.NumberFrames))
    if args.time:
        # User entered the specific timepoint to render (in seconds)
        pypovray.render_scene_to_png(frame, args.time)
    else:
        # No output file type and no specific time, exit
        if not args.gif and not args.mp4 and not args.range:
            parser.print_help()
            sys.exit("\nPlease specify either a specific time point, range of frames" \
                     " or output format for a movie file")
        # Render a movie, depending on output type selected (both files is possible)
        if args.gif:
            pypovray.render_scene_to_gif(frame, frame_range)
        if args.mp4:
            pypovray.render_scene_to_mp4(frame, frame_range)
    return 0
Exemplo n.º 5
0
def main():
    """
    Main function performing the rendering Prints user information to sceen and grabs settings
    from settings file. Starts main render and creates .mp4 file
    """
    logger.info(" Total time: %d (frames: %d)", SETTINGS.Duration,
                eval(SETTINGS.NumberFrames))
    pypovray.SETTINGS = load_config('default.ini')
    pypovray.render_scene_to_mp4(frame)
    return 0
Exemplo n.º 6
0
def main():
    """
    main()

    Main activates the program and renders the animation
    """
    global MOLECULES
    get_animation_data(False)
    MOLECULES = make_molecules(molecules={})
    pypovray.render_scene_to_mp4(make_frame, range(700))
    return 0
Exemplo n.º 7
0
def main(args):
    """ Main function performing the rendering """

    # Checks how to run animation depending on given arguments
    if len(args) < 2:
        pydoc.help(__name__)
    elif len(args) < 3:
        if args[1] == "-":
            pypovray.render_scene_to_mp4(frame)
        else:
            pypovray.render_scene_to_png(frame, int(args[1]))
    elif len(args) < 4:
        pypovray.render_scene_to_mp4(frame, range(int(args[1]), int(args[2]) + 1))
    else:
        pydoc.help(__name__)

    return 0
Exemplo n.º 8
0
def main(args):
    """Maakt een animatie van het translatie proces van mRNA aan de hand van de input.
    args: 2e argument is de filenaam, 3e argument is hoeveel fps de video gerenderd moet worden,
    wordt er niets ingevuld dan wordt de fps uit default.ini gehaalt.
    4e argument hoeveel tripletten er vertaalt moeten worden in de animatie."""
    global triplet_list, key_cycle

    # user data gebruiken
    if len(args) >= 2:
        file_naam = args[1]  # de mRNA sequencie die getransleert moet worden
    else:
        print("You did not gave a file name")
        return 0
    if len(args) >= 3 and args[2].isdigit():
        fps = int(args[2])  # fps
    else:
        fps = int(SETTINGS.RenderFPS)

    # verwerken
    mrna = nonpov.read_fasta(file_naam)
    triplet_list = nonpov.triplet_maker(mrna)
    nucleo_maker(mrna)
    amino_lister(triplet_list)
    key_maker()

    # lengte filmpje en key cycle instellen
    SETTINGS.RenderFPS = fps
    key_cycle = fps * 2
    if len(args) >= 4 and args[3].isdigit() and int(
            args[3] <= len(triplet_list)):
        SETTINGS.NumberFrames = str(
            int(args[3]) * key_cycle)  #De lengte van de video berekenen
    else:
        SETTINGS.NumberFrames = str(len(triplet_list) * key_cycle)

    pypovray.render_scene_to_mp4(frame)
    return 0
Exemplo n.º 9
0
    ethanol.move_to([x, y, -5])

    # Rotate the molecule on x- and y-axes
    # NOTE: default rotate does NOT work when using a thread-pool,
    # use the molecule.rotate_by_step method instead
    ethanol.rotate_by_step([1, 0, 0], RAD_PER_SCENE, step)

    # Return a 'Scene' object containing -all- objects to render, i.e. the camera,
    # lights and in this case, a molecule and a list of spheres (TRACER).
    return Scene(models.default_camera,
                 objects=[models.default_light, FRONT_LIGHT] +
                 ethanol.povray_molecule + TRACER,
                 included=['colors.inc'])


if __name__ == '__main__':
    # Load the prototyping settings instead of the default
    pypovray.SETTINGS = load_config('prototype.ini')

    # Create static objects
    scene_objects()

    # Render as an MP4 movie
    pypovray.render_scene_to_mp4(frame, range(20, 40))

    # Timing for running the current simulation including creating the movie:
    #  |  Single-thread (s)  |  Multi-threaded (s) |
    #  |---------------------|---------------------|
    #  |       101.561       |       16.341        |
    #  |---------------------|---------------------|
Exemplo n.º 10
0
    if time_point < TP_END[0]:
        scene = s0_intro_text()
    elif time_point < TP_END[1]:
        scene = s1_cell_overview()
    elif time_point < TP_END[2]:
        scene = s2_cell_zoom(step)
    elif time_point < TP_END[3]:
        scene = s3_in_cell()
    elif time_point < TP_END[4]:
        scene = s4_zoom_to_mrna(step)
    elif time_point < TP_END[11]:
        scene = scenes_mrna(step, time_point)
    else:
        text = Text('ttf', '"timrom.ttf"', '"Uh-oh, this ain\'t right"', 0, 0,
                    'translate', [-4, 0, 0], 'scale', [2, 2, 0],
                    models.text_model)
        scene = Scene(models.default_camera,
                      objects=[models.default_light, text])
    return scene


if __name__ == "__main__":
    logger.info(" Total time: %ds (frames: %d)", SETTINGS.Duration,
                TOTAL_FRAMES)

    time_points = [56, 64]
    render_frames = [int(i * SETTINGS.RenderFPS) for i in time_points]

    pypovray.render_scene_to_mp4(frame)
    # pypovray.render_scene_to_mp4(frame, range(render_frames[0], render_frames[1]))
Exemplo n.º 11
0
            elif step > step_start + 10 and step <= step_start + 20:
                alphact_stage_two_sliced_mol = INSULIN_RECEPTOR.divide(
                    alphact_stage_two_sliced, "alphact_two")
                return Scene(camera,
                             objects=[light] +
                             alphact_stage_two_sliced_mol.povray_molecule)

    return Scene(camera,
                 objects=[light] +
                 alphact_stage_one_sliced_mol.povray_molecule)


def main(args):
    """ Main function performing the rendering """

    logger.info(" Total time: %d (frames: %d)", SETTINGS.Duration,
                eval(SETTINGS.NumberFrames))

    return 0


if __name__ == '__main__':
    #sys.exit(main(sys.argv))
    #pypovray.render_scene_to_png(frame)
    pypovray.render_scene_to_mp4(frame, range(36, 48))

# + INSULIN_RECEPTOR.povray_molecule
# + insulin.povray_molecule
# + alphact_stage_two_mol.povray_molecule
# + alphact_stage_one_sliced_mol.povray_molecule
# + site_one_complex.povray_molecule
Exemplo n.º 12
0
from pypovray import pypovray, pdb, models, SETTINGS
from vapory.vapory import Scene, LightSource, Text, Texture, Pigment, Finish, Camera


def frame(step):
    global LIPID

    LIPID = pdb.PDBMolecule('{}/pdb/lipid_test.pdb'.format(
        SETTINGS.AppLocation),
                            offset=[-100, 0, 0])
    # RNA.show_label(camera=models.default_camera, name=True)
    # RNA.rotate([0, 1, 1], [0, 3.14, 3.14])

    if step < 15:
        LIPID.move_to([0, 0, 0])

    return Scene(Camera('location', [0, 0, -350], 'look_at', [0, 0, 0]),
                 objects=[models.default_light] + LIPID.povray_molecule)


if __name__ == '__main__':
    pypovray.render_scene_to_mp4(frame, range(0, 1))
Exemplo n.º 13
0
def main(args):
    logger.info(" Total time: %d (frames: %d)", SETTINGS.Duration,
                eval(SETTINGS.NumberFrames))
    pypovray.render_scene_to_mp4(frame)
    return 0
def main():
    molecule()
    pypovray.render_scene_to_mp4(scene)